From 4f73fcaca35878b265b1b8ad21b5c96d6cfcd43f Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 10 Nov 2021 22:04:12 +0000 Subject: [PATCH 1/2] docs: fix docstring formatting Committer: @parthea PiperOrigin-RevId: 408564402 Source-Link: https://github.com/googleapis/googleapis/commit/3020af5118bf135a2ac279d39093cbbfd343d0f8 Source-Link: https://github.com/googleapis/googleapis-gen/commit/799c505014cbad999e2bd3dca4f5e1f68bde5aa2 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzk5YzUwNTAxNGNiYWQ5OTllMmJkM2RjYTRmNWUxZjY4YmRlNWFhMiJ9 --- 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 | 10 + owl-bot-staging/v1/package.json | 64 + .../cloud/securitycenter/v1/asset.proto | 135 + .../cloud/securitycenter/v1/finding.proto | 224 + .../cloud/securitycenter/v1/folder.proto | 38 + .../cloud/securitycenter/v1/indicator.proto | 40 + .../v1/notification_config.proto | 96 + .../v1/notification_message.proto | 45 + .../v1/organization_settings.proto | 86 + .../cloud/securitycenter/v1/resource.proto | 59 + .../v1/run_asset_discovery_response.proto | 52 + .../securitycenter/v1/security_marks.proto | 70 + .../v1/securitycenter_service.proto | 1374 +++++ .../cloud/securitycenter/v1/source.proto | 70 + .../securitycenter/v1/vulnerability.proto | 215 + .../v1/security_center.create_finding.js | 67 + ...urity_center.create_notification_config.js | 68 + .../v1/security_center.create_source.js | 60 + ...urity_center.delete_notification_config.js | 54 + .../v1/security_center.get_iam_policy.js | 59 + ...security_center.get_notification_config.js | 54 + ...curity_center.get_organization_settings.js | 54 + .../v1/security_center.get_source.js | 54 + .../v1/security_center.group_assets.js | 168 + .../v1/security_center.group_findings.js | 172 + .../v1/security_center.list_assets.js | 177 + .../v1/security_center.list_findings.js | 183 + ...curity_center.list_notification_configs.js | 67 + .../v1/security_center.list_sources.js | 68 + .../v1/security_center.run_asset_discovery.js | 55 + .../v1/security_center.set_finding_state.js | 66 + .../v1/security_center.set_iam_policy.js | 62 + .../security_center.test_iam_permissions.js | 62 + .../v1/security_center.update_finding.js | 66 + ...urity_center.update_notification_config.js | 58 + ...ity_center.update_organization_settings.js | 58 + .../security_center.update_security_marks.js | 66 + .../v1/security_center.update_source.js | 58 + owl-bot-staging/v1/src/index.ts | 25 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 277 + owl-bot-staging/v1/src/v1/index.ts | 19 + .../v1/src/v1/security_center_client.ts | 4987 +++++++++++++++++ .../src/v1/security_center_client_config.json | 141 + .../v1/src/v1/security_center_proto_list.json | 15 + .../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_security_center_v1.ts | 3743 +++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + owl-bot-staging/v1beta1/.eslintignore | 7 + owl-bot-staging/v1beta1/.eslintrc.json | 3 + owl-bot-staging/v1beta1/.gitignore | 14 + owl-bot-staging/v1beta1/.jsdoc.js | 55 + owl-bot-staging/v1beta1/.mocharc.js | 33 + owl-bot-staging/v1beta1/.prettierrc.js | 22 + owl-bot-staging/v1beta1/README.md | 1 + .../v1beta1/linkinator.config.json | 10 + owl-bot-staging/v1beta1/package.json | 64 + .../cloud/securitycenter/v1beta1/asset.proto | 93 + .../securitycenter/v1beta1/finding.proto | 110 + .../v1beta1/organization_settings.proto | 79 + .../run_asset_discovery_response.proto | 49 + .../v1beta1/security_marks.proto | 53 + .../v1beta1/securitycenter_service.proto | 824 +++ .../cloud/securitycenter/v1beta1/source.proto | 56 + .../v1beta1/security_center.create_finding.js | 67 + .../v1beta1/security_center.create_source.js | 60 + .../v1beta1/security_center.get_iam_policy.js | 59 + ...curity_center.get_organization_settings.js | 54 + .../v1beta1/security_center.get_source.js | 54 + .../v1beta1/security_center.group_assets.js | 131 + .../v1beta1/security_center.group_findings.js | 110 + .../v1beta1/security_center.list_assets.js | 136 + .../v1beta1/security_center.list_findings.js | 113 + .../v1beta1/security_center.list_sources.js | 67 + .../security_center.run_asset_discovery.js | 55 + .../security_center.set_finding_state.js | 66 + .../v1beta1/security_center.set_iam_policy.js | 62 + .../security_center.test_iam_permissions.js | 62 + .../v1beta1/security_center.update_finding.js | 62 + ...ity_center.update_organization_settings.js | 57 + .../security_center.update_security_marks.js | 61 + .../v1beta1/security_center.update_source.js | 57 + owl-bot-staging/v1beta1/src/index.ts | 25 + .../v1beta1/src/v1beta1/gapic_metadata.json | 223 + owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 + .../src/v1beta1/security_center_client.ts | 3248 +++++++++++ .../security_center_client_config.json | 116 + .../v1beta1/security_center_proto_list.json | 9 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1beta1/system-test/install.ts | 49 + .../test/gapic_security_center_v1beta1.ts | 2731 +++++++++ owl-bot-staging/v1beta1/tsconfig.json | 19 + owl-bot-staging/v1beta1/webpack.config.js | 64 + owl-bot-staging/v1p1beta1/.eslintignore | 7 + owl-bot-staging/v1p1beta1/.eslintrc.json | 3 + owl-bot-staging/v1p1beta1/.gitignore | 14 + owl-bot-staging/v1p1beta1/.jsdoc.js | 55 + owl-bot-staging/v1p1beta1/.mocharc.js | 33 + owl-bot-staging/v1p1beta1/.prettierrc.js | 22 + owl-bot-staging/v1p1beta1/README.md | 1 + .../v1p1beta1/linkinator.config.json | 10 + owl-bot-staging/v1p1beta1/package.json | 64 + .../securitycenter/v1p1beta1/asset.proto | 135 + .../securitycenter/v1p1beta1/finding.proto | 146 + .../securitycenter/v1p1beta1/folder.proto | 38 + .../v1p1beta1/notification_config.proto | 108 + .../v1p1beta1/notification_message.proto | 44 + .../v1p1beta1/organization_settings.proto | 86 + .../securitycenter/v1p1beta1/resource.proto | 53 + .../run_asset_discovery_response.proto | 52 + .../v1p1beta1/security_marks.proto | 70 + .../v1p1beta1/securitycenter_service.proto | 1351 +++++ .../securitycenter/v1p1beta1/source.proto | 69 + .../security_center.create_finding.js | 65 + ...urity_center.create_notification_config.js | 67 + .../security_center.create_source.js | 60 + ...urity_center.delete_notification_config.js | 54 + .../security_center.get_iam_policy.js | 59 + ...security_center.get_notification_config.js | 54 + ...curity_center.get_organization_settings.js | 54 + .../v1p1beta1/security_center.get_source.js | 54 + .../v1p1beta1/security_center.group_assets.js | 168 + .../security_center.group_findings.js | 164 + .../v1p1beta1/security_center.list_assets.js | 177 + .../security_center.list_findings.js | 173 + ...curity_center.list_notification_configs.js | 67 + .../v1p1beta1/security_center.list_sources.js | 68 + .../security_center.run_asset_discovery.js | 55 + .../security_center.set_finding_state.js | 66 + .../security_center.set_iam_policy.js | 62 + .../security_center.test_iam_permissions.js | 62 + .../security_center.update_finding.js | 66 + ...urity_center.update_notification_config.js | 58 + ...ity_center.update_organization_settings.js | 58 + .../security_center.update_security_marks.js | 66 + .../security_center.update_source.js | 58 + owl-bot-staging/v1p1beta1/src/index.ts | 25 + .../src/v1p1beta1/gapic_metadata.json | 277 + .../v1p1beta1/src/v1p1beta1/index.ts | 19 + .../src/v1p1beta1/security_center_client.ts | 4923 ++++++++++++++++ .../security_center_client_config.json | 141 + .../v1p1beta1/security_center_proto_list.json | 13 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1p1beta1/system-test/install.ts | 49 + .../test/gapic_security_center_v1p1beta1.ts | 3743 +++++++++++++ owl-bot-staging/v1p1beta1/tsconfig.json | 19 + owl-bot-staging/v1p1beta1/webpack.config.js | 64 + 158 files changed, 36863 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/securitycenter/v1/asset.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/finding.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/folder.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/indicator.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_config.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_message.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/resource.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/security_marks.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/source.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.create_finding.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.create_notification_config.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.create_source.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.delete_notification_config.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.get_iam_policy.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.get_notification_config.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.get_organization_settings.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.get_source.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.group_assets.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.group_findings.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.list_assets.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.list_findings.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.list_notification_configs.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.list_sources.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.run_asset_discovery.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.set_finding_state.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.set_iam_policy.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.test_iam_permissions.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.update_finding.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.update_notification_config.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.update_organization_settings.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.update_security_marks.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.update_source.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/security_center_client.ts create mode 100644 owl-bot-staging/v1/src/v1/security_center_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/security_center_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_security_center_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/v1beta1/.eslintignore create mode 100644 owl-bot-staging/v1beta1/.eslintrc.json create mode 100644 owl-bot-staging/v1beta1/.gitignore create mode 100644 owl-bot-staging/v1beta1/.jsdoc.js create mode 100644 owl-bot-staging/v1beta1/.mocharc.js create mode 100644 owl-bot-staging/v1beta1/.prettierrc.js create mode 100644 owl-bot-staging/v1beta1/README.md create mode 100644 owl-bot-staging/v1beta1/linkinator.config.json create mode 100644 owl-bot-staging/v1beta1/package.json create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto create mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_finding.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_source.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_source.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_assets.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_findings.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_assets.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_findings.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_sources.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_finding.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js create mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_source.js create mode 100644 owl-bot-staging/v1beta1/src/index.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/index.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/security_center_client.ts create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/security_center_client_config.json create mode 100644 owl-bot-staging/v1beta1/src/v1beta1/security_center_proto_list.json create mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1beta1/system-test/install.ts create mode 100644 owl-bot-staging/v1beta1/test/gapic_security_center_v1beta1.ts create mode 100644 owl-bot-staging/v1beta1/tsconfig.json create mode 100644 owl-bot-staging/v1beta1/webpack.config.js create mode 100644 owl-bot-staging/v1p1beta1/.eslintignore create mode 100644 owl-bot-staging/v1p1beta1/.eslintrc.json create mode 100644 owl-bot-staging/v1p1beta1/.gitignore create mode 100644 owl-bot-staging/v1p1beta1/.jsdoc.js create mode 100644 owl-bot-staging/v1p1beta1/.mocharc.js create mode 100644 owl-bot-staging/v1p1beta1/.prettierrc.js create mode 100644 owl-bot-staging/v1p1beta1/README.md create mode 100644 owl-bot-staging/v1p1beta1/linkinator.config.json create mode 100644 owl-bot-staging/v1p1beta1/package.json create mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto create mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto create mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto create mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto create mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto create mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto create mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto create mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto create mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto create mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto create mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js create mode 100644 owl-bot-staging/v1p1beta1/src/index.ts create mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts create mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client.ts create mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client_config.json create mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_proto_list.json create mode 100644 owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1p1beta1/system-test/install.ts create mode 100644 owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts create mode 100644 owl-bot-staging/v1p1beta1/tsconfig.json create mode 100644 owl-bot-staging/v1p1beta1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 00000000..cfc348ec --- /dev/null +++ b/owl-bot-staging/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json new file mode 100644 index 00000000..78215349 --- /dev/null +++ b/owl-bot-staging/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore new file mode 100644 index 00000000..5d32b237 --- /dev/null +++ b/owl-bot-staging/v1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js new file mode 100644 index 00000000..e201160b --- /dev/null +++ b/owl-bot-staging/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// 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. +// +// ** 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 2021 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/security-center', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js new file mode 100644 index 00000000..50bc7f79 --- /dev/null +++ b/owl-bot-staging/v1/.mocharc.js @@ -0,0 +1,33 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 00000000..84f4713a --- /dev/null +++ b/owl-bot-staging/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 00000000..73f34764 --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Securitycenter: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json new file mode 100644 index 00000000..0121dfa6 --- /dev/null +++ b/owl-bot-staging/v1/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 5 +} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 00000000..b88a2160 --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/security-center", + "version": "0.1.0", + "description": "Securitycenter client for Node.js", + "repository": "googleapis/nodejs-securitycenter", + "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 securitycenter", + "securitycenter", + "security center" + ], + "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": "^2.28.0" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^14.17.32", + "@types/sinon": "^10.0.6", + "c8": "^7.10.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^2.14.5", + "mocha": "^9.1.3", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.2", + "ts-loader": "^9.2.6", + "typescript": "^4.4.4", + "webpack": "^5.62.1", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/asset.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/asset.proto new file mode 100644 index 00000000..b23a4232 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/asset.proto @@ -0,0 +1,135 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1/folder.proto"; +import "google/cloud/securitycenter/v1/security_marks.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Security Command Center representation of a Google Cloud +// resource. +// +// The Asset is a Security Command Center resource that captures information +// about a single Google Cloud resource. All modifications to an Asset are only +// within the context of Security Command Center and don't affect the referenced +// Google Cloud resource. +message Asset { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Asset" + pattern: "organizations/{organization}/assets/{asset}" + pattern: "folders/{folder}/assets/{asset}" + pattern: "projects/{project}/assets/{asset}" + }; + + // Security Command Center managed properties. These properties are managed by + // Security Command Center and cannot be modified by the user. + message SecurityCenterProperties { + // The full resource name of the Google Cloud resource this asset + // represents. This field is immutable after create time. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_name = 1; + + // The type of the Google Cloud resource. Examples include: APPLICATION, + // PROJECT, and ORGANIZATION. This is a case insensitive field defined by + // Security Command Center and/or the producer of the resource and is + // immutable after create time. + string resource_type = 2; + + // The full resource name of the immediate parent of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_parent = 3; + + // The full resource name of the project the resource belongs to. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_project = 4; + + // Owners of the Google Cloud resource. + repeated string resource_owners = 5; + + // The user defined display name for this resource. + string resource_display_name = 6; + + // The user defined display name for the parent of this resource. + string resource_parent_display_name = 7; + + // The user defined display name for the project of this resource. + string resource_project_display_name = 8; + + // Contains a Folder message for each folder in the assets ancestry. + // The first folder is the deepest nested folder, and the last folder is the + // folder directly under the Organization. + repeated Folder folders = 10; + } + + // Cloud IAM Policy information associated with the Google Cloud resource + // described by the Security Command Center asset. This information is managed + // and defined by the Google Cloud resource and cannot be modified by the + // user. + message IamPolicy { + // The JSON representation of the Policy associated with the asset. + // See https://cloud.google.com/iam/reference/rest/v1/Policy for format + // details. + string policy_blob = 1; + } + + // The relative resource name of this asset. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/assets/{asset_id}". + string name = 1; + + // Security Command Center managed properties. These properties are managed by + // Security Command Center and cannot be modified by the user. + SecurityCenterProperties security_center_properties = 2; + + // Resource managed properties. These properties are managed and defined by + // the Google Cloud resource and cannot be modified by the user. + map resource_properties = 7; + + // User specified security marks. These marks are entirely managed by the user + // and come from the SecurityMarks resource that belongs to the asset. + SecurityMarks security_marks = 8; + + // The time at which the asset was created in Security Command Center. + google.protobuf.Timestamp create_time = 9; + + // The time at which the asset was last updated or added in Cloud SCC. + google.protobuf.Timestamp update_time = 10; + + // Cloud IAM Policy information associated with the Google Cloud resource + // described by the Security Command Center asset. This information is managed + // and defined by the Google Cloud resource and cannot be modified by the + // user. + IamPolicy iam_policy = 11; + + // The canonical name of the resource. It's either + // "organizations/{organization_id}/assets/{asset_id}", + // "folders/{folder_id}/assets/{asset_id}" or + // "projects/{project_number}/assets/{asset_id}", depending on the closest CRM + // ancestor of the resource. + string canonical_name = 13; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/finding.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/finding.proto new file mode 100644 index 00000000..e14266b4 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/finding.proto @@ -0,0 +1,224 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1/indicator.proto"; +import "google/cloud/securitycenter/v1/security_marks.proto"; +import "google/cloud/securitycenter/v1/vulnerability.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Security Command Center finding. +// +// A finding is a record of assessment data like security, risk, health, or +// privacy, that is ingested into Security Command Center for presentation, +// notification, analysis, policy testing, and enforcement. For example, a +// cross-site scripting (XSS) vulnerability in an App Engine application is a +// finding. +message Finding { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Finding" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}" + pattern: "folders/{folder}/sources/{source}/findings/{finding}" + pattern: "projects/{project}/sources/{source}/findings/{finding}" + }; + + // The state of the finding. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // The finding requires attention and has not been addressed yet. + ACTIVE = 1; + + // The finding has been fixed, triaged as a non-issue or otherwise addressed + // and is no longer active. + INACTIVE = 2; + } + + // The severity of the finding. + enum Severity { + // This value is used for findings when a source doesn't write a severity + // value. + SEVERITY_UNSPECIFIED = 0; + + // Vulnerability: + // A critical vulnerability is easily discoverable by an external actor, + // exploitable, and results in the direct ability to execute arbitrary code, + // exfiltrate data, and otherwise gain additional access and privileges to + // cloud resources and workloads. Examples include publicly accessible + // unprotected user data, public SSH access with weak or no passwords, etc. + // + // Threat: + // Indicates a threat that is able to access, modify, or delete data or + // execute unauthorized code within existing resources. + CRITICAL = 1; + + // Vulnerability: + // A high risk vulnerability can be easily discovered and exploited in + // combination with other vulnerabilities in order to gain direct access and + // the ability to execute arbitrary code, exfiltrate data, and otherwise + // gain additional access and privileges to cloud resources and workloads. + // An example is a database with weak or no passwords that is only + // accessible internally. This database could easily be compromised by an + // actor that had access to the internal network. + // + // Threat: + // Indicates a threat that is able to create new computational resources in + // an environment but not able to access data or execute code in existing + // resources. + HIGH = 2; + + // Vulnerability: + // A medium risk vulnerability could be used by an actor to gain access to + // resources or privileges that enable them to eventually (through multiple + // steps or a complex exploit) gain access and the ability to execute + // arbitrary code or exfiltrate data. An example is a service account with + // access to more projects than it should have. If an actor gains access to + // the service account, they could potentially use that access to manipulate + // a project the service account was not intended to. + // + // Threat: + // Indicates a threat that is able to cause operational impact but may not + // access data or execute unauthorized code. + MEDIUM = 3; + + // Vulnerability: + // A low risk vulnerability hampers a security organization’s ability to + // detect vulnerabilities or active threats in their deployment, or prevents + // the root cause investigation of security issues. An example is monitoring + // and logs being disabled for resource configurations and access. + // + // Threat: + // Indicates a threat that has obtained minimal access to an environment but + // is not able to access data, execute code, or create resources. + LOW = 4; + } + + // Represents what kind of Finding it is. + enum FindingClass { + // Unspecified finding class. + FINDING_CLASS_UNSPECIFIED = 0; + + // Describes unwanted or malicious activity. + THREAT = 1; + + // Describes a potential weakness in software that increases risk to + // Confidentiality & Integrity & Availability. + VULNERABILITY = 2; + + // Describes a potential weakness in cloud resource/asset configuration that + // increases risk. + MISCONFIGURATION = 3; + + // Describes a security observation that is for informational purposes. + OBSERVATION = 4; + } + + // The relative resource name of this finding. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}" + string name = 1; + + // The relative resource name of the source the finding belongs to. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // This field is immutable after creation time. + // For example: + // "organizations/{organization_id}/sources/{source_id}" + string parent = 2; + + // For findings on Google Cloud resources, the full resource + // name of the Google Cloud resource this finding is for. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + // When the finding is for a non-Google Cloud resource, the resourceName can + // be a customer or partner defined string. This field is immutable after + // creation time. + string resource_name = 3; + + // The state of the finding. + State state = 4; + + // The additional taxonomy group within findings from a given source. + // This field is immutable after creation time. + // Example: "XSS_FLASH_INJECTION" + string category = 5; + + // The URI that, if available, points to a web page outside of Security + // Command Center where additional information about the finding can be found. + // This field is guaranteed to be either empty or a well formed URL. + string external_uri = 6; + + // Source specific properties. These properties are managed by the source + // that writes the finding. The key names in the source_properties map must be + // between 1 and 255 characters, and must start with a letter and contain + // alphanumeric characters or underscores only. + map source_properties = 7; + + // Output only. User specified security marks. These marks are entirely + // managed by the user and come from the SecurityMarks resource that belongs + // to the finding. + SecurityMarks security_marks = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The time at which the event took place, or when an update to the finding + // occurred. For example, if the finding represents an open firewall it would + // capture the time the detector believes the firewall became open. The + // accuracy is determined by the detector. If the finding were to be resolved + // afterward, this time would reflect when the finding was resolved. Must not + // be set to a value greater than the current timestamp. + google.protobuf.Timestamp event_time = 9; + + // The time at which the finding was created in Security Command Center. + google.protobuf.Timestamp create_time = 10; + + // The severity of the finding. This field is managed by the source that + // writes the finding. + Severity severity = 12; + + // The canonical name of the finding. It's either + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", + // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}" or + // "projects/{project_number}/sources/{source_id}/findings/{finding_id}", + // depending on the closest CRM ancestor of the resource associated with the + // finding. + string canonical_name = 14; + + // The class of the finding. + FindingClass finding_class = 17; + + // Represents what's commonly known as an Indicator of compromise (IoC) in + // computer forensics. This is an artifact observed on a network or in an + // operating system that, with high confidence, indicates a computer + // intrusion. + // Reference: https://en.wikipedia.org/wiki/Indicator_of_compromise + Indicator indicator = 18; + + // Represents vulnerability specific fields like cve, cvss scores etc. + // CVE stands for Common Vulnerabilities and Exposures + // (https://cve.mitre.org/about/) + Vulnerability vulnerability = 20; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/folder.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/folder.proto new file mode 100644 index 00000000..49c114d4 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/folder.proto @@ -0,0 +1,38 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_outer_classname = "FolderProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Message that contains the resource name and display name of a folder +// resource. +message Folder { + // Full resource name of this folder. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_folder = 1; + + // The user defined display name for this folder. + string resource_folder_display_name = 2; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/indicator.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/indicator.proto new file mode 100644 index 00000000..f785156f --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/indicator.proto @@ -0,0 +1,40 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_outer_classname = "IndicatorProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + + +// Represents what's commonly known as an Indicator of compromise (IoC) in +// computer forensics. This is an artifact observed on a network or in an +// operating system that, with high confidence, indicates a computer intrusion. +// Reference: https://en.wikipedia.org/wiki/Indicator_of_compromise +message Indicator { + // List of ip addresses associated to the Finding. + repeated string ip_addresses = 1; + + // List of domains associated to the Finding. + repeated string domains = 2; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_config.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_config.proto new file mode 100644 index 00000000..7f670279 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_config.proto @@ -0,0 +1,96 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_outer_classname = "NotificationConfigProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; + +// Cloud Security Command Center (Cloud SCC) notification configs. +// +// A notification config is a Cloud SCC resource that contains the configuration +// to send notifications for create/update events of findings, assets and etc. +message NotificationConfig { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/NotificationConfig" + pattern: "organizations/{organization}/notificationConfigs/{notification_config}" + }; + + // The config for streaming-based notifications, which send each event as soon + // as it is detected. + message StreamingConfig { + // Expression that defines the filter to apply across create/update events + // of assets or findings as specified by the event type. The expression is a + // list of zero or more restrictions combined via logical operators `AND` + // and `OR`. Parentheses are supported, and `OR` has higher precedence than + // `AND`. + // + // Restrictions have the form ` ` and may have a + // `-` character in front of them to indicate negation. The fields map to + // those defined in the corresponding resource. + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + string filter = 1; + } + + // The relative resource name of this notification config. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/notificationConfigs/notify_public_bucket". + string name = 1; + + // The description of the notification config (max of 1024 characters). + string description = 2; + + // The Pub/Sub topic to send notifications to. Its format is + // "projects/[project_id]/topics/[topic]". + string pubsub_topic = 3 [(google.api.resource_reference) = { + type: "pubsub.googleapis.com/Topic" + }]; + + // Output only. The service account that needs "pubsub.topics.publish" + // permission to publish to the Pub/Sub topic. + string service_account = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The config for triggering notifications. + oneof notify_config { + // The config for triggering streaming-based notifications. + StreamingConfig streaming_config = 5; + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_message.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_message.proto new file mode 100644 index 00000000..6a9ce085 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_message.proto @@ -0,0 +1,45 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/cloud/securitycenter/v1/finding.proto"; +import "google/cloud/securitycenter/v1/resource.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_outer_classname = "NotificationMessageProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Cloud SCC's Notification +message NotificationMessage { + // Name of the notification config that generated current notification. + string notification_config_name = 1; + + // Notification Event. + oneof event { + // If it's a Finding based notification config, this field will be + // populated. + Finding finding = 2; + } + + // The Cloud resource tied to this notification's Finding. + Resource resource = 3; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto new file mode 100644 index 00000000..1dc77257 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto @@ -0,0 +1,86 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// User specified settings that are attached to the Security Command +// Center organization. +message OrganizationSettings { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/OrganizationSettings" + pattern: "organizations/{organization}/organizationSettings" + }; + + // The configuration used for Asset Discovery runs. + message AssetDiscoveryConfig { + // The mode of inclusion when running Asset Discovery. + // Asset discovery can be limited by explicitly identifying projects to be + // included or excluded. If INCLUDE_ONLY is set, then only those projects + // within the organization and their children are discovered during asset + // discovery. If EXCLUDE is set, then projects that don't match those + // projects are discovered during asset discovery. If neither are set, then + // all projects within the organization are discovered during asset + // discovery. + enum InclusionMode { + // Unspecified. Setting the mode with this value will disable + // inclusion/exclusion filtering for Asset Discovery. + INCLUSION_MODE_UNSPECIFIED = 0; + + // Asset Discovery will capture only the resources within the projects + // specified. All other resources will be ignored. + INCLUDE_ONLY = 1; + + // Asset Discovery will ignore all resources under the projects specified. + // All other resources will be retrieved. + EXCLUDE = 2; + } + + // The project ids to use for filtering asset discovery. + repeated string project_ids = 1; + + // The mode to use for filtering asset discovery. + InclusionMode inclusion_mode = 2; + + // The folder ids to use for filtering asset discovery. + // It consists of only digits, e.g., 756619654966. + repeated string folder_ids = 3; + } + + // The relative resource name of the settings. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/organizationSettings". + string name = 1; + + // A flag that indicates if Asset Discovery should be enabled. If the flag is + // set to `true`, then discovery of assets will occur. If it is set to `false, + // all historical assets will remain, but discovery of future assets will not + // occur. + bool enable_asset_discovery = 2; + + // The configuration used for Asset Discovery runs. + AssetDiscoveryConfig asset_discovery_config = 3; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/resource.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/resource.proto new file mode 100644 index 00000000..8377329e --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/resource.proto @@ -0,0 +1,59 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/field_behavior.proto"; +import "google/cloud/securitycenter/v1/folder.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_outer_classname = "ResourceProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Information related to the Google Cloud resource. +message Resource { + // The full resource name of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string name = 1; + + // The full resource name of project that the resource belongs to. + string project = 2; + + // The human readable name of project that the resource belongs to. + string project_display_name = 3; + + // The full resource name of resource's parent. + string parent = 4; + + // The human readable name of resource's parent. + string parent_display_name = 5; + + // The full resource type of the resource. + string type = 6; + + // Output only. Contains a Folder message for each folder in the assets ancestry. + // The first folder is the deepest nested folder, and the last folder is the + // folder directly under the Organization. + repeated Folder folders = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The human readable name of the resource. + string display_name = 8; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto new file mode 100644 index 00000000..20d084ca --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/protobuf/duration.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Response of asset discovery run +message RunAssetDiscoveryResponse { + // The state of an asset discovery run. + enum State { + // Asset discovery run state was unspecified. + STATE_UNSPECIFIED = 0; + + // Asset discovery run completed successfully. + COMPLETED = 1; + + // Asset discovery run was cancelled with tasks still pending, as another + // run for the same organization was started with a higher priority. + SUPERSEDED = 2; + + // Asset discovery run was killed and terminated. + TERMINATED = 3; + } + + // The state of an asset discovery run. + State state = 1; + + // The duration between asset discovery run start and end + google.protobuf.Duration duration = 2; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/security_marks.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/security_marks.proto new file mode 100644 index 00000000..f055cd5e --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/security_marks.proto @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// User specified security marks that are attached to the parent Security +// Command Center resource. Security marks are scoped within a Security Command +// Center organization -- they can be modified and viewed by all users who have +// proper permissions on the organization. +message SecurityMarks { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/SecurityMarks" + pattern: "organizations/{organization}/assets/{asset}/securityMarks" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}/securityMarks" + pattern: "folders/{folder}/assets/{asset}/securityMarks" + pattern: "projects/{project}/assets/{asset}/securityMarks" + pattern: "folders/{folder}/sources/{source}/findings/{finding}/securityMarks" + pattern: "projects/{project}/sources/{source}/findings/{finding}/securityMarks" + }; + + // The relative resource name of the SecurityMarks. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Examples: + // "organizations/{organization_id}/assets/{asset_id}/securityMarks" + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks". + string name = 1; + + // Mutable user specified security marks belonging to the parent resource. + // Constraints are as follows: + // + // * Keys and values are treated as case insensitive + // * Keys must be between 1 - 256 characters (inclusive) + // * Keys must be letters, numbers, underscores, or dashes + // * Values have leading and trailing whitespace trimmed, remaining + // characters must be between 1 - 4096 characters (inclusive) + map marks = 2; + + // The canonical name of the marks. + // Examples: + // "organizations/{organization_id}/assets/{asset_id}/securityMarks" + // "folders/{folder_id}/assets/{asset_id}/securityMarks" + // "projects/{project_number}/assets/{asset_id}/securityMarks" + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks" + // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}/securityMarks" + // "projects/{project_number}/sources/{source_id}/findings/{finding_id}/securityMarks" + string canonical_name = 3; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto new file mode 100644 index 00000000..89f89a0c --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto @@ -0,0 +1,1374 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import public "google/cloud/securitycenter/v1/run_asset_discovery_response.proto"; +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1/asset.proto"; +import "google/cloud/securitycenter/v1/finding.proto"; +import "google/cloud/securitycenter/v1/folder.proto"; +import "google/cloud/securitycenter/v1/notification_config.proto"; +import "google/cloud/securitycenter/v1/organization_settings.proto"; +import "google/cloud/securitycenter/v1/security_marks.proto"; +import "google/cloud/securitycenter/v1/source.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// V1 APIs for Security Center service. +service SecurityCenter { + option (google.api.default_host) = "securitycenter.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a source. + rpc CreateSource(CreateSourceRequest) returns (Source) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/sources" + body: "source" + }; + option (google.api.method_signature) = "parent,source"; + } + + // Creates a finding. The corresponding source must exist for finding creation + // to succeed. + rpc CreateFinding(CreateFindingRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*/sources/*}/findings" + body: "finding" + }; + option (google.api.method_signature) = "parent,finding_id,finding"; + } + + // Creates a notification config. + rpc CreateNotificationConfig(CreateNotificationConfigRequest) returns (NotificationConfig) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/notificationConfigs" + body: "notification_config" + }; + option (google.api.method_signature) = "parent,config_id,notification_config"; + option (google.api.method_signature) = "parent,notification_config"; + } + + // Deletes a notification config. + rpc DeleteNotificationConfig(DeleteNotificationConfigRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=organizations/*/notificationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets the access control policy on the specified Source. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=organizations/*/sources/*}:getIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource"; + } + + // Gets a notification config. + rpc GetNotificationConfig(GetNotificationConfigRequest) returns (NotificationConfig) { + option (google.api.http) = { + get: "/v1/{name=organizations/*/notificationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets the settings for an organization. + rpc GetOrganizationSettings(GetOrganizationSettingsRequest) returns (OrganizationSettings) { + option (google.api.http) = { + get: "/v1/{name=organizations/*/organizationSettings}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a source. + rpc GetSource(GetSourceRequest) returns (Source) { + option (google.api.http) = { + get: "/v1/{name=organizations/*/sources/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Filters an organization's assets and groups them by their specified + // properties. + rpc GroupAssets(GroupAssetsRequest) returns (GroupAssetsResponse) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/assets:group" + body: "*" + additional_bindings { + post: "/v1/{parent=folders/*}/assets:group" + body: "*" + } + additional_bindings { + post: "/v1/{parent=projects/*}/assets:group" + body: "*" + } + }; + } + + // Filters an organization or source's findings and groups them by their + // specified properties. + // + // To group across all sources provide a `-` as the source id. + // Example: /v1/organizations/{organization_id}/sources/-/findings, + // /v1/folders/{folder_id}/sources/-/findings, + // /v1/projects/{project_id}/sources/-/findings + rpc GroupFindings(GroupFindingsRequest) returns (GroupFindingsResponse) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*/sources/*}/findings:group" + body: "*" + additional_bindings { + post: "/v1/{parent=folders/*/sources/*}/findings:group" + body: "*" + } + additional_bindings { + post: "/v1/{parent=projects/*/sources/*}/findings:group" + body: "*" + } + }; + option (google.api.method_signature) = "parent,group_by"; + } + + // Lists an organization's assets. + rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*}/assets" + additional_bindings { + get: "/v1/{parent=folders/*}/assets" + } + additional_bindings { + get: "/v1/{parent=projects/*}/assets" + } + }; + } + + // Lists an organization or source's findings. + // + // To list across all sources provide a `-` as the source id. + // Example: /v1/organizations/{organization_id}/sources/-/findings + rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*/sources/*}/findings" + additional_bindings { + get: "/v1/{parent=folders/*/sources/*}/findings" + } + additional_bindings { + get: "/v1/{parent=projects/*/sources/*}/findings" + } + }; + } + + // Lists notification configs. + rpc ListNotificationConfigs(ListNotificationConfigsRequest) returns (ListNotificationConfigsResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*}/notificationConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists all sources belonging to an organization. + rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*}/sources" + additional_bindings { + get: "/v1/{parent=folders/*}/sources" + } + additional_bindings { + get: "/v1/{parent=projects/*}/sources" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Runs asset discovery. The discovery is tracked with a long-running + // operation. + // + // This API can only be called with limited frequency for an organization. If + // it is called too frequently the caller will receive a TOO_MANY_REQUESTS + // error. + rpc RunAssetDiscovery(RunAssetDiscoveryRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/assets:runDiscovery" + body: "*" + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.securitycenter.v1.RunAssetDiscoveryResponse" + metadata_type: "google.protobuf.Empty" + }; + } + + // Updates the state of a finding. + rpc SetFindingState(SetFindingStateRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1/{name=organizations/*/sources/*/findings/*}:setState" + body: "*" + additional_bindings { + post: "/v1/{name=folders/*/sources/*/findings/*}:setState" + body: "*" + } + additional_bindings { + post: "/v1/{name=projects/*/sources/*/findings/*}:setState" + body: "*" + } + }; + option (google.api.method_signature) = "name,state,start_time"; + } + + // Sets the access control policy on the specified Source. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=organizations/*/sources/*}:setIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Returns the permissions that a caller has on the specified source. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=organizations/*/sources/*}:testIamPermissions" + body: "*" + }; + option (google.api.method_signature) = "resource,permissions"; + } + + // Creates or updates a finding. The corresponding source must exist for a + // finding creation to succeed. + rpc UpdateFinding(UpdateFindingRequest) returns (Finding) { + option (google.api.http) = { + patch: "/v1/{finding.name=organizations/*/sources/*/findings/*}" + body: "finding" + additional_bindings { + patch: "/v1/{finding.name=folders/*/sources/*/findings/*}" + body: "finding" + } + additional_bindings { + patch: "/v1/{finding.name=projects/*/sources/*/findings/*}" + body: "finding" + } + }; + option (google.api.method_signature) = "finding"; + } + + // + // Updates a notification config. The following update + // fields are allowed: description, pubsub_topic, streaming_config.filter + rpc UpdateNotificationConfig(UpdateNotificationConfigRequest) returns (NotificationConfig) { + option (google.api.http) = { + patch: "/v1/{notification_config.name=organizations/*/notificationConfigs/*}" + body: "notification_config" + }; + option (google.api.method_signature) = "notification_config"; + option (google.api.method_signature) = "notification_config,update_mask"; + } + + // Updates an organization's settings. + rpc UpdateOrganizationSettings(UpdateOrganizationSettingsRequest) returns (OrganizationSettings) { + option (google.api.http) = { + patch: "/v1/{organization_settings.name=organizations/*/organizationSettings}" + body: "organization_settings" + }; + option (google.api.method_signature) = "organization_settings"; + } + + // Updates a source. + rpc UpdateSource(UpdateSourceRequest) returns (Source) { + option (google.api.http) = { + patch: "/v1/{source.name=organizations/*/sources/*}" + body: "source" + }; + option (google.api.method_signature) = "source"; + } + + // Updates security marks. + rpc UpdateSecurityMarks(UpdateSecurityMarksRequest) returns (SecurityMarks) { + option (google.api.http) = { + patch: "/v1/{security_marks.name=organizations/*/assets/*/securityMarks}" + body: "security_marks" + additional_bindings { + patch: "/v1/{security_marks.name=folders/*/assets/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1/{security_marks.name=projects/*/assets/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1/{security_marks.name=folders/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1/{security_marks.name=projects/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + }; + option (google.api.method_signature) = "security_marks"; + } +} + +// Request message for creating a finding. +message CreateFindingRequest { + // Required. Resource name of the new finding's parent. Its format should be + // "organizations/[organization_id]/sources/[source_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Required. Unique identifier provided by the client within the parent scope. + // It must be alphanumeric and less than or equal to 32 characters and + // greater than 0 characters in length. + string finding_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Finding being created. The name and security_marks will be ignored as + // they are both output only fields on this resource. + Finding finding = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for creating a notification config. +message CreateNotificationConfigRequest { + // Required. Resource name of the new notification config's parent. Its format is + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Required. + // Unique identifier provided by the client within the parent scope. + // It must be between 1 and 128 characters, and contains alphanumeric + // characters, underscores or hyphens only. + string config_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The notification config being created. The name and the service account + // will be ignored as they are both output only fields on this resource. + NotificationConfig notification_config = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for creating a source. +message CreateSourceRequest { + // Required. Resource name of the new source's parent. Its format should be + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Required. The Source being created, only the display_name and description will be + // used. All other fields will be ignored. + Source source = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for deleting a notification config. +message DeleteNotificationConfigRequest { + // Required. Name of the notification config to delete. Its format is + // "organizations/[organization_id]/notificationConfigs/[config_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/NotificationConfig" + } + ]; +} + +// Request message for getting a notification config. +message GetNotificationConfigRequest { + // Required. Name of the notification config to get. Its format is + // "organizations/[organization_id]/notificationConfigs/[config_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/NotificationConfig" + } + ]; +} + +// Request message for getting organization settings. +message GetOrganizationSettingsRequest { + // Required. Name of the organization to get organization settings for. Its format is + // "organizations/[organization_id]/organizationSettings". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/OrganizationSettings" + } + ]; +} + +// Request message for getting a source. +message GetSourceRequest { + // Required. Relative resource name of the source. Its format is + // "organizations/[organization_id]/source/[source_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; +} + +// Request message for grouping by assets. +message GroupAssetsRequest { + // Required. Name of the organization to groupBy. Its format is + // "organizations/[organization_id], folders/[folder_id], or + // projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/Asset" + } + ]; + + // Expression that defines the filter to apply across assets. + // The expression is a list of zero or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. The fields map to those + // defined in the Asset resource. Examples include: + // + // * name + // * security_center_properties.resource_name + // * resource_properties.a_property + // * security_marks.marks.marka + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + // + // The following field and operator combinations are supported: + // + // * name: `=` + // * update_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `update_time = "2019-06-10T16:07:18-07:00"` + // `update_time = 1560208038000` + // + // * create_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `create_time = "2019-06-10T16:07:18-07:00"` + // `create_time = 1560208038000` + // + // * iam_policy.policy_blob: `=`, `:` + // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // * security_marks.marks: `=`, `:` + // * security_center_properties.resource_name: `=`, `:` + // * security_center_properties.resource_display_name: `=`, `:` + // * security_center_properties.resource_type: `=`, `:` + // * security_center_properties.resource_parent: `=`, `:` + // * security_center_properties.resource_parent_display_name: `=`, `:` + // * security_center_properties.resource_project: `=`, `:` + // * security_center_properties.resource_project_display_name: `=`, `:` + // * security_center_properties.resource_owners: `=`, `:` + // + // For example, `resource_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `resource_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-resource_properties.my_property : ""` + string filter = 2; + + // Required. Expression that defines what assets fields to use for grouping. The string + // value should follow SQL syntax: comma separated list of fields. For + // example: + // "security_center_properties.resource_project,security_center_properties.project". + // + // The following fields are supported when compare_duration is not set: + // + // * security_center_properties.resource_project + // * security_center_properties.resource_project_display_name + // * security_center_properties.resource_type + // * security_center_properties.resource_parent + // * security_center_properties.resource_parent_display_name + // + // The following fields are supported when compare_duration is set: + // + // * security_center_properties.resource_type + // * security_center_properties.resource_project_display_name + // * security_center_properties.resource_parent_display_name + string group_by = 3 [(google.api.field_behavior) = REQUIRED]; + + // When compare_duration is set, the GroupResult's "state_change" property is + // updated to indicate whether the asset was added, removed, or remained + // present during the compare_duration period of time that precedes the + // read_time. This is the time between (read_time - compare_duration) and + // read_time. + // + // The state change value is derived based on the presence of the asset at the + // two points in time. Intermediate state changes between the two times don't + // affect the result. For example, the results aren't affected if the asset is + // removed and re-created again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "ADDED": indicates that the asset was not present at the start of + // compare_duration, but present at reference_time. + // * "REMOVED": indicates that the asset was present at the start of + // compare_duration, but not present at reference_time. + // * "ACTIVE": indicates that the asset was present at both the + // start and the end of the time period defined by + // compare_duration and reference_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all assets present at + // read_time. + // + // If this field is set then `state_change` must be a specified field in + // `group_by`. + google.protobuf.Duration compare_duration = 4; + + // Time used as a reference point when filtering assets. The filter is limited + // to assets existing at the supplied time and their values are those at that + // specific time. Absence of this field will default to the API's version of + // NOW. + google.protobuf.Timestamp read_time = 5; + + // The value returned by the last `GroupAssetsResponse`; indicates + // that this is a continuation of a prior `GroupAssets` call, and that the + // system should return the next page of data. + string page_token = 7; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 8; +} + +// Response message for grouping by assets. +message GroupAssetsResponse { + // Group results. There exists an element for each existing unique + // combination of property/values. The element contains a count for the number + // of times those specific property/values appear. + repeated GroupResult group_by_results = 1; + + // Time used for executing the groupBy request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of results matching the query. + int32 total_size = 4; +} + +// Request message for grouping by findings. +message GroupFindingsRequest { + // Required. Name of the source to groupBy. Its format is + // "organizations/[organization_id]/sources/[source_id]", + // folders/[folder_id]/sources/[source_id], or + // projects/[project_id]/sources/[source_id]. To groupBy across all sources + // provide a source_id of `-`. For example: + // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + // or projects/{project_id}/sources/- + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Expression that defines the filter to apply across findings. + // The expression is a list of one or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. Examples include: + // + // * name + // * source_properties.a_property + // * security_marks.marks.marka + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + // + // The following field and operator combinations are supported: + // + // * name: `=` + // * parent: `=`, `:` + // * resource_name: `=`, `:` + // * state: `=`, `:` + // * category: `=`, `:` + // * external_uri: `=`, `:` + // * event_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `event_time = "2019-06-10T16:07:18-07:00"` + // `event_time = 1560208038000` + // + // * severity: `=`, `:` + // * workflow_state: `=`, `:` + // * security_marks.marks: `=`, `:` + // * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // + // For example, `source_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `source_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-source_properties.my_property : ""` + // + // * resource: + // * resource.name: `=`, `:` + // * resource.parent_name: `=`, `:` + // * resource.parent_display_name: `=`, `:` + // * resource.project_name: `=`, `:` + // * resource.project_display_name: `=`, `:` + // * resource.type: `=`, `:` + string filter = 2; + + // Required. Expression that defines what assets fields to use for grouping (including + // `state_change`). The string value should follow SQL syntax: comma separated + // list of fields. For example: "parent,resource_name". + // + // The following fields are supported: + // + // * resource_name + // * category + // * state + // * parent + // * severity + // + // The following fields are supported when compare_duration is set: + // + // * state_change + string group_by = 3 [(google.api.field_behavior) = REQUIRED]; + + // Time used as a reference point when filtering findings. The filter is + // limited to findings existing at the supplied time and their values are + // those at that specific time. Absence of this field will default to the + // API's version of NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the GroupResult's "state_change" attribute is + // updated to indicate whether the finding had its state changed, the + // finding's state remained unchanged, or if the finding was added during the + // compare_duration period of time that precedes the read_time. This is the + // time between (read_time - compare_duration) and read_time. + // + // The state_change value is derived based on the presence and state of the + // finding at the two points in time. Intermediate state changes between the + // two times don't affect the result. For example, the results aren't affected + // if the finding is made inactive and then active again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "CHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration, but changed its + // state at read_time. + // * "UNCHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration and did not change + // state at read_time. + // * "ADDED": indicates that the finding did not match the given filter or + // was not present at the start of compare_duration, but was + // present at read_time. + // * "REMOVED": indicates that the finding was present and matched the + // filter at the start of compare_duration, but did not match + // the filter at read_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all findings present + // at read_time. + // + // If this field is set then `state_change` must be a specified field in + // `group_by`. + google.protobuf.Duration compare_duration = 5; + + // The value returned by the last `GroupFindingsResponse`; indicates + // that this is a continuation of a prior `GroupFindings` call, and + // that the system should return the next page of data. + string page_token = 7; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 8; +} + +// Response message for group by findings. +message GroupFindingsResponse { + // Group results. There exists an element for each existing unique + // combination of property/values. The element contains a count for the number + // of times those specific property/values appear. + repeated GroupResult group_by_results = 1; + + // Time used for executing the groupBy request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of results matching the query. + int32 total_size = 4; +} + +// Result containing the properties and count of a groupBy request. +message GroupResult { + // Properties matching the groupBy fields in the request. + map properties = 1; + + // Total count of resources for the given properties. + int64 count = 2; +} + +// Request message for listing notification configs. +message ListNotificationConfigsRequest { + // Required. Name of the organization to list notification configs. + // Its format is "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // The value returned by the last `ListNotificationConfigsResponse`; indicates + // that this is a continuation of a prior `ListNotificationConfigs` call, and + // that the system should return the next page of data. + string page_token = 2; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 3; +} + +// Response message for listing notification configs. +message ListNotificationConfigsResponse { + // Notification configs belonging to the requested parent. + repeated NotificationConfig notification_configs = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 2; +} + +// Request message for listing sources. +message ListSourcesRequest { + // Required. Resource name of the parent of sources to list. Its format should be + // "organizations/[organization_id], folders/[folder_id], or + // projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/Source" + } + ]; + + // The value returned by the last `ListSourcesResponse`; indicates + // that this is a continuation of a prior `ListSources` call, and + // that the system should return the next page of data. + string page_token = 2; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 7; +} + +// Response message for listing sources. +message ListSourcesResponse { + // Sources belonging to the requested parent. + repeated Source sources = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 2; +} + +// Request message for listing assets. +message ListAssetsRequest { + // Required. Name of the organization assets should belong to. Its format is + // "organizations/[organization_id], folders/[folder_id], or + // projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/Asset" + } + ]; + + // Expression that defines the filter to apply across assets. + // The expression is a list of zero or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. The fields map to those + // defined in the Asset resource. Examples include: + // + // * name + // * security_center_properties.resource_name + // * resource_properties.a_property + // * security_marks.marks.marka + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + // + // The following are the allowed field and operator combinations: + // + // * name: `=` + // * update_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `update_time = "2019-06-10T16:07:18-07:00"` + // `update_time = 1560208038000` + // + // * create_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `create_time = "2019-06-10T16:07:18-07:00"` + // `create_time = 1560208038000` + // + // * iam_policy.policy_blob: `=`, `:` + // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // * security_marks.marks: `=`, `:` + // * security_center_properties.resource_name: `=`, `:` + // * security_center_properties.resource_display_name: `=`, `:` + // * security_center_properties.resource_type: `=`, `:` + // * security_center_properties.resource_parent: `=`, `:` + // * security_center_properties.resource_parent_display_name: `=`, `:` + // * security_center_properties.resource_project: `=`, `:` + // * security_center_properties.resource_project_display_name: `=`, `:` + // * security_center_properties.resource_owners: `=`, `:` + // + // For example, `resource_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `resource_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-resource_properties.my_property : ""` + string filter = 2; + + // Expression that defines what fields and order to use for sorting. The + // string value should follow SQL syntax: comma separated list of fields. For + // example: "name,resource_properties.a_property". The default sorting order + // is ascending. To specify descending order for a field, a suffix " desc" + // should be appended to the field name. For example: "name + // desc,resource_properties.a_property". Redundant space characters in the + // syntax are insignificant. "name desc,resource_properties.a_property" and " + // name desc , resource_properties.a_property " are equivalent. + // + // The following fields are supported: + // name + // update_time + // resource_properties + // security_marks.marks + // security_center_properties.resource_name + // security_center_properties.resource_display_name + // security_center_properties.resource_parent + // security_center_properties.resource_parent_display_name + // security_center_properties.resource_project + // security_center_properties.resource_project_display_name + // security_center_properties.resource_type + string order_by = 3; + + // Time used as a reference point when filtering assets. The filter is limited + // to assets existing at the supplied time and their values are those at that + // specific time. Absence of this field will default to the API's version of + // NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the ListAssetsResult's "state_change" + // attribute is updated to indicate whether the asset was added, removed, or + // remained present during the compare_duration period of time that precedes + // the read_time. This is the time between (read_time - compare_duration) and + // read_time. + // + // The state_change value is derived based on the presence of the asset at the + // two points in time. Intermediate state changes between the two times don't + // affect the result. For example, the results aren't affected if the asset is + // removed and re-created again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "ADDED": indicates that the asset was not present at the start of + // compare_duration, but present at read_time. + // * "REMOVED": indicates that the asset was present at the start of + // compare_duration, but not present at read_time. + // * "ACTIVE": indicates that the asset was present at both the + // start and the end of the time period defined by + // compare_duration and read_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all assets present at + // read_time. + google.protobuf.Duration compare_duration = 5; + + // A field mask to specify the ListAssetsResult fields to be listed in the + // response. + // An empty field mask will list all fields. + google.protobuf.FieldMask field_mask = 7; + + // The value returned by the last `ListAssetsResponse`; indicates + // that this is a continuation of a prior `ListAssets` call, and + // that the system should return the next page of data. + string page_token = 8; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 9; +} + +// Response message for listing assets. +message ListAssetsResponse { + // Result containing the Asset and its State. + message ListAssetsResult { + // The change in state of the asset. + // + // When querying across two points in time this describes + // the change between the two points: ADDED, REMOVED, or ACTIVE. + // If there was no compare_duration supplied in the request the state change + // will be: UNUSED + enum StateChange { + // State change is unused, this is the canonical default for this enum. + UNUSED = 0; + + // Asset was added between the points in time. + ADDED = 1; + + // Asset was removed between the points in time. + REMOVED = 2; + + // Asset was present at both point(s) in time. + ACTIVE = 3; + } + + // Asset matching the search request. + Asset asset = 1; + + // State change of the asset between the points in time. + StateChange state_change = 2; + } + + // Assets matching the list request. + repeated ListAssetsResult list_assets_results = 1; + + // Time used for executing the list request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of assets matching the query. + int32 total_size = 4; +} + +// Request message for listing findings. +message ListFindingsRequest { + // Required. Name of the source the findings belong to. Its format is + // "organizations/[organization_id]/sources/[source_id], + // folders/[folder_id]/sources/[source_id], or + // projects/[project_id]/sources/[source_id]". To list across all sources + // provide a source_id of `-`. For example: + // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + // projects/{projects_id}/sources/- + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Expression that defines the filter to apply across findings. + // The expression is a list of one or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. Examples include: + // + // * name + // * source_properties.a_property + // * security_marks.marks.marka + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + // + // The following field and operator combinations are supported: + // + // * name: `=` + // * parent: `=`, `:` + // * resource_name: `=`, `:` + // * state: `=`, `:` + // * category: `=`, `:` + // * external_uri: `=`, `:` + // * event_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `event_time = "2019-06-10T16:07:18-07:00"` + // `event_time = 1560208038000` + // + // * severity: `=`, `:` + // * workflow_state: `=`, `:` + // * security_marks.marks: `=`, `:` + // * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // + // For example, `source_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `source_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-source_properties.my_property : ""` + // + // * resource: + // * resource.name: `=`, `:` + // * resource.parent_name: `=`, `:` + // * resource.parent_display_name: `=`, `:` + // * resource.project_name: `=`, `:` + // * resource.project_display_name: `=`, `:` + // * resource.type: `=`, `:` + // * resource.folders.resource_folder: `=`, `:` + // * resource.display_name: `=`, `:` + string filter = 2; + + // Expression that defines what fields and order to use for sorting. The + // string value should follow SQL syntax: comma separated list of fields. For + // example: "name,resource_properties.a_property". The default sorting order + // is ascending. To specify descending order for a field, a suffix " desc" + // should be appended to the field name. For example: "name + // desc,source_properties.a_property". Redundant space characters in the + // syntax are insignificant. "name desc,source_properties.a_property" and " + // name desc , source_properties.a_property " are equivalent. + // + // The following fields are supported: + // name + // parent + // state + // category + // resource_name + // event_time + // source_properties + // security_marks.marks + string order_by = 3; + + // Time used as a reference point when filtering findings. The filter is + // limited to findings existing at the supplied time and their values are + // those at that specific time. Absence of this field will default to the + // API's version of NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the ListFindingsResult's "state_change" + // attribute is updated to indicate whether the finding had its state changed, + // the finding's state remained unchanged, or if the finding was added in any + // state during the compare_duration period of time that precedes the + // read_time. This is the time between (read_time - compare_duration) and + // read_time. + // + // The state_change value is derived based on the presence and state of the + // finding at the two points in time. Intermediate state changes between the + // two times don't affect the result. For example, the results aren't affected + // if the finding is made inactive and then active again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "CHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration, but changed its + // state at read_time. + // * "UNCHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration and did not change + // state at read_time. + // * "ADDED": indicates that the finding did not match the given filter or + // was not present at the start of compare_duration, but was + // present at read_time. + // * "REMOVED": indicates that the finding was present and matched the + // filter at the start of compare_duration, but did not match + // the filter at read_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all findings present at + // read_time. + google.protobuf.Duration compare_duration = 5; + + // A field mask to specify the Finding fields to be listed in the response. + // An empty field mask will list all fields. + google.protobuf.FieldMask field_mask = 7; + + // The value returned by the last `ListFindingsResponse`; indicates + // that this is a continuation of a prior `ListFindings` call, and + // that the system should return the next page of data. + string page_token = 8; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 9; +} + +// Response message for listing findings. +message ListFindingsResponse { + // Result containing the Finding and its StateChange. + message ListFindingsResult { + // Information related to the Google Cloud resource that is + // associated with this finding. + message Resource { + // The full resource name of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string name = 1; + + // The full resource name of project that the resource belongs to. + string project_name = 2; + + // The human readable name of project that the resource belongs to. + string project_display_name = 3; + + // The full resource name of resource's parent. + string parent_name = 4; + + // The human readable name of resource's parent. + string parent_display_name = 5; + + // The full resource type of the resource. + string type = 6; + + // Contains a Folder message for each folder in the assets ancestry. + // The first folder is the deepest nested folder, and the last folder is + // the folder directly under the Organization. + repeated Folder folders = 7; + + // The human readable name of the resource. + string display_name = 8; + } + + // The change in state of the finding. + // + // When querying across two points in time this describes + // the change in the finding between the two points: CHANGED, UNCHANGED, + // ADDED, or REMOVED. Findings can not be deleted, so REMOVED implies that + // the finding at timestamp does not match the filter specified, but it did + // at timestamp - compare_duration. If there was no compare_duration + // supplied in the request the state change will be: UNUSED + enum StateChange { + // State change is unused, this is the canonical default for this enum. + UNUSED = 0; + + // The finding has changed state in some way between the points in time + // and existed at both points. + CHANGED = 1; + + // The finding has not changed state between the points in time and + // existed at both points. + UNCHANGED = 2; + + // The finding was created between the points in time. + ADDED = 3; + + // The finding at timestamp does not match the filter specified, but it + // did at timestamp - compare_duration. + REMOVED = 4; + } + + // Finding matching the search request. + Finding finding = 1; + + // State change of the finding between the points in time. + StateChange state_change = 2; + + // Output only. Resource that is associated with this finding. + Resource resource = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Findings matching the list request. + repeated ListFindingsResult list_findings_results = 1; + + // Time used for executing the list request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of findings matching the query. + int32 total_size = 4; +} + +// Request message for updating a finding's state. +message SetFindingStateRequest { + // Required. The relative resource name of the finding. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Finding" + } + ]; + + // Required. The desired State of the finding. + Finding.State state = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The time at which the updated state takes effect. + google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for running asset discovery for an organization. +message RunAssetDiscoveryRequest { + // Required. Name of the organization to run asset discovery for. Its format is + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; +} + +// Request message for updating or creating a finding. +message UpdateFindingRequest { + // Required. The finding resource to update or create if it does not already exist. + // parent, security_marks, and update_time will be ignored. + // + // In the case of creation, the finding id portion of the name must be + // alphanumeric and less than or equal to 32 characters and greater than 0 + // characters in length. + Finding finding = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the finding resource. This field should + // not be specified when creating a finding. + // + // When updating a finding, an empty mask is treated as updating all mutable + // fields and replacing source_properties. Individual source_properties can + // be added/updated by using "source_properties." in the field + // mask. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a notification config. +message UpdateNotificationConfigRequest { + // Required. The notification config to update. + NotificationConfig notification_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the notification config. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating an organization's settings. +message UpdateOrganizationSettingsRequest { + // Required. The organization settings resource to update. + OrganizationSettings organization_settings = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the settings resource. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a source. +message UpdateSourceRequest { + // Required. The source resource to update. + Source source = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the source resource. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a SecurityMarks resource. +message UpdateSecurityMarksRequest { + // Required. The security marks resource to update. + SecurityMarks security_marks = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the security marks resource. + // + // The field mask must not contain duplicate fields. + // If empty or set to "marks", all marks will be replaced. Individual + // marks can be updated using "marks.". + google.protobuf.FieldMask update_mask = 2; + + // The time at which the updated SecurityMarks take effect. + // If not set uses current server time. Updates will be applied to the + // SecurityMarks that are active immediately preceding this time. + google.protobuf.Timestamp start_time = 3; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/source.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/source.proto new file mode 100644 index 00000000..0df844dd --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/source.proto @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Security Command Center finding source. A finding source +// is an entity or a mechanism that can produce a finding. A source is like a +// container of findings that come from the same scanner, logger, monitor, and +// other tools. +message Source { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Source" + pattern: "organizations/{organization}/sources/{source}" + pattern: "folders/{folder}/sources/{source}" + pattern: "projects/{project}/sources/{source}" + }; + + // The relative resource name of this source. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}" + string name = 1; + + // The source's display name. + // A source's display name must be unique amongst its siblings, for example, + // two sources with the same parent can't share the same display name. + // The display name must have a length between 1 and 64 characters + // (inclusive). + string display_name = 2; + + // The description of the source (max of 1024 characters). + // Example: + // "Web Security Scanner is a web security scanner for common + // vulnerabilities in App Engine applications. It can automatically + // scan and detect four common vulnerabilities, including cross-site-scripting + // (XSS), Flash injection, mixed content (HTTP in HTTPS), and + // outdated or insecure libraries." + string description = 3; + + // The canonical name of the finding. It's either + // "organizations/{organization_id}/sources/{source_id}", + // "folders/{folder_id}/sources/{source_id}" or + // "projects/{project_number}/sources/{source_id}", + // depending on the closest CRM ancestor of the resource associated with the + // finding. + string canonical_name = 14; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto new file mode 100644 index 00000000..4649adf9 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto @@ -0,0 +1,215 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_outer_classname = "VulnerabilityProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Refers to common vulnerability fields e.g. cve, cvss, cwe etc. +message Vulnerability { + // CVE stands for Common Vulnerabilities and Exposures + // (https://cve.mitre.org/about/) + Cve cve = 1; +} + +// CVE stands for Common Vulnerabilities and Exposures. +// More information: https://cve.mitre.org +message Cve { + // The unique identifier for the vulnerability. e.g. CVE-2021-34527 + string id = 1; + + // Additional information about the CVE. + // e.g. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34527 + repeated Reference references = 2; + + // Describe Common Vulnerability Scoring System specified at + // https://www.first.org/cvss/v3.1/specification-document + Cvssv3 cvssv3 = 3; +} + +// Additional Links +message Reference { + // Source of the reference e.g. NVD + string source = 1; + + // Uri for the mentioned source e.g. + // https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34527. + string uri = 2; +} + +// Common Vulnerability Scoring System version 3. +message Cvssv3 { + // This metric reflects the context by which vulnerability exploitation is + // possible. + enum AttackVector { + // Invalid value. + ATTACK_VECTOR_UNSPECIFIED = 0; + + // The vulnerable component is bound to the network stack and the set of + // possible attackers extends beyond the other options listed below, up to + // and including the entire Internet. + ATTACK_VECTOR_NETWORK = 1; + + // The vulnerable component is bound to the network stack, but the attack is + // limited at the protocol level to a logically adjacent topology. + ATTACK_VECTOR_ADJACENT = 2; + + // The vulnerable component is not bound to the network stack and the + // attacker's path is via read/write/execute capabilities. + ATTACK_VECTOR_LOCAL = 3; + + // The attack requires the attacker to physically touch or manipulate the + // vulnerable component. + ATTACK_VECTOR_PHYSICAL = 4; + } + + // This metric describes the conditions beyond the attacker's control that + // must exist in order to exploit the vulnerability. + enum AttackComplexity { + // Invalid value. + ATTACK_COMPLEXITY_UNSPECIFIED = 0; + + // Specialized access conditions or extenuating circumstances do not exist. + // An attacker can expect repeatable success when attacking the vulnerable + // component. + ATTACK_COMPLEXITY_LOW = 1; + + // A successful attack depends on conditions beyond the attacker's control. + // That is, a successful attack cannot be accomplished at will, but requires + // the attacker to invest in some measurable amount of effort in preparation + // or execution against the vulnerable component before a successful attack + // can be expected. + ATTACK_COMPLEXITY_HIGH = 2; + } + + // This metric describes the level of privileges an attacker must possess + // before successfully exploiting the vulnerability. + enum PrivilegesRequired { + // Invalid value. + PRIVILEGES_REQUIRED_UNSPECIFIED = 0; + + // The attacker is unauthorized prior to attack, and therefore does not + // require any access to settings or files of the vulnerable system to + // carry out an attack. + PRIVILEGES_REQUIRED_NONE = 1; + + // The attacker requires privileges that provide basic user capabilities + // that could normally affect only settings and files owned by a user. + // Alternatively, an attacker with Low privileges has the ability to access + // only non-sensitive resources. + PRIVILEGES_REQUIRED_LOW = 2; + + // The attacker requires privileges that provide significant (e.g., + // administrative) control over the vulnerable component allowing access to + // component-wide settings and files. + PRIVILEGES_REQUIRED_HIGH = 3; + } + + // This metric captures the requirement for a human user, other than the + // attacker, to participate in the successful compromise of the vulnerable + // component. + enum UserInteraction { + // Invalid value. + USER_INTERACTION_UNSPECIFIED = 0; + + // The vulnerable system can be exploited without interaction from any user. + USER_INTERACTION_NONE = 1; + + // Successful exploitation of this vulnerability requires a user to take + // some action before the vulnerability can be exploited. + USER_INTERACTION_REQUIRED = 2; + } + + // The Scope metric captures whether a vulnerability in one vulnerable + // component impacts resources in components beyond its security scope. + enum Scope { + // Invalid value. + SCOPE_UNSPECIFIED = 0; + + // An exploited vulnerability can only affect resources managed by the same + // security authority. + SCOPE_UNCHANGED = 1; + + // An exploited vulnerability can affect resources beyond the security scope + // managed by the security authority of the vulnerable component. + SCOPE_CHANGED = 2; + } + + // The Impact metrics capture the effects of a successfully exploited + // vulnerability on the component that suffers the worst outcome that is most + // directly and predictably associated with the attack. + enum Impact { + // Invalid value. + IMPACT_UNSPECIFIED = 0; + + // High impact. + IMPACT_HIGH = 1; + + // Low impact. + IMPACT_LOW = 2; + + // No impact. + IMPACT_NONE = 3; + } + + // The base score is a function of the base metric scores. + double base_score = 1; + + // Base Metrics + // Represents the intrinsic characteristics of a vulnerability that are + // constant over time and across user environments. + // This metric reflects the context by which vulnerability exploitation is + // possible. + AttackVector attack_vector = 5; + + // This metric describes the conditions beyond the attacker's control that + // must exist in order to exploit the vulnerability. + AttackComplexity attack_complexity = 6; + + // This metric describes the level of privileges an attacker must possess + // before successfully exploiting the vulnerability. + PrivilegesRequired privileges_required = 7; + + // This metric captures the requirement for a human user, other than the + // attacker, to participate in the successful compromise of the vulnerable + // component. + UserInteraction user_interaction = 8; + + // The Scope metric captures whether a vulnerability in one vulnerable + // component impacts resources in components beyond its security scope. + Scope scope = 9; + + // This metric measures the impact to the confidentiality of the information + // resources managed by a software component due to a successfully exploited + // vulnerability. + Impact confidentiality_impact = 10; + + // This metric measures the impact to integrity of a successfully exploited + // vulnerability. + Impact integrity_impact = 11; + + // This metric measures the impact to the availability of the impacted + // component resulting from a successfully exploited vulnerability. + Impact availability_impact = 12; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/security_center.create_finding.js b/owl-bot-staging/v1/samples/generated/v1/security_center.create_finding.js new file mode 100644 index 00000000..746920f6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.create_finding.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, findingId, finding) { + // [START securitycenter_v1_generated_SecurityCenter_CreateFinding_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + */ + // const parent = 'abc123' + /** + * Required. Unique identifier provided by the client within the parent scope. + * It must be alphanumeric and less than or equal to 32 characters and + * greater than 0 characters in length. + */ + // const findingId = 'abc123' + /** + * Required. The Finding being created. The name and security_marks will be ignored as + * they are both output only fields on this resource. + */ + // const finding = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateFinding() { + // Construct request + const request = { + parent, + findingId, + finding, + }; + + // Run request + const response = await securitycenterClient.createFinding(request); + console.log(response); + } + + callCreateFinding(); + // [END securitycenter_v1_generated_SecurityCenter_CreateFinding_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/security_center.create_notification_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.create_notification_config.js new file mode 100644 index 00000000..6394278d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.create_notification_config.js @@ -0,0 +1,68 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, configId, notificationConfig) { + // [START securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new notification config's parent. Its format is + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * Required. + * Unique identifier provided by the client within the parent scope. + * It must be between 1 and 128 characters, and contains alphanumeric + * characters, underscores or hyphens only. + */ + // const configId = 'abc123' + /** + * Required. The notification config being created. The name and the service account + * will be ignored as they are both output only fields on this resource. + */ + // const notificationConfig = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateNotificationConfig() { + // Construct request + const request = { + parent, + configId, + notificationConfig, + }; + + // Run request + const response = await securitycenterClient.createNotificationConfig(request); + console.log(response); + } + + callCreateNotificationConfig(); + // [END securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_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/security_center.create_source.js b/owl-bot-staging/v1/samples/generated/v1/security_center.create_source.js new file mode 100644 index 00000000..a0465fd2 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.create_source.js @@ -0,0 +1,60 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, source) { + // [START securitycenter_v1_generated_SecurityCenter_CreateSource_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * Required. The Source being created, only the display_name and description will be + * used. All other fields will be ignored. + */ + // const source = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateSource() { + // Construct request + const request = { + parent, + source, + }; + + // Run request + const response = await securitycenterClient.createSource(request); + console.log(response); + } + + callCreateSource(); + // [END securitycenter_v1_generated_SecurityCenter_CreateSource_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/security_center.delete_notification_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.delete_notification_config.js new file mode 100644 index 00000000..12b4f019 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.delete_notification_config.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the notification config to delete. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callDeleteNotificationConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.deleteNotificationConfig(request); + console.log(response); + } + + callDeleteNotificationConfig(); + // [END securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_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/security_center.get_iam_policy.js b/owl-bot-staging/v1/samples/generated/v1/security_center.get_iam_policy.js new file mode 100644 index 00000000..e8452cca --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.get_iam_policy.js @@ -0,0 +1,59 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(resource) { + // [START securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + */ + // const options = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await securitycenterClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END securitycenter_v1_generated_SecurityCenter_GetIamPolicy_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/security_center.get_notification_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.get_notification_config.js new file mode 100644 index 00000000..d0eb23ca --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.get_notification_config.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the notification config to get. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetNotificationConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getNotificationConfig(request); + console.log(response); + } + + callGetNotificationConfig(); + // [END securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_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/security_center.get_organization_settings.js b/owl-bot-staging/v1/samples/generated/v1/security_center.get_organization_settings.js new file mode 100644 index 00000000..f408324f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.get_organization_settings.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to get organization settings for. Its format is + * "organizations/[organization_id]/organizationSettings". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetOrganizationSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getOrganizationSettings(request); + console.log(response); + } + + callGetOrganizationSettings(); + // [END securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_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/security_center.get_source.js b/owl-bot-staging/v1/samples/generated/v1/security_center.get_source.js new file mode 100644 index 00000000..fa5796e6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.get_source.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_GetSource_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetSource() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getSource(request); + console.log(response); + } + + callGetSource(); + // [END securitycenter_v1_generated_SecurityCenter_GetSource_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/security_center.group_assets.js b/owl-bot-staging/v1/samples/generated/v1/security_center.group_assets.js new file mode 100644 index 00000000..2b70cea8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.group_assets.js @@ -0,0 +1,168 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, groupBy) { + // [START securitycenter_v1_generated_SecurityCenter_GroupAssets_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * The supported operators are: + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * The supported value types are: + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * The following field and operator combinations are supported: + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * For example, `resource_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + */ + // const filter = 'abc123' + /** + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * The following fields are supported when compare_duration is not set: + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * The following fields are supported when compare_duration is set: + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + */ + // const groupBy = 'abc123' + /** + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * Possible "state_change" values when compare_duration is specified: + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * If this field is set then `state_change` must be a specified field in + * `group_by`. + */ + // const compareDuration = {} + /** + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + */ + // const readTime = {} + /** + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGroupAssets() { + // Construct request + const request = { + parent, + groupBy, + }; + + // Run request + const iterable = await securitycenterClient.groupAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGroupAssets(); + // [END securitycenter_v1_generated_SecurityCenter_GroupAssets_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/security_center.group_findings.js b/owl-bot-staging/v1/samples/generated/v1/security_center.group_findings.js new file mode 100644 index 00000000..faf3c30b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.group_findings.js @@ -0,0 +1,172 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, groupBy) { + // [START securitycenter_v1_generated_SecurityCenter_GroupFindings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * The supported operators are: + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * The supported value types are: + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * The following field and operator combinations are supported: + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + */ + // const filter = 'abc123' + /** + * Required. Expression that defines what assets fields to use for grouping (including + * `state_change`). The string value should follow SQL syntax: comma separated + * list of fields. For example: "parent,resource_name". + * The following fields are supported: + * * resource_name + * * category + * * state + * * parent + * * severity + * The following fields are supported when compare_duration is set: + * * state_change + */ + // const groupBy = 'abc123' + /** + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * Possible "state_change" values when compare_duration is specified: + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * If this field is set then `state_change` must be a specified field in + * `group_by`. + */ + // const compareDuration = {} + /** + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGroupFindings() { + // Construct request + const request = { + parent, + groupBy, + }; + + // Run request + const iterable = await securitycenterClient.groupFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGroupFindings(); + // [END securitycenter_v1_generated_SecurityCenter_GroupFindings_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/security_center.list_assets.js b/owl-bot-staging/v1/samples/generated/v1/security_center.list_assets.js new file mode 100644 index 00000000..9ebf2a98 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.list_assets.js @@ -0,0 +1,177 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListAssets_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * The supported operators are: + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * The supported value types are: + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * The following are the allowed field and operator combinations: + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * For example, `resource_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + */ + // const filter = 'abc123' + /** + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + */ + // const orderBy = 'abc123' + /** + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * Possible "state_change" values when compare_duration is specified: + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + */ + // const compareDuration = {} + /** + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + */ + // const fieldMask = {} + /** + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListAssets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAssets(); + // [END securitycenter_v1_generated_SecurityCenter_ListAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/security_center.list_findings.js b/owl-bot-staging/v1/samples/generated/v1/security_center.list_findings.js new file mode 100644 index 00000000..bf2a9563 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.list_findings.js @@ -0,0 +1,183 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListFindings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * The supported operators are: + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * The supported value types are: + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * The following field and operator combinations are supported: + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * * resource.folders.resource_folder: `=`, `:` + * * resource.display_name: `=`, `:` + */ + // const filter = 'abc123' + /** + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + */ + // const orderBy = 'abc123' + /** + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * Possible "state_change" values when compare_duration is specified: + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + */ + // const compareDuration = {} + /** + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + */ + // const fieldMask = {} + /** + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListFindings() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFindings(); + // [END securitycenter_v1_generated_SecurityCenter_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/security_center.list_notification_configs.js b/owl-bot-staging/v1/samples/generated/v1/security_center.list_notification_configs.js new file mode 100644 index 00000000..11aeada8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.list_notification_configs.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListNotificationConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listNotificationConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNotificationConfigs(); + // [END securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_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/security_center.list_sources.js b/owl-bot-staging/v1/samples/generated/v1/security_center.list_sources.js new file mode 100644 index 00000000..7fc4f557 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.list_sources.js @@ -0,0 +1,68 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListSources_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + */ + // const parent = 'abc123' + /** + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListSources() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listSourcesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSources(); + // [END securitycenter_v1_generated_SecurityCenter_ListSources_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/security_center.run_asset_discovery.js b/owl-bot-staging/v1/samples/generated/v1/security_center.run_asset_discovery.js new file mode 100644 index 00000000..4c1728e4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.run_asset_discovery.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to run asset discovery for. Its format is + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callRunAssetDiscovery() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await securitycenterClient.runAssetDiscovery(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRunAssetDiscovery(); + // [END securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_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/security_center.set_finding_state.js b/owl-bot-staging/v1/samples/generated/v1/security_center.set_finding_state.js new file mode 100644 index 00000000..676cf8a5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.set_finding_state.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name, state, startTime) { + // [START securitycenter_v1_generated_SecurityCenter_SetFindingState_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the finding. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + */ + // const name = 'abc123' + /** + * Required. The desired State of the finding. + */ + // const state = {} + /** + * Required. The time at which the updated state takes effect. + */ + // const startTime = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetFindingState() { + // Construct request + const request = { + name, + state, + startTime, + }; + + // Run request + const response = await securitycenterClient.setFindingState(request); + console.log(response); + } + + callSetFindingState(); + // [END securitycenter_v1_generated_SecurityCenter_SetFindingState_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/security_center.set_iam_policy.js b/owl-bot-staging/v1/samples/generated/v1/security_center.set_iam_policy.js new file mode 100644 index 00000000..91cd2d88 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.set_iam_policy.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(resource, policy) { + // [START securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + */ + // const policy = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await securitycenterClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END securitycenter_v1_generated_SecurityCenter_SetIamPolicy_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/security_center.test_iam_permissions.js b/owl-bot-staging/v1/samples/generated/v1/security_center.test_iam_permissions.js new file mode 100644 index 00000000..b5017155 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.test_iam_permissions.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(resource, permissions) { + // [START securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). + */ + // const permissions = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await securitycenterClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END securitycenter_v1_generated_SecurityCenter_TestIamPermissions_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/security_center.update_finding.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_finding.js new file mode 100644 index 00000000..271872a4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.update_finding.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(finding) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateFinding_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The finding resource to update or create if it does not already exist. + * parent, security_marks, and update_time will be ignored. + * In the case of creation, the finding id portion of the name must be + * alphanumeric and less than or equal to 32 characters and greater than 0 + * characters in length. + */ + // const finding = {} + /** + * The FieldMask to use when updating the finding resource. This field should + * not be specified when creating a finding. + * When updating a finding, an empty mask is treated as updating all mutable + * fields and replacing source_properties. Individual source_properties can + * be added/updated by using "source_properties." in the field + * mask. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateFinding() { + // Construct request + const request = { + finding, + }; + + // Run request + const response = await securitycenterClient.updateFinding(request); + console.log(response); + } + + callUpdateFinding(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateFinding_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/security_center.update_notification_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_notification_config.js new file mode 100644 index 00000000..74af35bc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.update_notification_config.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(notificationConfig) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The notification config to update. + */ + // const notificationConfig = {} + /** + * The FieldMask to use when updating the notification config. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateNotificationConfig() { + // Construct request + const request = { + notificationConfig, + }; + + // Run request + const response = await securitycenterClient.updateNotificationConfig(request); + console.log(response); + } + + callUpdateNotificationConfig(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_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/security_center.update_organization_settings.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_organization_settings.js new file mode 100644 index 00000000..ff5fc3c9 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.update_organization_settings.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(organizationSettings) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The organization settings resource to update. + */ + // const organizationSettings = {} + /** + * The FieldMask to use when updating the settings resource. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateOrganizationSettings() { + // Construct request + const request = { + organizationSettings, + }; + + // Run request + const response = await securitycenterClient.updateOrganizationSettings(request); + console.log(response); + } + + callUpdateOrganizationSettings(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_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/security_center.update_security_marks.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_security_marks.js new file mode 100644 index 00000000..14137cb7 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.update_security_marks.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(securityMarks) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The security marks resource to update. + */ + // const securityMarks = {} + /** + * The FieldMask to use when updating the security marks resource. + * The field mask must not contain duplicate fields. + * If empty or set to "marks", all marks will be replaced. Individual + * marks can be updated using "marks.". + */ + // const updateMask = {} + /** + * The time at which the updated SecurityMarks take effect. + * If not set uses current server time. Updates will be applied to the + * SecurityMarks that are active immediately preceding this time. + */ + // const startTime = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateSecurityMarks() { + // Construct request + const request = { + securityMarks, + }; + + // Run request + const response = await securitycenterClient.updateSecurityMarks(request); + console.log(response); + } + + callUpdateSecurityMarks(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_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/security_center.update_source.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_source.js new file mode 100644 index 00000000..e99ad6fe --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.update_source.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(source) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateSource_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The source resource to update. + */ + // const source = {} + /** + * The FieldMask to use when updating the source resource. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateSource() { + // Construct request + const request = { + source, + }; + + // Run request + const response = await securitycenterClient.updateSource(request); + console.log(response); + } + + callUpdateSource(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateSource_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 00000000..78a13c59 --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,25 @@ +// 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. +// +// ** 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 SecurityCenterClient = v1.SecurityCenterClient; +type SecurityCenterClient = v1.SecurityCenterClient; +export {v1, SecurityCenterClient}; +export default {v1, SecurityCenterClient}; +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 00000000..3280f72a --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,277 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.securitycenter.v1", + "libraryPackage": "@google-cloud/security-center", + "services": { + "SecurityCenter": { + "clients": { + "grpc": { + "libraryClient": "SecurityCenterClient", + "rpcs": { + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "CreateFinding": { + "methods": [ + "createFinding" + ] + }, + "CreateNotificationConfig": { + "methods": [ + "createNotificationConfig" + ] + }, + "DeleteNotificationConfig": { + "methods": [ + "deleteNotificationConfig" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetNotificationConfig": { + "methods": [ + "getNotificationConfig" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateNotificationConfig": { + "methods": [ + "updateNotificationConfig" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListNotificationConfigs": { + "methods": [ + "listNotificationConfigs", + "listNotificationConfigsStream", + "listNotificationConfigsAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SecurityCenterClient", + "rpcs": { + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "CreateFinding": { + "methods": [ + "createFinding" + ] + }, + "CreateNotificationConfig": { + "methods": [ + "createNotificationConfig" + ] + }, + "DeleteNotificationConfig": { + "methods": [ + "deleteNotificationConfig" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetNotificationConfig": { + "methods": [ + "getNotificationConfig" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateNotificationConfig": { + "methods": [ + "updateNotificationConfig" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListNotificationConfigs": { + "methods": [ + "listNotificationConfigs", + "listNotificationConfigsStream", + "listNotificationConfigsAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts new file mode 100644 index 00000000..de26020d --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// 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. +// +// ** 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 {SecurityCenterClient} from './security_center_client'; diff --git a/owl-bot-staging/v1/src/v1/security_center_client.ts b/owl-bot-staging/v1/src/v1/security_center_client.ts new file mode 100644 index 00000000..1b460d76 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/security_center_client.ts @@ -0,0 +1,4987 @@ +// 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. +// +// ** 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, LROperation, 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/security_center_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './security_center_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * V1 APIs for Security Center service. + * @class + * @memberof v1 + */ +export class SecurityCenterClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + securityCenterStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SecurityCenterClient. + * + * @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). + * 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} [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. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SecurityCenterClient; + 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 = { + folderAssetPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/assets/{asset}' + ), + folderAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/assets/{asset}/securityMarks' + ), + folderSourcePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}' + ), + folderSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}/findings/{finding}' + ), + folderSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}/findings/{finding}/securityMarks' + ), + notificationConfigPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationConfigs/{notification_config}' + ), + organizationPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}' + ), + organizationAssetPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/assets/{asset}' + ), + organizationAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/assets/{asset}/securityMarks' + ), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/organizationSettings' + ), + organizationSourcePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}' + ), + organizationSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}' + ), + organizationSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' + ), + projectAssetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/assets/{asset}' + ), + projectAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/assets/{asset}/securityMarks' + ), + projectSourcePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}' + ), + projectSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}/findings/{finding}' + ), + projectSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}/findings/{finding}/securityMarks' + ), + }; + + // 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 = { + groupAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), + groupFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), + listAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listAssetsResults'), + listFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listFindingsResults'), + listNotificationConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notificationConfigs'), + listSources: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const runAssetDiscoveryResponse = protoFilesRoot.lookup( + '.google.cloud.securitycenter.v1.RunAssetDiscoveryResponse') as gax.protobuf.Type; + const runAssetDiscoveryMetadata = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + + this.descriptors.longrunning = { + runAssetDiscovery: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), + runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.securitycenter.v1.SecurityCenter', 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.securityCenterStub) { + return this.securityCenterStub; + } + + // Put together the "service stub" for + // google.cloud.securitycenter.v1.SecurityCenter. + this.securityCenterStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.securitycenter.v1.SecurityCenter') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.securitycenter.v1.SecurityCenter, + 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 securityCenterStubMethods = + ['createSource', 'createFinding', 'createNotificationConfig', 'deleteNotificationConfig', 'getIamPolicy', 'getNotificationConfig', 'getOrganizationSettings', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listFindings', 'listNotificationConfigs', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setIamPolicy', 'testIamPermissions', 'updateFinding', 'updateNotificationConfig', 'updateOrganizationSettings', 'updateSource', 'updateSecurityMarks']; + for (const methodName of securityCenterStubMethods) { + const callPromise = this.securityCenterStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.securityCenterStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'securitycenter.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 'securitycenter.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 source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + * @param {google.cloud.securitycenter.v1.Source} request.source + * Required. The Source being created, only the display_name and description will be + * used. All other fields will be ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Source]{@link google.cloud.securitycenter.v1.Source}. + * 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/security_center.create_source.js + * region_tag:securitycenter_v1_generated_SecurityCenter_CreateSource_async + */ + createSource( + request?: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.ICreateSourceRequest|undefined, {}|undefined + ]>; + createSource( + request: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): void; + createSource( + request: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): void; + createSource( + request?: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.ICreateSourceRequest|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.createSource(request, options, callback); + } +/** + * Creates a finding. The corresponding source must exist for finding creation + * to succeed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + * @param {string} request.findingId + * Required. Unique identifier provided by the client within the parent scope. + * It must be alphanumeric and less than or equal to 32 characters and + * greater than 0 characters in length. + * @param {google.cloud.securitycenter.v1.Finding} request.finding + * Required. The Finding being created. The name and security_marks will be ignored as + * they are both output only fields on this resource. + * @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.securitycenter.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/security_center.create_finding.js + * region_tag:securitycenter_v1_generated_SecurityCenter_CreateFinding_async + */ + createFinding( + request?: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ICreateFindingRequest|undefined, {}|undefined + ]>; + createFinding( + request: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): void; + createFinding( + request: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): void; + createFinding( + request?: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ICreateFindingRequest|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.createFinding(request, options, callback); + } +/** + * Creates a notification config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new notification config's parent. Its format is + * "organizations/[organization_id]". + * @param {string} request.configId + * Required. + * Unique identifier provided by the client within the parent scope. + * It must be between 1 and 128 characters, and contains alphanumeric + * characters, underscores or hyphens only. + * @param {google.cloud.securitycenter.v1.NotificationConfig} request.notificationConfig + * Required. The notification config being created. The name and the service account + * will be ignored as they are both output only fields on this resource. + * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1.NotificationConfig}. + * 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/security_center.create_notification_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async + */ + createNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|undefined, {}|undefined + ]>; + createNotificationConfig( + request: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + createNotificationConfig( + request: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + createNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|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.createNotificationConfig(request, options, callback); + } +/** + * Deletes a notification config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the notification config to delete. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/security_center.delete_notification_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async + */ + deleteNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|undefined, {}|undefined + ]>; + deleteNotificationConfig( + request: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteNotificationConfig( + request: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|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.deleteNotificationConfig(request, options, callback); + } +/** + * Gets the access control policy on the specified Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * @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 [Policy]{@link google.iam.v1.Policy}. + * 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/security_center.get_iam_policy.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async + */ + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|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({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } +/** + * Gets a notification config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the notification config to get. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [NotificationConfig]{@link google.cloud.securitycenter.v1.NotificationConfig}. + * 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/security_center.get_notification_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async + */ + getNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|undefined, {}|undefined + ]>; + getNotificationConfig( + request: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + getNotificationConfig( + request: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + getNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|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.getNotificationConfig(request, options, callback); + } +/** + * Gets the settings for an organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the organization to get organization settings for. Its format is + * "organizations/[organization_id]/organizationSettings". + * @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 [OrganizationSettings]{@link google.cloud.securitycenter.v1.OrganizationSettings}. + * 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/security_center.get_organization_settings.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async + */ + getOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|undefined, {}|undefined + ]>; + getOrganizationSettings( + request: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + getOrganizationSettings( + request: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + getOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|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.getOrganizationSettings(request, options, callback); + } +/** + * Gets a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Source]{@link google.cloud.securitycenter.v1.Source}. + * 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/security_center.get_source.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetSource_async + */ + getSource( + request?: protos.google.cloud.securitycenter.v1.IGetSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IGetSourceRequest|undefined, {}|undefined + ]>; + getSource( + request: protos.google.cloud.securitycenter.v1.IGetSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request: protos.google.cloud.securitycenter.v1.IGetSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request?: protos.google.cloud.securitycenter.v1.IGetSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IGetSourceRequest|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.getSource(request, options, callback); + } +/** + * Updates the state of a finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the finding. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + * @param {google.cloud.securitycenter.v1.Finding.State} request.state + * Required. The desired State of the finding. + * @param {google.protobuf.Timestamp} request.startTime + * Required. The time at which the updated state takes effect. + * @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.securitycenter.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/security_center.set_finding_state.js + * region_tag:securitycenter_v1_generated_SecurityCenter_SetFindingState_async + */ + setFindingState( + request?: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|undefined, {}|undefined + ]>; + setFindingState( + request: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): void; + setFindingState( + request: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): void; + setFindingState( + request?: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|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.setFindingState(request, options, callback); + } +/** + * Sets the access control policy on the specified Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @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 [Policy]{@link google.iam.v1.Policy}. + * 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/security_center.set_iam_policy.js + * region_tag:securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async + */ + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|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({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.setIamPolicy(request, options, callback); + } +/** + * Returns the permissions that a caller has on the specified source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * 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/security_center.test_iam_permissions.js + * region_tag:securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async + */ + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|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({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.testIamPermissions(request, options, callback); + } +/** + * Creates or updates a finding. The corresponding source must exist for a + * finding creation to succeed. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.Finding} request.finding + * Required. The finding resource to update or create if it does not already exist. + * parent, security_marks, and update_time will be ignored. + * + * In the case of creation, the finding id portion of the name must be + * alphanumeric and less than or equal to 32 characters and greater than 0 + * characters in length. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the finding resource. This field should + * not be specified when creating a finding. + * + * When updating a finding, an empty mask is treated as updating all mutable + * fields and replacing source_properties. Individual source_properties can + * be added/updated by using "source_properties." in the field + * mask. + * @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.securitycenter.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/security_center.update_finding.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateFinding_async + */ + updateFinding( + request?: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|undefined, {}|undefined + ]>; + updateFinding( + request: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): void; + updateFinding( + request: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): void; + updateFinding( + request?: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|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({ + 'finding.name': request.finding!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateFinding(request, options, callback); + } +/** + * + * Updates a notification config. The following update + * fields are allowed: description, pubsub_topic, streaming_config.filter + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.NotificationConfig} request.notificationConfig + * Required. The notification config to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the notification config. + * + * If empty all mutable fields will be updated. + * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1.NotificationConfig}. + * 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/security_center.update_notification_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async + */ + updateNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|undefined, {}|undefined + ]>; + updateNotificationConfig( + request: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + updateNotificationConfig( + request: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + updateNotificationConfig( + request?: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig, + protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|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({ + 'notification_config.name': request.notificationConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateNotificationConfig(request, options, callback); + } +/** + * Updates an organization's settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.OrganizationSettings} request.organizationSettings + * Required. The organization settings resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the settings resource. + * + * If empty all mutable fields will be updated. + * @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 [OrganizationSettings]{@link google.cloud.securitycenter.v1.OrganizationSettings}. + * 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/security_center.update_organization_settings.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async + */ + updateOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined + ]>; + updateOrganizationSettings( + request: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateOrganizationSettings( + request: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|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({ + 'organization_settings.name': request.organizationSettings!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateOrganizationSettings(request, options, callback); + } +/** + * Updates a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.Source} request.source + * Required. The source resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the source resource. + * + * If empty all mutable fields will be updated. + * @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 [Source]{@link google.cloud.securitycenter.v1.Source}. + * 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/security_center.update_source.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateSource_async + */ + updateSource( + request?: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|undefined, {}|undefined + ]>; + updateSource( + request: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): void; + updateSource( + request: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): void; + updateSource( + request?: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource, + protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|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({ + 'source.name': request.source!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSource(request, options, callback); + } +/** + * Updates security marks. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.SecurityMarks} request.securityMarks + * Required. The security marks resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the security marks resource. + * + * The field mask must not contain duplicate fields. + * If empty or set to "marks", all marks will be replaced. Individual + * marks can be updated using "marks.". + * @param {google.protobuf.Timestamp} request.startTime + * The time at which the updated SecurityMarks take effect. + * If not set uses current server time. Updates will be applied to the + * SecurityMarks that are active immediately preceding this time. + * @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 [SecurityMarks]{@link google.cloud.securitycenter.v1.SecurityMarks}. + * 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/security_center.update_security_marks.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async + */ + updateSecurityMarks( + request?: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityMarks, + protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|undefined, {}|undefined + ]>; + updateSecurityMarks( + request: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISecurityMarks, + protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityMarks( + request: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.ISecurityMarks, + protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityMarks( + request?: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.ISecurityMarks, + protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.ISecurityMarks, + protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISecurityMarks, + protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|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({ + 'security_marks.name': request.securityMarks!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSecurityMarks(request, options, callback); + } + +/** + * Runs asset discovery. The discovery is tracked with a long-running + * operation. + * + * This API can only be called with limited frequency for an organization. If + * it is called too frequently the caller will receive a TOO_MANY_REQUESTS + * error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to run asset discovery for. Its format is + * "organizations/[organization_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/security_center.run_asset_discovery.js + * region_tag:securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async + */ + runAssetDiscovery( + request?: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runAssetDiscovery( + request: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runAssetDiscovery( + request: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runAssetDiscovery( + request?: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.runAssetDiscovery(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runAssetDiscovery()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/security_center.run_asset_discovery.js + * region_tag:securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async + */ + async checkRunAssetDiscoveryProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.runAssetDiscovery, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Filters an organization's assets and groups them by their specified + * properties. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [GroupResult]{@link google.cloud.securitycenter.v1.GroupResult}. + * 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 `groupAssetsAsync()` + * 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. + */ + groupAssets( + request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IGroupResult[], + protos.google.cloud.securitycenter.v1.IGroupAssetsRequest|null, + protos.google.cloud.securitycenter.v1.IGroupAssetsResponse + ]>; + groupAssets( + request: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>): void; + groupAssets( + request: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>): void; + groupAssets( + request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>): + Promise<[ + protos.google.cloud.securitycenter.v1.IGroupResult[], + protos.google.cloud.securitycenter.v1.IGroupAssetsRequest|null, + protos.google.cloud.securitycenter.v1.IGroupAssetsResponse + ]>|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.groupAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [GroupResult]{@link google.cloud.securitycenter.v1.GroupResult} 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 `groupAssetsAsync()` + * 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. + */ + groupAssetsStream( + request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + 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['groupAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupAssets.createStream( + this.innerApiCalls.groupAssets as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `groupAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [GroupResult]{@link google.cloud.securitycenter.v1.GroupResult}. 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/security_center.group_assets.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GroupAssets_async + */ + groupAssetsAsync( + request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, + 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['groupAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupAssets.asyncIterate( + this.innerApiCalls['groupAssets'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Filters an organization or source's findings and groups them by their + * specified properties. + * + * To group across all sources provide a `-` as the source id. + * Example: /v1/organizations/{organization_id}/sources/-/findings, + * /v1/folders/{folder_id}/sources/-/findings, + * /v1/projects/{project_id}/sources/-/findings + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state_change`). The string value should follow SQL syntax: comma separated + * list of fields. For example: "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * * severity + * + * The following fields are supported when compare_duration is set: + * + * * state_change + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [GroupResult]{@link google.cloud.securitycenter.v1.GroupResult}. + * 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 `groupFindingsAsync()` + * 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. + */ + groupFindings( + request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IGroupResult[], + protos.google.cloud.securitycenter.v1.IGroupFindingsRequest|null, + protos.google.cloud.securitycenter.v1.IGroupFindingsResponse + ]>; + groupFindings( + request: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>): void; + groupFindings( + request: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>): void; + groupFindings( + request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IGroupResult>): + Promise<[ + protos.google.cloud.securitycenter.v1.IGroupResult[], + protos.google.cloud.securitycenter.v1.IGroupFindingsRequest|null, + protos.google.cloud.securitycenter.v1.IGroupFindingsResponse + ]>|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.groupFindings(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state_change`). The string value should follow SQL syntax: comma separated + * list of fields. For example: "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * * severity + * + * The following fields are supported when compare_duration is set: + * + * * state_change + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [GroupResult]{@link google.cloud.securitycenter.v1.GroupResult} 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 `groupFindingsAsync()` + * 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. + */ + groupFindingsStream( + request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + 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['groupFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupFindings.createStream( + this.innerApiCalls.groupFindings as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `groupFindings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state_change`). The string value should follow SQL syntax: comma separated + * list of fields. For example: "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * * severity + * + * The following fields are supported when compare_duration is set: + * + * * state_change + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [GroupResult]{@link google.cloud.securitycenter.v1.GroupResult}. 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/security_center.group_findings.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GroupFindings_async + */ + groupFindingsAsync( + request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, + 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['groupFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupFindings.asyncIterate( + this.innerApiCalls['groupFindings'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists an organization's assets. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following are the allowed field and operator combinations: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [ListAssetsResult]{@link google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssets( + request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[], + protos.google.cloud.securitycenter.v1.IListAssetsRequest|null, + protos.google.cloud.securitycenter.v1.IListAssetsResponse + ]>; + listAssets( + request: protos.google.cloud.securitycenter.v1.IListAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>): void; + listAssets( + request: protos.google.cloud.securitycenter.v1.IListAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>): void; + listAssets( + request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>): + Promise<[ + protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[], + protos.google.cloud.securitycenter.v1.IListAssetsRequest|null, + protos.google.cloud.securitycenter.v1.IListAssetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following are the allowed field and operator combinations: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [ListAssetsResult]{@link google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssetsStream( + request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.createStream( + this.innerApiCalls.listAssets as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following are the allowed field and operator combinations: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [ListAssetsResult]{@link google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult}. 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/security_center.list_assets.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListAssets_async + */ + listAssetsAsync( + request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.asyncIterate( + this.innerApiCalls['listAssets'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists an organization or source's findings. + * + * To list across all sources provide a `-` as the source id. + * Example: /v1/organizations/{organization_id}/sources/-/findings + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * * resource.folders.resource_folder: `=`, `:` + * * resource.display_name: `=`, `:` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [ListFindingsResult]{@link google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult}. + * 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.securitycenter.v1.IListFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[], + protos.google.cloud.securitycenter.v1.IListFindingsRequest|null, + protos.google.cloud.securitycenter.v1.IListFindingsResponse + ]>; + listFindings( + request: protos.google.cloud.securitycenter.v1.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>): void; + listFindings( + request: protos.google.cloud.securitycenter.v1.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>): void; + listFindings( + request?: protos.google.cloud.securitycenter.v1.IListFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>): + Promise<[ + protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[], + protos.google.cloud.securitycenter.v1.IListFindingsRequest|null, + protos.google.cloud.securitycenter.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. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * * resource.folders.resource_folder: `=`, `:` + * * resource.display_name: `=`, `:` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [ListFindingsResult]{@link google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult} 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.securitycenter.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. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * severity: `=`, `:` + * * workflow_state: `=`, `:` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * + * * resource: + * * resource.name: `=`, `:` + * * resource.parent_name: `=`, `:` + * * resource.parent_display_name: `=`, `:` + * * resource.project_name: `=`, `:` + * * resource.project_display_name: `=`, `:` + * * resource.type: `=`, `:` + * * resource.folders.resource_folder: `=`, `:` + * * resource.display_name: `=`, `:` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [ListFindingsResult]{@link google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult}. 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/security_center.list_findings.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListFindings_async + */ + listFindingsAsync( + request?: protos.google.cloud.securitycenter.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; + } + /** + * Lists notification configs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1.NotificationConfig}. + * 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 `listNotificationConfigsAsync()` + * 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. + */ + listNotificationConfigs( + request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig[], + protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest|null, + protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse + ]>; + listNotificationConfigs( + request: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.INotificationConfig>): void; + listNotificationConfigs( + request: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.INotificationConfig>): void; + listNotificationConfigs( + request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.INotificationConfig>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.INotificationConfig>): + Promise<[ + protos.google.cloud.securitycenter.v1.INotificationConfig[], + protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest|null, + protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse + ]>|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.listNotificationConfigs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1.NotificationConfig} 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 `listNotificationConfigsAsync()` + * 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. + */ + listNotificationConfigsStream( + request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + 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['listNotificationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNotificationConfigs.createStream( + this.innerApiCalls.listNotificationConfigs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNotificationConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [NotificationConfig]{@link google.cloud.securitycenter.v1.NotificationConfig}. 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/security_center.list_notification_configs.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async + */ + listNotificationConfigsAsync( + request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, + 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['listNotificationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNotificationConfigs.asyncIterate( + this.innerApiCalls['listNotificationConfigs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists all sources belonging to an organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [Source]{@link google.cloud.securitycenter.v1.Source}. + * 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 `listSourcesAsync()` + * 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. + */ + listSources( + request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource[], + protos.google.cloud.securitycenter.v1.IListSourcesRequest|null, + protos.google.cloud.securitycenter.v1.IListSourcesResponse + ]>; + listSources( + request: protos.google.cloud.securitycenter.v1.IListSourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISource>): void; + listSources( + request: protos.google.cloud.securitycenter.v1.IListSourcesRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISource>): void; + listSources( + request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISource>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1.ISource>): + Promise<[ + protos.google.cloud.securitycenter.v1.ISource[], + protos.google.cloud.securitycenter.v1.IListSourcesRequest|null, + protos.google.cloud.securitycenter.v1.IListSourcesResponse + ]>|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.listSources(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. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [Source]{@link google.cloud.securitycenter.v1.Source} 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 `listSourcesAsync()` + * 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. + */ + listSourcesStream( + request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, + 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['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.createStream( + this.innerApiCalls.listSources as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSources`, 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. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [Source]{@link google.cloud.securitycenter.v1.Source}. 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/security_center.list_sources.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListSources_async + */ + listSourcesAsync( + request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, + 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['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.asyncIterate( + this.innerApiCalls['listSources'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderAsset resource name string. + * + * @param {string} folder + * @param {string} asset + * @returns {string} Resource name string. + */ + folderAssetPath(folder:string,asset:string) { + return this.pathTemplates.folderAssetPathTemplate.render({ + folder: folder, + asset: asset, + }); + } + + /** + * Parse the folder from FolderAsset resource. + * + * @param {string} folderAssetName + * A fully-qualified path representing folder_asset resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAssetName(folderAssetName: string) { + return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).folder; + } + + /** + * Parse the asset from FolderAsset resource. + * + * @param {string} folderAssetName + * A fully-qualified path representing folder_asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromFolderAssetName(folderAssetName: string) { + return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).asset; + } + + /** + * Return a fully-qualified folderAssetSecurityMarks resource name string. + * + * @param {string} folder + * @param {string} asset + * @returns {string} Resource name string. + */ + folderAssetSecurityMarksPath(folder:string,asset:string) { + return this.pathTemplates.folderAssetSecurityMarksPathTemplate.render({ + folder: folder, + asset: asset, + }); + } + + /** + * Parse the folder from FolderAssetSecurityMarks resource. + * + * @param {string} folderAssetSecurityMarksName + * A fully-qualified path representing folder_asset_securityMarks resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { + return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).folder; + } + + /** + * Parse the asset from FolderAssetSecurityMarks resource. + * + * @param {string} folderAssetSecurityMarksName + * A fully-qualified path representing folder_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { + return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified folderSource resource name string. + * + * @param {string} folder + * @param {string} source + * @returns {string} Resource name string. + */ + folderSourcePath(folder:string,source:string) { + return this.pathTemplates.folderSourcePathTemplate.render({ + folder: folder, + source: source, + }); + } + + /** + * Parse the folder from FolderSource resource. + * + * @param {string} folderSourceName + * A fully-qualified path representing folder_source resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceName(folderSourceName: string) { + return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).folder; + } + + /** + * Parse the source from FolderSource resource. + * + * @param {string} folderSourceName + * A fully-qualified path representing folder_source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceName(folderSourceName: string) { + return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).source; + } + + /** + * Return a fully-qualified folderSourceFinding resource name string. + * + * @param {string} folder + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + folderSourceFindingPath(folder:string,source:string,finding:string) { + return this.pathTemplates.folderSourceFindingPathTemplate.render({ + folder: folder, + source: source, + finding: finding, + }); + } + + /** + * Parse the folder from FolderSourceFinding resource. + * + * @param {string} folderSourceFindingName + * A fully-qualified path representing folder_source_finding resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceFindingName(folderSourceFindingName: string) { + return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).folder; + } + + /** + * Parse the source from FolderSourceFinding resource. + * + * @param {string} folderSourceFindingName + * A fully-qualified path representing folder_source_finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceFindingName(folderSourceFindingName: string) { + return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).source; + } + + /** + * Parse the finding from FolderSourceFinding resource. + * + * @param {string} folderSourceFindingName + * A fully-qualified path representing folder_source_finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFolderSourceFindingName(folderSourceFindingName: string) { + return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).finding; + } + + /** + * Return a fully-qualified folderSourceFindingSecurityMarks resource name string. + * + * @param {string} folder + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + folderSourceFindingSecurityMarksPath(folder:string,source:string,finding:string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render({ + folder: folder, + source: source, + finding: finding, + }); + } + + /** + * Parse the folder from FolderSourceFindingSecurityMarks resource. + * + * @param {string} folderSourceFindingSecurityMarksName + * A fully-qualified path representing folder_source_finding_securityMarks resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).folder; + } + + /** + * Parse the source from FolderSourceFindingSecurityMarks resource. + * + * @param {string} folderSourceFindingSecurityMarksName + * A fully-qualified path representing folder_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from FolderSourceFindingSecurityMarks resource. + * + * @param {string} folderSourceFindingSecurityMarksName + * A fully-qualified path representing folder_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).finding; + } + + /** + * Return a fully-qualified notificationConfig resource name string. + * + * @param {string} organization + * @param {string} notification_config + * @returns {string} Resource name string. + */ + notificationConfigPath(organization:string,notificationConfig:string) { + return this.pathTemplates.notificationConfigPathTemplate.render({ + organization: organization, + notification_config: notificationConfig, + }); + } + + /** + * Parse the organization from NotificationConfig resource. + * + * @param {string} notificationConfigName + * A fully-qualified path representing NotificationConfig resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromNotificationConfigName(notificationConfigName: string) { + return this.pathTemplates.notificationConfigPathTemplate.match(notificationConfigName).organization; + } + + /** + * Parse the notification_config from NotificationConfig resource. + * + * @param {string} notificationConfigName + * A fully-qualified path representing NotificationConfig resource. + * @returns {string} A string representing the notification_config. + */ + matchNotificationConfigFromNotificationConfigName(notificationConfigName: string) { + return this.pathTemplates.notificationConfigPathTemplate.match(notificationConfigName).notification_config; + } + + /** + * Return a fully-qualified organization resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationPath(organization:string) { + return this.pathTemplates.organizationPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from Organization resource. + * + * @param {string} organizationName + * A fully-qualified path representing Organization resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationName(organizationName: string) { + return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; + } + + /** + * Return a fully-qualified organizationAsset resource name string. + * + * @param {string} organization + * @param {string} asset + * @returns {string} Resource name string. + */ + organizationAssetPath(organization:string,asset:string) { + return this.pathTemplates.organizationAssetPathTemplate.render({ + organization: organization, + asset: asset, + }); + } + + /** + * Parse the organization from OrganizationAsset resource. + * + * @param {string} organizationAssetName + * A fully-qualified path representing organization_asset resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAssetName(organizationAssetName: string) { + return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).organization; + } + + /** + * Parse the asset from OrganizationAsset resource. + * + * @param {string} organizationAssetName + * A fully-qualified path representing organization_asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromOrganizationAssetName(organizationAssetName: string) { + return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).asset; + } + + /** + * Return a fully-qualified organizationAssetSecurityMarks resource name string. + * + * @param {string} organization + * @param {string} asset + * @returns {string} Resource name string. + */ + organizationAssetSecurityMarksPath(organization:string,asset:string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.render({ + organization: organization, + asset: asset, + }); + } + + /** + * Parse the organization from OrganizationAssetSecurityMarks resource. + * + * @param {string} organizationAssetSecurityMarksName + * A fully-qualified path representing organization_asset_securityMarks resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).organization; + } + + /** + * Parse the asset from OrganizationAssetSecurityMarks resource. + * + * @param {string} organizationAssetSecurityMarksName + * A fully-qualified path representing organization_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization:string) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing OrganizationSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + + /** + * Return a fully-qualified organizationSource resource name string. + * + * @param {string} organization + * @param {string} source + * @returns {string} Resource name string. + */ + organizationSourcePath(organization:string,source:string) { + return this.pathTemplates.organizationSourcePathTemplate.render({ + organization: organization, + source: source, + }); + } + + /** + * Parse the organization from OrganizationSource resource. + * + * @param {string} organizationSourceName + * A fully-qualified path representing organization_source resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceName(organizationSourceName: string) { + return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).organization; + } + + /** + * Parse the source from OrganizationSource resource. + * + * @param {string} organizationSourceName + * A fully-qualified path representing organization_source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceName(organizationSourceName: string) { + return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).source; + } + + /** + * Return a fully-qualified organizationSourceFinding resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + organizationSourceFindingPath(organization:string,source:string,finding:string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + }); + } + + /** + * Parse the organization from OrganizationSourceFinding resource. + * + * @param {string} organizationSourceFindingName + * A fully-qualified path representing organization_source_finding resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceFindingName(organizationSourceFindingName: string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).organization; + } + + /** + * Parse the source from OrganizationSourceFinding resource. + * + * @param {string} organizationSourceFindingName + * A fully-qualified path representing organization_source_finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceFindingName(organizationSourceFindingName: string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).source; + } + + /** + * Parse the finding from OrganizationSourceFinding resource. + * + * @param {string} organizationSourceFindingName + * A fully-qualified path representing organization_source_finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromOrganizationSourceFindingName(organizationSourceFindingName: string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).finding; + } + + /** + * Return a fully-qualified organizationSourceFindingSecurityMarks resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + organizationSourceFindingSecurityMarksPath(organization:string,source:string,finding:string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + }); + } + + /** + * Parse the organization from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).organization; + } + + /** + * Parse the source from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).finding; + } + + /** + * Return a fully-qualified projectAsset resource name string. + * + * @param {string} project + * @param {string} asset + * @returns {string} Resource name string. + */ + projectAssetPath(project:string,asset:string) { + return this.pathTemplates.projectAssetPathTemplate.render({ + project: project, + asset: asset, + }); + } + + /** + * Parse the project from ProjectAsset resource. + * + * @param {string} projectAssetName + * A fully-qualified path representing project_asset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAssetName(projectAssetName: string) { + return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).project; + } + + /** + * Parse the asset from ProjectAsset resource. + * + * @param {string} projectAssetName + * A fully-qualified path representing project_asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromProjectAssetName(projectAssetName: string) { + return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).asset; + } + + /** + * Return a fully-qualified projectAssetSecurityMarks resource name string. + * + * @param {string} project + * @param {string} asset + * @returns {string} Resource name string. + */ + projectAssetSecurityMarksPath(project:string,asset:string) { + return this.pathTemplates.projectAssetSecurityMarksPathTemplate.render({ + project: project, + asset: asset, + }); + } + + /** + * Parse the project from ProjectAssetSecurityMarks resource. + * + * @param {string} projectAssetSecurityMarksName + * A fully-qualified path representing project_asset_securityMarks resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { + return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).project; + } + + /** + * Parse the asset from ProjectAssetSecurityMarks resource. + * + * @param {string} projectAssetSecurityMarksName + * A fully-qualified path representing project_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { + return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified projectSource resource name string. + * + * @param {string} project + * @param {string} source + * @returns {string} Resource name string. + */ + projectSourcePath(project:string,source:string) { + return this.pathTemplates.projectSourcePathTemplate.render({ + project: project, + source: source, + }); + } + + /** + * Parse the project from ProjectSource resource. + * + * @param {string} projectSourceName + * A fully-qualified path representing project_source resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceName(projectSourceName: string) { + return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).project; + } + + /** + * Parse the source from ProjectSource resource. + * + * @param {string} projectSourceName + * A fully-qualified path representing project_source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceName(projectSourceName: string) { + return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).source; + } + + /** + * Return a fully-qualified projectSourceFinding resource name string. + * + * @param {string} project + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + projectSourceFindingPath(project:string,source:string,finding:string) { + return this.pathTemplates.projectSourceFindingPathTemplate.render({ + project: project, + source: source, + finding: finding, + }); + } + + /** + * Parse the project from ProjectSourceFinding resource. + * + * @param {string} projectSourceFindingName + * A fully-qualified path representing project_source_finding resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceFindingName(projectSourceFindingName: string) { + return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).project; + } + + /** + * Parse the source from ProjectSourceFinding resource. + * + * @param {string} projectSourceFindingName + * A fully-qualified path representing project_source_finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceFindingName(projectSourceFindingName: string) { + return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).source; + } + + /** + * Parse the finding from ProjectSourceFinding resource. + * + * @param {string} projectSourceFindingName + * A fully-qualified path representing project_source_finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromProjectSourceFindingName(projectSourceFindingName: string) { + return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).finding; + } + + /** + * Return a fully-qualified projectSourceFindingSecurityMarks resource name string. + * + * @param {string} project + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + projectSourceFindingSecurityMarksPath(project:string,source:string,finding:string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render({ + project: project, + source: source, + finding: finding, + }); + } + + /** + * Parse the project from ProjectSourceFindingSecurityMarks resource. + * + * @param {string} projectSourceFindingSecurityMarksName + * A fully-qualified path representing project_source_finding_securityMarks resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).project; + } + + /** + * Parse the source from ProjectSourceFindingSecurityMarks resource. + * + * @param {string} projectSourceFindingSecurityMarksName + * A fully-qualified path representing project_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from ProjectSourceFindingSecurityMarks resource. + * + * @param {string} projectSourceFindingSecurityMarksName + * A fully-qualified path representing project_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).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 { + this.initialize(); + if (!this._terminated) { + return this.securityCenterStub!.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/security_center_client_config.json b/owl-bot-staging/v1/src/v1/security_center_client_config.json new file mode 100644 index 00000000..dbb23072 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/security_center_client_config.json @@ -0,0 +1,141 @@ +{ + "interfaces": { + "google.cloud.securitycenter.v1.SecurityCenter": { + "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": { + "CreateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetOrganizationSettings": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetSource": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GroupAssets": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GroupFindings": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListAssets": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindings": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListNotificationConfigs": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListSources": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RunAssetDiscovery": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetFindingState": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateFinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateOrganizationSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSecurityMarks": { + "timeout_millis": 480000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/security_center_proto_list.json b/owl-bot-staging/v1/src/v1/security_center_proto_list.json new file mode 100644 index 00000000..dbee8391 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/security_center_proto_list.json @@ -0,0 +1,15 @@ +[ + "../../protos/google/cloud/securitycenter/v1/asset.proto", + "../../protos/google/cloud/securitycenter/v1/finding.proto", + "../../protos/google/cloud/securitycenter/v1/folder.proto", + "../../protos/google/cloud/securitycenter/v1/indicator.proto", + "../../protos/google/cloud/securitycenter/v1/notification_config.proto", + "../../protos/google/cloud/securitycenter/v1/notification_message.proto", + "../../protos/google/cloud/securitycenter/v1/organization_settings.proto", + "../../protos/google/cloud/securitycenter/v1/resource.proto", + "../../protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto", + "../../protos/google/cloud/securitycenter/v1/security_marks.proto", + "../../protos/google/cloud/securitycenter/v1/securitycenter_service.proto", + "../../protos/google/cloud/securitycenter/v1/source.proto", + "../../protos/google/cloud/securitycenter/v1/vulnerability.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 00000000..37333715 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// 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. +// +// ** 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 securitycenter = require('@google-cloud/security-center'); + +function main() { + const securityCenterClient = new securitycenter.SecurityCenterClient(); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000..b4153c94 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// 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. +// +// ** 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 {SecurityCenterClient} from '@google-cloud/security-center'; + +// check that the client class type name can be used +function doStuffWithSecurityCenterClient(client: SecurityCenterClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const securityCenterClient = new SecurityCenterClient(); + doStuffWithSecurityCenterClient(securityCenterClient); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 00000000..1f850b52 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// 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. +// +// ** 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_security_center_v1.ts b/owl-bot-staging/v1/test/gapic_security_center_v1.ts new file mode 100644 index 00000000..d64b2ce1 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_security_center_v1.ts @@ -0,0 +1,3743 @@ +// 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. +// +// ** 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 securitycenterModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SecurityCenterClient', () => { + it('has servicePath', () => { + const servicePath = securitycenterModule.v1.SecurityCenterClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = securitycenterModule.v1.SecurityCenterClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = securitycenterModule.v1.SecurityCenterClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new securitycenterModule.v1.SecurityCenterClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.securityCenterStub, undefined); + await client.initialize(); + assert(client.securityCenterStub); + }); + + it('has close method', () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new securitycenterModule.v1.SecurityCenterClient({ + 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 securitycenterModule.v1.SecurityCenterClient({ + 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('createSource', () => { + it('invokes createSource without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateSourceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()); + client.innerApiCalls.createSource = stubSimpleCall(expectedResponse); + const [response] = await client.createSource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSource without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateSourceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()); + client.innerApiCalls.createSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createSource with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateSourceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSource(request), expectedError); + assert((client.innerApiCalls.createSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createFinding', () => { + it('invokes createFinding without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateFindingRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Finding()); + client.innerApiCalls.createFinding = stubSimpleCall(expectedResponse); + const [response] = await client.createFinding(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createFinding without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateFindingRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Finding()); + client.innerApiCalls.createFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFinding( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createFinding with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateFindingRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createFinding(request), expectedError); + assert((client.innerApiCalls.createFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createNotificationConfig', () => { + it('invokes createNotificationConfig without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()); + client.innerApiCalls.createNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()); + client.innerApiCalls.createNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNotificationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createNotificationConfig with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createNotificationConfig(request), expectedError); + assert((client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteNotificationConfig', () => { + it('invokes deleteNotificationConfig without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNotificationConfig( + 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.deleteNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteNotificationConfig with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteNotificationConfig(request), expectedError); + assert((client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getNotificationConfig', () => { + it('invokes getNotificationConfig without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()); + client.innerApiCalls.getNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()); + client.innerApiCalls.getNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNotificationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getNotificationConfig with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNotificationConfig(request), expectedError); + assert((client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getOrganizationSettings', () => { + it('invokes getOrganizationSettings without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.OrganizationSettings()); + client.innerApiCalls.getOrganizationSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getOrganizationSettings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getOrganizationSettings without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.OrganizationSettings()); + client.innerApiCalls.getOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getOrganizationSettings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IOrganizationSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getOrganizationSettings with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getOrganizationSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getOrganizationSettings(request), expectedError); + assert((client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getSource', () => { + it('invokes getSource without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetSourceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()); + client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); + const [response] = await client.getSource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSource without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetSourceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()); + client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getSource with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetSourceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSource(request), expectedError); + assert((client.innerApiCalls.getSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('setFindingState', () => { + it('invokes setFindingState without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.SetFindingStateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Finding()); + client.innerApiCalls.setFindingState = stubSimpleCall(expectedResponse); + const [response] = await client.setFindingState(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setFindingState without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.SetFindingStateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Finding()); + client.innerApiCalls.setFindingState = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setFindingState( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setFindingState with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.SetFindingStateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setFindingState = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setFindingState(request), expectedError); + assert((client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateFinding', () => { + it('invokes updateFinding without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateFindingRequest()); + request.finding = {}; + request.finding.name = ''; + const expectedHeaderRequestParams = "finding.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Finding()); + client.innerApiCalls.updateFinding = stubSimpleCall(expectedResponse); + const [response] = await client.updateFinding(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateFinding without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateFindingRequest()); + request.finding = {}; + request.finding.name = ''; + const expectedHeaderRequestParams = "finding.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Finding()); + client.innerApiCalls.updateFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFinding( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateFinding with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateFindingRequest()); + request.finding = {}; + request.finding.name = ''; + const expectedHeaderRequestParams = "finding.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateFinding(request), expectedError); + assert((client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateNotificationConfig', () => { + it('invokes updateNotificationConfig without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest()); + request.notificationConfig = {}; + request.notificationConfig.name = ''; + const expectedHeaderRequestParams = "notification_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()); + client.innerApiCalls.updateNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest()); + request.notificationConfig = {}; + request.notificationConfig.name = ''; + const expectedHeaderRequestParams = "notification_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()); + client.innerApiCalls.updateNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNotificationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateNotificationConfig with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest()); + request.notificationConfig = {}; + request.notificationConfig.name = ''; + const expectedHeaderRequestParams = "notification_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateNotificationConfig(request), expectedError); + assert((client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateOrganizationSettings', () => { + it('invokes updateOrganizationSettings without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest()); + request.organizationSettings = {}; + request.organizationSettings.name = ''; + const expectedHeaderRequestParams = "organization_settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.OrganizationSettings()); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateOrganizationSettings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateOrganizationSettings without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest()); + request.organizationSettings = {}; + request.organizationSettings.name = ''; + const expectedHeaderRequestParams = "organization_settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.OrganizationSettings()); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateOrganizationSettings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IOrganizationSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateOrganizationSettings with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest()); + request.organizationSettings = {}; + request.organizationSettings.name = ''; + const expectedHeaderRequestParams = "organization_settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateOrganizationSettings(request), expectedError); + assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateSource', () => { + it('invokes updateSource without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateSourceRequest()); + request.source = {}; + request.source.name = ''; + const expectedHeaderRequestParams = "source.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()); + client.innerApiCalls.updateSource = stubSimpleCall(expectedResponse); + const [response] = await client.updateSource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSource without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateSourceRequest()); + request.source = {}; + request.source.name = ''; + const expectedHeaderRequestParams = "source.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()); + client.innerApiCalls.updateSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateSource with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateSourceRequest()); + request.source = {}; + request.source.name = ''; + const expectedHeaderRequestParams = "source.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSource(request), expectedError); + assert((client.innerApiCalls.updateSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateSecurityMarks', () => { + it('invokes updateSecurityMarks without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest()); + request.securityMarks = {}; + request.securityMarks.name = ''; + const expectedHeaderRequestParams = "security_marks.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityMarks()); + client.innerApiCalls.updateSecurityMarks = stubSimpleCall(expectedResponse); + const [response] = await client.updateSecurityMarks(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSecurityMarks without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest()); + request.securityMarks = {}; + request.securityMarks.name = ''; + const expectedHeaderRequestParams = "security_marks.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityMarks()); + client.innerApiCalls.updateSecurityMarks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecurityMarks( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityMarks|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateSecurityMarks with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest()); + request.securityMarks = {}; + request.securityMarks.name = ''; + const expectedHeaderRequestParams = "security_marks.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityMarks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSecurityMarks(request), expectedError); + assert((client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('runAssetDiscovery', () => { + it('invokes runAssetDiscovery without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(expectedResponse); + const [operation] = await client.runAssetDiscovery(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes runAssetDiscovery without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runAssetDiscovery( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes runAssetDiscovery with call error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runAssetDiscovery(request), expectedError); + assert((client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes runAssetDiscovery with LRO error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runAssetDiscovery(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkRunAssetDiscoveryProgress without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRunAssetDiscoveryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRunAssetDiscoveryProgress with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRunAssetDiscoveryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('groupAssets', () => { + it('invokes groupAssets without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.innerApiCalls.groupAssets = stubSimpleCall(expectedResponse); + const [response] = await client.groupAssets(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes groupAssets without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.innerApiCalls.groupAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.groupAssets( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IGroupResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes groupAssets with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.groupAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.groupAssets(request), expectedError); + assert((client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes groupAssetsStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.groupAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { + 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.groupAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); + assert.strictEqual( + (client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes groupAssetsStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.groupAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); + assert.strictEqual( + (client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with groupAssets without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; + const iterable = client.groupAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with groupAssets with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.groupAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('groupFindings', () => { + it('invokes groupFindings without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.innerApiCalls.groupFindings = stubSimpleCall(expectedResponse); + const [response] = await client.groupFindings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes groupFindings without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.innerApiCalls.groupFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.groupFindings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IGroupResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes groupFindings with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.groupFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.groupFindings(request), expectedError); + assert((client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes groupFindingsStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.groupFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { + 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.groupFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); + assert.strictEqual( + (client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes groupFindingsStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.groupFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); + assert.strictEqual( + (client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with groupFindings without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), + ]; + client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; + const iterable = client.groupFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with groupFindings with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.groupFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listAssets', () => { + it('invokes listAssets without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + ]; + client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); + const [response] = await client.listAssets(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAssets without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + ]; + client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAssets( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listAssets with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAssets(request), expectedError); + assert((client.innerApiCalls.listAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAssetsStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + ]; + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert.strictEqual( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listAssetsStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert.strictEqual( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAssets without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), + ]; + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[] = []; + const iterable = client.listAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAssets with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAssets.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 securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + ]; + 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 securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + ]; + client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[]|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 securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.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 securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + ]; + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult) => { + 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 securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.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.securitycenter.v1.ListFindingsResponse.ListFindingsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult) => { + 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 securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), + ]; + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[] = []; + 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 securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.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.securitycenter.v1.ListFindingsResponse.IListFindingsResult[] = []; + 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('listNotificationConfigs', () => { + it('invokes listNotificationConfigs without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + ]; + client.innerApiCalls.listNotificationConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listNotificationConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listNotificationConfigs without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + ]; + client.innerApiCalls.listNotificationConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNotificationConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listNotificationConfigs with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listNotificationConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNotificationConfigs(request), expectedError); + assert((client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listNotificationConfigsStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + ]; + client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNotificationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.NotificationConfig[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.NotificationConfig) => { + 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.listNotificationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listNotificationConfigsStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNotificationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.NotificationConfig[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.NotificationConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listNotificationConfigs without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), + ]; + client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.INotificationConfig[] = []; + const iterable = client.listNotificationConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listNotificationConfigs with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNotificationConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.INotificationConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listSources', () => { + it('invokes listSources without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); + const [response] = await client.listSources(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSources as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSources without error using callback', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSources( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSources as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listSources with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSources(request), expectedError); + assert((client.innerApiCalls.listSources as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSourcesStream without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + ]; + client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.Source[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.Source) => { + 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.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert.strictEqual( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listSourcesStream with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.Source[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.Source) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert.strictEqual( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSources without error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), + ]; + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.ISource[] = []; + const iterable = client.listSourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSources with error', async () => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.ISource[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('folderAsset', () => { + const fakePath = "/rendered/path/folderAsset"; + const expectedParameters = { + folder: "folderValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAssetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderAssetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderAssetPath', () => { + const result = client.folderAssetPath("folderValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderAssetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderAssetName', () => { + const result = client.matchFolderFromFolderAssetName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromFolderAssetName', () => { + const result = client.matchAssetFromFolderAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderAssetSecurityMarks', () => { + const fakePath = "/rendered/path/folderAssetSecurityMarks"; + const expectedParameters = { + folder: "folderValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderAssetSecurityMarksPath', () => { + const result = client.folderAssetSecurityMarksPath("folderValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderAssetSecurityMarksName', () => { + const result = client.matchFolderFromFolderAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromFolderAssetSecurityMarksName', () => { + const result = client.matchAssetFromFolderAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSource', () => { + const fakePath = "/rendered/path/folderSource"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourcePath', () => { + const result = client.folderSourcePath("folderValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceName', () => { + const result = client.matchFolderFromFolderSourceName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceName', () => { + const result = client.matchSourceFromFolderSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSourceFinding', () => { + const fakePath = "/rendered/path/folderSourceFinding"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourceFindingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourceFindingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourceFindingPath', () => { + const result = client.folderSourceFindingPath("folderValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourceFindingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceFindingName', () => { + const result = client.matchFolderFromFolderSourceFindingName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceFindingName', () => { + const result = client.matchSourceFromFolderSourceFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFolderSourceFindingName', () => { + const result = client.matchFindingFromFolderSourceFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/folderSourceFindingSecurityMarks"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourceFindingSecurityMarksPath', () => { + const result = client.folderSourceFindingSecurityMarksPath("folderValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceFindingSecurityMarksName', () => { + const result = client.matchFolderFromFolderSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromFolderSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFolderSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromFolderSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('notificationConfig', () => { + const fakePath = "/rendered/path/notificationConfig"; + const expectedParameters = { + organization: "organizationValue", + notification_config: "notificationConfigValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.notificationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.notificationConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('notificationConfigPath', () => { + const result = client.notificationConfigPath("organizationValue", "notificationConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.notificationConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromNotificationConfigName', () => { + const result = client.matchOrganizationFromNotificationConfigName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.notificationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNotificationConfigFromNotificationConfigName', () => { + const result = client.matchNotificationConfigFromNotificationConfigName(fakePath); + assert.strictEqual(result, "notificationConfigValue"); + assert((client.pathTemplates.notificationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organization', () => { + const fakePath = "/rendered/path/organization"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationPath', () => { + const result = client.organizationPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationName', () => { + const result = client.matchOrganizationFromOrganizationName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationAsset', () => { + const fakePath = "/rendered/path/organizationAsset"; + const expectedParameters = { + organization: "organizationValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAssetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAssetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAssetPath', () => { + const result = client.organizationAssetPath("organizationValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationAssetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationAssetName', () => { + const result = client.matchOrganizationFromOrganizationAssetName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromOrganizationAssetName', () => { + const result = client.matchAssetFromOrganizationAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationAssetSecurityMarks', () => { + const fakePath = "/rendered/path/organizationAssetSecurityMarks"; + const expectedParameters = { + organization: "organizationValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAssetSecurityMarksPath', () => { + const result = client.organizationAssetSecurityMarksPath("organizationValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationAssetSecurityMarksName', () => { + const result = client.matchOrganizationFromOrganizationAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromOrganizationAssetSecurityMarksName', () => { + const result = client.matchAssetFromOrganizationAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSettings', () => { + const fakePath = "/rendered/path/organizationSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSettingsPath', () => { + const result = client.organizationSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSettingsName', () => { + const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSource', () => { + const fakePath = "/rendered/path/organizationSource"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourcePath', () => { + const result = client.organizationSourcePath("organizationValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceName', () => { + const result = client.matchOrganizationFromOrganizationSourceName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceName', () => { + const result = client.matchSourceFromOrganizationSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSourceFinding', () => { + const fakePath = "/rendered/path/organizationSourceFinding"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourceFindingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourceFindingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourceFindingPath', () => { + const result = client.organizationSourceFindingPath("organizationValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceFindingName', () => { + const result = client.matchOrganizationFromOrganizationSourceFindingName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceFindingName', () => { + const result = client.matchSourceFromOrganizationSourceFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromOrganizationSourceFindingName', () => { + const result = client.matchFindingFromOrganizationSourceFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/organizationSourceFindingSecurityMarks"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourceFindingSecurityMarksPath', () => { + const result = client.organizationSourceFindingSecurityMarksPath("organizationValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchOrganizationFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAsset', () => { + const fakePath = "/rendered/path/projectAsset"; + const expectedParameters = { + project: "projectValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAssetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAssetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAssetPath', () => { + const result = client.projectAssetPath("projectValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAssetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAssetName', () => { + const result = client.matchProjectFromProjectAssetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromProjectAssetName', () => { + const result = client.matchAssetFromProjectAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAssetSecurityMarks', () => { + const fakePath = "/rendered/path/projectAssetSecurityMarks"; + const expectedParameters = { + project: "projectValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAssetSecurityMarksPath', () => { + const result = client.projectAssetSecurityMarksPath("projectValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAssetSecurityMarksName', () => { + const result = client.matchProjectFromProjectAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromProjectAssetSecurityMarksName', () => { + const result = client.matchAssetFromProjectAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSource', () => { + const fakePath = "/rendered/path/projectSource"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourcePath', () => { + const result = client.projectSourcePath("projectValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceName', () => { + const result = client.matchProjectFromProjectSourceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceName', () => { + const result = client.matchSourceFromProjectSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSourceFinding', () => { + const fakePath = "/rendered/path/projectSourceFinding"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourceFindingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourceFindingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourceFindingPath', () => { + const result = client.projectSourceFindingPath("projectValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourceFindingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceFindingName', () => { + const result = client.matchProjectFromProjectSourceFindingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceFindingName', () => { + const result = client.matchSourceFromProjectSourceFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromProjectSourceFindingName', () => { + const result = client.matchFindingFromProjectSourceFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/projectSourceFindingSecurityMarks"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourceFindingSecurityMarksPath', () => { + const result = client.projectSourceFindingSecurityMarksPath("projectValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceFindingSecurityMarksName', () => { + const result = client.matchProjectFromProjectSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromProjectSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromProjectSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromProjectSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 00000000..c78f1c88 --- /dev/null +++ b/owl-bot-staging/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 00000000..4aeca8bf --- /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: 'SecurityCenter', + filename: './security-center.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/v1beta1/.eslintignore b/owl-bot-staging/v1beta1/.eslintignore new file mode 100644 index 00000000..cfc348ec --- /dev/null +++ b/owl-bot-staging/v1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1beta1/.eslintrc.json b/owl-bot-staging/v1beta1/.eslintrc.json new file mode 100644 index 00000000..78215349 --- /dev/null +++ b/owl-bot-staging/v1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1beta1/.gitignore b/owl-bot-staging/v1beta1/.gitignore new file mode 100644 index 00000000..5d32b237 --- /dev/null +++ b/owl-bot-staging/v1beta1/.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/v1beta1/.jsdoc.js b/owl-bot-staging/v1beta1/.jsdoc.js new file mode 100644 index 00000000..e201160b --- /dev/null +++ b/owl-bot-staging/v1beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// 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. +// +// ** 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 2021 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/security-center', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1beta1/.mocharc.js b/owl-bot-staging/v1beta1/.mocharc.js new file mode 100644 index 00000000..50bc7f79 --- /dev/null +++ b/owl-bot-staging/v1beta1/.mocharc.js @@ -0,0 +1,33 @@ +// 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. +// +// ** 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/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js new file mode 100644 index 00000000..84f4713a --- /dev/null +++ b/owl-bot-staging/v1beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// 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. +// +// ** 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/v1beta1/README.md b/owl-bot-staging/v1beta1/README.md new file mode 100644 index 00000000..73f34764 --- /dev/null +++ b/owl-bot-staging/v1beta1/README.md @@ -0,0 +1 @@ +Securitycenter: Nodejs Client diff --git a/owl-bot-staging/v1beta1/linkinator.config.json b/owl-bot-staging/v1beta1/linkinator.config.json new file mode 100644 index 00000000..0121dfa6 --- /dev/null +++ b/owl-bot-staging/v1beta1/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 5 +} diff --git a/owl-bot-staging/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json new file mode 100644 index 00000000..b88a2160 --- /dev/null +++ b/owl-bot-staging/v1beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/security-center", + "version": "0.1.0", + "description": "Securitycenter client for Node.js", + "repository": "googleapis/nodejs-securitycenter", + "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 securitycenter", + "securitycenter", + "security center" + ], + "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": "^2.28.0" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^14.17.32", + "@types/sinon": "^10.0.6", + "c8": "^7.10.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^2.14.5", + "mocha": "^9.1.3", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.2", + "ts-loader": "^9.2.6", + "typescript": "^4.4.4", + "webpack": "^5.62.1", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto new file mode 100644 index 00000000..b73f7d5b --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto @@ -0,0 +1,93 @@ +// 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.securitycenter.v1beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1beta1/security_marks.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// Security Command Center representation of a Google Cloud +// resource. +// +// The Asset is a Security Command Center resource that captures information +// about a single Google Cloud resource. All modifications to an Asset are only +// within the context of Security Command Center and don't affect the referenced +// Google Cloud resource. +message Asset { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Asset" + pattern: "organizations/{organization}/assets/{asset}" + }; + + // Security Command Center managed properties. These properties are managed by + // Security Command Center and cannot be modified by the user. + message SecurityCenterProperties { + // Immutable. The full resource name of the Google Cloud resource this asset + // represents. This field is immutable after create time. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The type of the Google Cloud resource. Examples include: APPLICATION, + // PROJECT, and ORGANIZATION. This is a case insensitive field defined by + // Security Command Center and/or the producer of the resource and is + // immutable after create time. + string resource_type = 2; + + // The full resource name of the immediate parent of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_parent = 3; + + // The full resource name of the project the resource belongs to. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_project = 4; + + // Owners of the Google Cloud resource. + repeated string resource_owners = 5; + } + + // The relative resource name of this asset. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/assets/{asset_id}". + string name = 1; + + // Security Command Center managed properties. These properties are managed by + // Security Command Center and cannot be modified by the user. + SecurityCenterProperties security_center_properties = 2; + + // Resource managed properties. These properties are managed and defined by + // the Google Cloud resource and cannot be modified by the user. + map resource_properties = 7; + + // User specified security marks. These marks are entirely managed by the user + // and come from the SecurityMarks resource that belongs to the asset. + SecurityMarks security_marks = 8; + + // The time at which the asset was created in Security Command Center. + google.protobuf.Timestamp create_time = 9; + + // The time at which the asset was last updated, added, or deleted in Security + // Command Center. + google.protobuf.Timestamp update_time = 10; +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto new file mode 100644 index 00000000..647b3b43 --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.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.securitycenter.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1beta1/security_marks.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// Security Command Center finding. +// +// A finding is a record of assessment data (security, risk, health or privacy) +// ingested into Security Command Center for presentation, notification, +// analysis, policy testing, and enforcement. For example, an XSS vulnerability +// in an App Engine application is a finding. +message Finding { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Finding" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}" + }; + + // The state of the finding. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // The finding requires attention and has not been addressed yet. + ACTIVE = 1; + + // The finding has been fixed, triaged as a non-issue or otherwise addressed + // and is no longer active. + INACTIVE = 2; + } + + // The relative resource name of this finding. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}" + string name = 1; + + // Immutable. The relative resource name of the source the finding belongs to. + // See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // This field is immutable after creation time. + // For example: + // "organizations/{organization_id}/sources/{source_id}" + string parent = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // For findings on Google Cloud resources, the full resource + // name of the Google Cloud resource this finding is for. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + // When the finding is for a non-Google Cloud resource, the resourceName can + // be a customer or partner defined string. This field is immutable after + // creation time. + string resource_name = 3; + + // The state of the finding. + State state = 4; + + // The additional taxonomy group within findings from a given source. + // This field is immutable after creation time. + // Example: "XSS_FLASH_INJECTION" + string category = 5; + + // The URI that, if available, points to a web page outside of Security + // Command Center where additional information about the finding can be found. + // This field is guaranteed to be either empty or a well formed URL. + string external_uri = 6; + + // Source specific properties. These properties are managed by the source + // that writes the finding. The key names in the source_properties map must be + // between 1 and 255 characters, and must start with a letter and contain + // alphanumeric characters or underscores only. + map source_properties = 7; + + // Output only. User specified security marks. These marks are entirely + // managed by the user and come from the SecurityMarks resource that belongs + // to the finding. + SecurityMarks security_marks = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The time at which the event took place, or when an update to the finding + // occurred. For example, if the finding represents an open firewall it would + // capture the time the detector believes the firewall became open. The + // accuracy is determined by the detector. If the finding were to be resolved + // afterward, this time would reflect when the finding was resolved. + google.protobuf.Timestamp event_time = 9; + + // The time at which the finding was created in Security Command Center. + google.protobuf.Timestamp create_time = 10; +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto new file mode 100644 index 00000000..88b2008a --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto @@ -0,0 +1,79 @@ +// 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.securitycenter.v1beta1; + +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// User specified settings that are attached to the Security Command +// Center organization. +message OrganizationSettings { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/OrganizationSettings" + pattern: "organizations/{organization}/organizationSettings" + }; + + // The configuration used for Asset Discovery runs. + message AssetDiscoveryConfig { + // The mode of inclusion when running Asset Discovery. + // Asset discovery can be limited by explicitly identifying projects to be + // included or excluded. If INCLUDE_ONLY is set, then only those projects + // within the organization and their children are discovered during asset + // discovery. If EXCLUDE is set, then projects that don't match those + // projects are discovered during asset discovery. If neither are set, then + // all projects within the organization are discovered during asset + // discovery. + enum InclusionMode { + // Unspecified. Setting the mode with this value will disable + // inclusion/exclusion filtering for Asset Discovery. + INCLUSION_MODE_UNSPECIFIED = 0; + + // Asset Discovery will capture only the resources within the projects + // specified. All other resources will be ignored. + INCLUDE_ONLY = 1; + + // Asset Discovery will ignore all resources under the projects specified. + // All other resources will be retrieved. + EXCLUDE = 2; + } + + // The project ids to use for filtering asset discovery. + repeated string project_ids = 1; + + // The mode to use for filtering asset discovery. + InclusionMode inclusion_mode = 2; + } + + // The relative resource name of the settings. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/organizationSettings". + string name = 1; + + // A flag that indicates if Asset Discovery should be enabled. If the flag is + // set to `true`, then discovery of assets will occur. If it is set to `false, + // all historical assets will remain, but discovery of future assets will not + // occur. + bool enable_asset_discovery = 2; + + // The configuration used for Asset Discovery runs. + AssetDiscoveryConfig asset_discovery_config = 3; +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto new file mode 100644 index 00000000..20d3b25b --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto @@ -0,0 +1,49 @@ +// 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.securitycenter.v1beta1; + +import "google/protobuf/duration.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// Response of asset discovery run +message RunAssetDiscoveryResponse { + // The state of an asset discovery run. + enum State { + // Asset discovery run state was unspecified. + STATE_UNSPECIFIED = 0; + + // Asset discovery run completed successfully. + COMPLETED = 1; + + // Asset discovery run was cancelled with tasks still pending, as another + // run for the same organization was started with a higher priority. + SUPERSEDED = 2; + + // Asset discovery run was killed and terminated. + TERMINATED = 3; + } + + // The state of an asset discovery run. + State state = 1; + + // The duration between asset discovery run start and end + google.protobuf.Duration duration = 2; +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto new file mode 100644 index 00000000..2547c306 --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto @@ -0,0 +1,53 @@ +// 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.securitycenter.v1beta1; + +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// User specified security marks that are attached to the parent Security +// Command Center resource. Security marks are scoped within a Security Command +// Center organization -- they can be modified and viewed by all users who have +// proper permissions on the organization. +message SecurityMarks { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/SecurityMarks" + pattern: "organizations/{organization}/assets/{asset}/securityMarks" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}/securityMarks" + }; + + // The relative resource name of the SecurityMarks. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Examples: + // "organizations/{organization_id}/assets/{asset_id}/securityMarks" + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks". + string name = 1; + + // Mutable user specified security marks belonging to the parent resource. + // Constraints are as follows: + // + // * Keys and values are treated as case insensitive + // * Keys must be between 1 - 256 characters (inclusive) + // * Keys must be letters, numbers, underscores, or dashes + // * Values have leading and trailing whitespace trimmed, remaining + // characters must be between 1 - 4096 characters (inclusive) + map marks = 2; +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto new file mode 100644 index 00000000..351c1f4a --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto @@ -0,0 +1,824 @@ +// 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.securitycenter.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1beta1/asset.proto"; +import "google/cloud/securitycenter/v1beta1/finding.proto"; +import "google/cloud/securitycenter/v1beta1/organization_settings.proto"; +import "google/cloud/securitycenter/v1beta1/security_marks.proto"; +import "google/cloud/securitycenter/v1beta1/source.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// V1 Beta APIs for Security Center service. +service SecurityCenter { + option (google.api.default_host) = "securitycenter.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a source. + rpc CreateSource(CreateSourceRequest) returns (Source) { + option (google.api.http) = { + post: "/v1beta1/{parent=organizations/*}/sources" + body: "source" + }; + option (google.api.method_signature) = "parent,source"; + } + + // Creates a finding. The corresponding source must exist for finding creation + // to succeed. + rpc CreateFinding(CreateFindingRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1beta1/{parent=organizations/*/sources/*}/findings" + body: "finding" + }; + option (google.api.method_signature) = "parent,finding_id,finding"; + } + + // Gets the access control policy on the specified Source. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1beta1/{resource=organizations/*/sources/*}:getIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource"; + } + + // Gets the settings for an organization. + rpc GetOrganizationSettings(GetOrganizationSettingsRequest) returns (OrganizationSettings) { + option (google.api.http) = { + get: "/v1beta1/{name=organizations/*/organizationSettings}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a source. + rpc GetSource(GetSourceRequest) returns (Source) { + option (google.api.http) = { + get: "/v1beta1/{name=organizations/*/sources/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Filters an organization's assets and groups them by their specified + // properties. + rpc GroupAssets(GroupAssetsRequest) returns (GroupAssetsResponse) { + option (google.api.http) = { + post: "/v1beta1/{parent=organizations/*}/assets:group" + body: "*" + }; + } + + // Filters an organization or source's findings and groups them by their + // specified properties. + // + // To group across all sources provide a `-` as the source id. + // Example: /v1beta1/organizations/{organization_id}/sources/-/findings + rpc GroupFindings(GroupFindingsRequest) returns (GroupFindingsResponse) { + option (google.api.http) = { + post: "/v1beta1/{parent=organizations/*/sources/*}/findings:group" + body: "*" + }; + option (google.api.method_signature) = "parent,group_by"; + } + + // Lists an organization's assets. + rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=organizations/*}/assets" + }; + } + + // Lists an organization or source's findings. + // + // To list across all sources provide a `-` as the source id. + // Example: /v1beta1/organizations/{organization_id}/sources/-/findings + rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=organizations/*/sources/*}/findings" + }; + } + + // Lists all sources belonging to an organization. + rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=organizations/*}/sources" + }; + option (google.api.method_signature) = "parent"; + } + + // Runs asset discovery. The discovery is tracked with a long-running + // operation. + // + // This API can only be called with limited frequency for an organization. If + // it is called too frequently the caller will receive a TOO_MANY_REQUESTS + // error. + rpc RunAssetDiscovery(RunAssetDiscoveryRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=organizations/*}/assets:runDiscovery" + body: "*" + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Empty" + }; + } + + // Updates the state of a finding. + rpc SetFindingState(SetFindingStateRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1beta1/{name=organizations/*/sources/*/findings/*}:setState" + body: "*" + }; + option (google.api.method_signature) = "name,state,start_time"; + } + + // Sets the access control policy on the specified Source. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1beta1/{resource=organizations/*/sources/*}:setIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Returns the permissions that a caller has on the specified source. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1beta1/{resource=organizations/*/sources/*}:testIamPermissions" + body: "*" + }; + option (google.api.method_signature) = "resource,permissions"; + } + + // Creates or updates a finding. The corresponding source must exist for a + // finding creation to succeed. + rpc UpdateFinding(UpdateFindingRequest) returns (Finding) { + option (google.api.http) = { + patch: "/v1beta1/{finding.name=organizations/*/sources/*/findings/*}" + body: "finding" + }; + option (google.api.method_signature) = "finding"; + } + + // Updates an organization's settings. + rpc UpdateOrganizationSettings(UpdateOrganizationSettingsRequest) returns (OrganizationSettings) { + option (google.api.http) = { + patch: "/v1beta1/{organization_settings.name=organizations/*/organizationSettings}" + body: "organization_settings" + }; + option (google.api.method_signature) = "organization_settings"; + } + + // Updates a source. + rpc UpdateSource(UpdateSourceRequest) returns (Source) { + option (google.api.http) = { + patch: "/v1beta1/{source.name=organizations/*/sources/*}" + body: "source" + }; + option (google.api.method_signature) = "source"; + } + + // Updates security marks. + rpc UpdateSecurityMarks(UpdateSecurityMarksRequest) returns (SecurityMarks) { + option (google.api.http) = { + patch: "/v1beta1/{security_marks.name=organizations/*/assets/*/securityMarks}" + body: "security_marks" + additional_bindings { + patch: "/v1beta1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + }; + option (google.api.method_signature) = "security_marks"; + } +} + +// Request message for creating a finding. +message CreateFindingRequest { + // Required. Resource name of the new finding's parent. Its format should be + // "organizations/[organization_id]/sources/[source_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Required. Unique identifier provided by the client within the parent scope. + // It must be alphanumeric and less than or equal to 32 characters and + // greater than 0 characters in length. + string finding_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Finding being created. The name and security_marks will be ignored as + // they are both output only fields on this resource. + Finding finding = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for creating a source. +message CreateSourceRequest { + // Required. Resource name of the new source's parent. Its format should be + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Required. The Source being created, only the display_name and description will be + // used. All other fields will be ignored. + Source source = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for getting organization settings. +message GetOrganizationSettingsRequest { + // Required. Name of the organization to get organization settings for. Its format is + // "organizations/[organization_id]/organizationSettings". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/OrganizationSettings" + } + ]; +} + +// Request message for getting a source. +message GetSourceRequest { + // Required. Relative resource name of the source. Its format is + // "organizations/[organization_id]/source/[source_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; +} + +// Request message for grouping by assets. +message GroupAssetsRequest { + // Required. Name of the organization to groupBy. Its format is + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Expression that defines the filter to apply across assets. + // The expression is a list of zero or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are not supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. The fields map to those + // defined in the Asset resource. Examples include: + // + // * name + // * security_center_properties.resource_name + // * resource_properties.a_property + // * security_marks.marks.marka + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + // + // For example, `resource_properties.size = 100` is a valid filter string. + string filter = 2; + + // Required. Expression that defines what assets fields to use for grouping. The string + // value should follow SQL syntax: comma separated list of fields. For + // example: + // "security_center_properties.resource_project,security_center_properties.project". + // + // The following fields are supported when compare_duration is not set: + // + // * security_center_properties.resource_project + // * security_center_properties.resource_type + // * security_center_properties.resource_parent + // + // The following fields are supported when compare_duration is set: + // + // * security_center_properties.resource_type + string group_by = 3 [(google.api.field_behavior) = REQUIRED]; + + // When compare_duration is set, the Asset's "state" property is updated to + // indicate whether the asset was added, removed, or remained present during + // the compare_duration period of time that precedes the read_time. This is + // the time between (read_time - compare_duration) and read_time. + // + // The state value is derived based on the presence of the asset at the two + // points in time. Intermediate state changes between the two times don't + // affect the result. For example, the results aren't affected if the asset is + // removed and re-created again. + // + // Possible "state" values when compare_duration is specified: + // + // * "ADDED": indicates that the asset was not present before + // compare_duration, but present at reference_time. + // * "REMOVED": indicates that the asset was present at the start of + // compare_duration, but not present at reference_time. + // * "ACTIVE": indicates that the asset was present at both the + // start and the end of the time period defined by + // compare_duration and reference_time. + // + // This field is ignored if `state` is not a field in `group_by`. + google.protobuf.Duration compare_duration = 4; + + // Time used as a reference point when filtering assets. The filter is limited + // to assets existing at the supplied time and their values are those at that + // specific time. Absence of this field will default to the API's version of + // NOW. + google.protobuf.Timestamp read_time = 5; + + // The value returned by the last `GroupAssetsResponse`; indicates + // that this is a continuation of a prior `GroupAssets` call, and that the + // system should return the next page of data. + string page_token = 7; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 8; +} + +// Response message for grouping by assets. +message GroupAssetsResponse { + // Group results. There exists an element for each existing unique + // combination of property/values. The element contains a count for the number + // of times those specific property/values appear. + repeated GroupResult group_by_results = 1; + + // Time used for executing the groupBy request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; +} + +// Request message for grouping by findings. +message GroupFindingsRequest { + // Required. Name of the source to groupBy. Its format is + // "organizations/[organization_id]/sources/[source_id]". To groupBy across + // all sources provide a source_id of `-`. For example: + // organizations/{organization_id}/sources/- + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Expression that defines the filter to apply across findings. + // The expression is a list of one or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are not supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. Examples include: + // + // * name + // * source_properties.a_property + // * security_marks.marks.marka + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + // + // For example, `source_properties.size = 100` is a valid filter string. + string filter = 2; + + // Required. Expression that defines what assets fields to use for grouping (including + // `state`). The string value should follow SQL syntax: comma separated list + // of fields. For example: + // "parent,resource_name". + // + // The following fields are supported: + // + // * resource_name + // * category + // * state + // * parent + string group_by = 3 [(google.api.field_behavior) = REQUIRED]; + + // Time used as a reference point when filtering findings. The filter is + // limited to findings existing at the supplied time and their values are + // those at that specific time. Absence of this field will default to the + // API's version of NOW. + google.protobuf.Timestamp read_time = 4; + + // The value returned by the last `GroupFindingsResponse`; indicates + // that this is a continuation of a prior `GroupFindings` call, and + // that the system should return the next page of data. + string page_token = 5; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 6; +} + +// Response message for group by findings. +message GroupFindingsResponse { + // Group results. There exists an element for each existing unique + // combination of property/values. The element contains a count for the number + // of times those specific property/values appear. + repeated GroupResult group_by_results = 1; + + // Time used for executing the groupBy request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; +} + +// Result containing the properties and count of a groupBy request. +message GroupResult { + // Properties matching the groupBy fields in the request. + map properties = 1; + + // Total count of resources for the given properties. + int64 count = 2; +} + +// Request message for listing sources. +message ListSourcesRequest { + // Required. Resource name of the parent of sources to list. Its format should be + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // The value returned by the last `ListSourcesResponse`; indicates + // that this is a continuation of a prior `ListSources` call, and + // that the system should return the next page of data. + string page_token = 2; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 7; +} + +// Response message for listing sources. +message ListSourcesResponse { + // Sources belonging to the requested parent. + repeated Source sources = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 2; +} + +// Request message for listing assets. +message ListAssetsRequest { + // Required. Name of the organization assets should belong to. Its format is + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Expression that defines the filter to apply across assets. + // The expression is a list of zero or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are not supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. The fields map to those + // defined in the Asset resource. Examples include: + // + // * name + // * security_center_properties.resource_name + // * resource_properties.a_property + // * security_marks.marks.marka + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + // + // For example, `resource_properties.size = 100` is a valid filter string. + string filter = 2; + + // Expression that defines what fields and order to use for sorting. The + // string value should follow SQL syntax: comma separated list of fields. For + // example: "name,resource_properties.a_property". The default sorting order + // is ascending. To specify descending order for a field, a suffix " desc" + // should be appended to the field name. For example: "name + // desc,resource_properties.a_property". Redundant space characters in the + // syntax are insignificant. "name desc,resource_properties.a_property" and " + // name desc , resource_properties.a_property " are equivalent. + string order_by = 3; + + // Time used as a reference point when filtering assets. The filter is limited + // to assets existing at the supplied time and their values are those at that + // specific time. Absence of this field will default to the API's version of + // NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the ListAssetResult's "state" attribute is + // updated to indicate whether the asset was added, removed, or remained + // present during the compare_duration period of time that precedes the + // read_time. This is the time between (read_time - + // compare_duration) and read_time. + // + // The state value is derived based on the presence of the asset at the two + // points in time. Intermediate state changes between the two times don't + // affect the result. For example, the results aren't affected if the asset is + // removed and re-created again. + // + // Possible "state" values when compare_duration is specified: + // + // * "ADDED": indicates that the asset was not present before + // compare_duration, but present at read_time. + // * "REMOVED": indicates that the asset was present at the start of + // compare_duration, but not present at read_time. + // * "ACTIVE": indicates that the asset was present at both the + // start and the end of the time period defined by + // compare_duration and read_time. + // + // If compare_duration is not specified, then the only possible state is + // "UNUSED", which indicates that the asset is present at read_time. + google.protobuf.Duration compare_duration = 5; + + // Optional. A field mask to specify the ListAssetsResult fields to be listed in the + // response. + // An empty field mask will list all fields. + google.protobuf.FieldMask field_mask = 7 [(google.api.field_behavior) = OPTIONAL]; + + // The value returned by the last `ListAssetsResponse`; indicates + // that this is a continuation of a prior `ListAssets` call, and + // that the system should return the next page of data. + string page_token = 8; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 9; +} + +// Response message for listing assets. +message ListAssetsResponse { + // Result containing the Asset and its State. + message ListAssetsResult { + // State of the asset. + // + // When querying across two points in time this describes + // the change between the two points: ADDED, REMOVED, or ACTIVE. + // If there was no compare_duration supplied in the request the state should + // be: UNUSED + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // Request did not specify use of this field in the result. + UNUSED = 1; + + // Asset was added between the points in time. + ADDED = 2; + + // Asset was removed between the points in time. + REMOVED = 3; + + // Asset was active at both point(s) in time. + ACTIVE = 4; + } + + // Asset matching the search request. + Asset asset = 1; + + // State of the asset. + State state = 2; + } + + // Assets matching the list request. + repeated ListAssetsResult list_assets_results = 1; + + // Time used for executing the list request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of assets matching the query. + int32 total_size = 4; +} + +// Request message for listing findings. +message ListFindingsRequest { + // Required. Name of the source the findings belong to. Its format is + // "organizations/[organization_id]/sources/[source_id]". To list across all + // sources provide a source_id of `-`. For example: + // organizations/{organization_id}/sources/- + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Expression that defines the filter to apply across findings. + // The expression is a list of one or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are not supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. Examples include: + // + // * name + // * source_properties.a_property + // * security_marks.marks.marka + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + // + // For example, `source_properties.size = 100` is a valid filter string. + string filter = 2; + + // Expression that defines what fields and order to use for sorting. The + // string value should follow SQL syntax: comma separated list of fields. For + // example: "name,resource_properties.a_property". The default sorting order + // is ascending. To specify descending order for a field, a suffix " desc" + // should be appended to the field name. For example: "name + // desc,source_properties.a_property". Redundant space characters in the + // syntax are insignificant. "name desc,source_properties.a_property" and " + // name desc , source_properties.a_property " are equivalent. + string order_by = 3; + + // Time used as a reference point when filtering findings. The filter is + // limited to findings existing at the supplied time and their values are + // those at that specific time. Absence of this field will default to the + // API's version of NOW. + google.protobuf.Timestamp read_time = 4; + + // Optional. A field mask to specify the Finding fields to be listed in the response. + // An empty field mask will list all fields. + google.protobuf.FieldMask field_mask = 5 [(google.api.field_behavior) = OPTIONAL]; + + // The value returned by the last `ListFindingsResponse`; indicates + // that this is a continuation of a prior `ListFindings` call, and + // that the system should return the next page of data. + string page_token = 6; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 7; +} + +// Response message for listing findings. +message ListFindingsResponse { + // Findings matching the list request. + repeated Finding findings = 1; + + // Time used for executing the list request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of findings matching the query. + int32 total_size = 4; +} + +// Request message for updating a finding's state. +message SetFindingStateRequest { + // Required. The relative resource name of the finding. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Finding" + } + ]; + + // Required. The desired State of the finding. + Finding.State state = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The time at which the updated state takes effect. + google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for running asset discovery for an organization. +message RunAssetDiscoveryRequest { + // Required. Name of the organization to run asset discovery for. Its format is + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; +} + +// Request message for updating or creating a finding. +message UpdateFindingRequest { + // Required. The finding resource to update or create if it does not already exist. + // parent, security_marks, and update_time will be ignored. + // + // In the case of creation, the finding id portion of the name must + // alphanumeric and less than or equal to 32 characters and greater than 0 + // characters in length. + Finding finding = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the finding resource. This field should + // not be specified when creating a finding. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating an organization's settings. +message UpdateOrganizationSettingsRequest { + // Required. The organization settings resource to update. + OrganizationSettings organization_settings = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the settings resource. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a source. +message UpdateSourceRequest { + // Required. The source resource to update. + Source source = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the source resource. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a SecurityMarks resource. +message UpdateSecurityMarksRequest { + // Required. The security marks resource to update. + SecurityMarks security_marks = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the security marks resource. + google.protobuf.FieldMask update_mask = 2; + + // The time at which the updated SecurityMarks take effect. + google.protobuf.Timestamp start_time = 3; +} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto new file mode 100644 index 00000000..fb1e6c6a --- /dev/null +++ b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto @@ -0,0 +1,56 @@ +// 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.securitycenter.v1beta1; + +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1beta1"; + +// Security Command Center finding source. A finding source +// is an entity or a mechanism that can produce a finding. A source is like a +// container of findings that come from the same scanner, logger, monitor, etc. +message Source { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Source" + pattern: "organizations/{organization}/sources/{source}" + }; + + // The relative resource name of this source. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}" + string name = 1; + + // The source's display name. + // A source's display name must be unique amongst its siblings, for example, + // two sources with the same parent can't share the same display name. + // The display name must have a length between 1 and 64 characters + // (inclusive). + string display_name = 2; + + // The description of the source (max of 1024 characters). + // Example: + // "Web Security Scanner is a web security scanner for common + // vulnerabilities in App Engine applications. It can automatically + // scan and detect four common vulnerabilities, including cross-site-scripting + // (XSS), Flash injection, mixed content (HTTP in HTTPS), and + // outdated/insecure libraries." + string description = 3; +} diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_finding.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_finding.js new file mode 100644 index 00000000..90289ca8 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_finding.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, findingId, finding) { + // [START securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + */ + // const parent = 'abc123' + /** + * Required. Unique identifier provided by the client within the parent scope. + * It must be alphanumeric and less than or equal to 32 characters and + * greater than 0 characters in length. + */ + // const findingId = 'abc123' + /** + * Required. The Finding being created. The name and security_marks will be ignored as + * they are both output only fields on this resource. + */ + // const finding = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateFinding() { + // Construct request + const request = { + parent, + findingId, + finding, + }; + + // Run request + const response = await securitycenterClient.createFinding(request); + console.log(response); + } + + callCreateFinding(); + // [END securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_source.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_source.js new file mode 100644 index 00000000..9342a0f9 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_source.js @@ -0,0 +1,60 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, source) { + // [START securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * Required. The Source being created, only the display_name and description will be + * used. All other fields will be ignored. + */ + // const source = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateSource() { + // Construct request + const request = { + parent, + source, + }; + + // Run request + const response = await securitycenterClient.createSource(request); + console.log(response); + } + + callCreateSource(); + // [END securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js new file mode 100644 index 00000000..9bdfa2c4 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js @@ -0,0 +1,59 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(resource) { + // [START securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + */ + // const options = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await securitycenterClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js new file mode 100644 index 00000000..7862db8d --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to get organization settings for. Its format is + * "organizations/[organization_id]/organizationSettings". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetOrganizationSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getOrganizationSettings(request); + console.log(response); + } + + callGetOrganizationSettings(); + // [END securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_source.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_source.js new file mode 100644 index 00000000..47f895c3 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_source.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START securitycenter_v1beta1_generated_SecurityCenter_GetSource_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetSource() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getSource(request); + console.log(response); + } + + callGetSource(); + // [END securitycenter_v1beta1_generated_SecurityCenter_GetSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_assets.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_assets.js new file mode 100644 index 00000000..59edb045 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_assets.js @@ -0,0 +1,131 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, groupBy) { + // [START securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * The supported operators are: + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * The supported value types are: + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * For example, `resource_properties.size = 100` is a valid filter string. + */ + // const filter = 'abc123' + /** + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * The following fields are supported when compare_duration is not set: + * * security_center_properties.resource_project + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * The following fields are supported when compare_duration is set: + * * security_center_properties.resource_type + */ + // const groupBy = 'abc123' + /** + * When compare_duration is set, the Asset's "state" property is updated to + * indicate whether the asset was added, removed, or remained present during + * the compare_duration period of time that precedes the read_time. This is + * the time between (read_time - compare_duration) and read_time. + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * Possible "state" values when compare_duration is specified: + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * This field is ignored if `state` is not a field in `group_by`. + */ + // const compareDuration = {} + /** + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + */ + // const readTime = {} + /** + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGroupAssets() { + // Construct request + const request = { + parent, + groupBy, + }; + + // Run request + const iterable = await securitycenterClient.groupAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGroupAssets(); + // [END securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_findings.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_findings.js new file mode 100644 index 00000000..4818c6cd --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_findings.js @@ -0,0 +1,110 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, groupBy) { + // [START securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]". To groupBy across + * all sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * The supported operators are: + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * The supported value types are: + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * For example, `source_properties.size = 100` is a valid filter string. + */ + // const filter = 'abc123' + /** + * Required. Expression that defines what assets fields to use for grouping (including + * `state`). The string value should follow SQL syntax: comma separated list + * of fields. For example: + * "parent,resource_name". + * The following fields are supported: + * * resource_name + * * category + * * state + * * parent + */ + // const groupBy = 'abc123' + /** + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + */ + // const readTime = {} + /** + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGroupFindings() { + // Construct request + const request = { + parent, + groupBy, + }; + + // Run request + const iterable = await securitycenterClient.groupFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGroupFindings(); + // [END securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_assets.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_assets.js new file mode 100644 index 00000000..dcfd98b9 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_assets.js @@ -0,0 +1,136 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * The supported operators are: + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * The supported value types are: + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * For example, `resource_properties.size = 100` is a valid filter string. + */ + // const filter = 'abc123' + /** + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + */ + // const orderBy = 'abc123' + /** + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the ListAssetResult's "state" attribute is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - + * compare_duration) and read_time. + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * Possible "state" values when compare_duration is specified: + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * If compare_duration is not specified, then the only possible state is + * "UNUSED", which indicates that the asset is present at read_time. + */ + // const compareDuration = {} + /** + * Optional. A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + */ + // const fieldMask = {} + /** + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListAssets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAssets(); + // [END securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_findings.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_findings.js new file mode 100644 index 00000000..b1212693 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_findings.js @@ -0,0 +1,113 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id]". To list across all + * sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * The supported operators are: + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * The supported value types are: + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * For example, `source_properties.size = 100` is a valid filter string. + */ + // const filter = 'abc123' + /** + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + */ + // const orderBy = 'abc123' + /** + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + */ + // const readTime = {} + /** + * Optional. A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + */ + // const fieldMask = {} + /** + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListFindings() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFindings(); + // [END securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_sources.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_sources.js new file mode 100644 index 00000000..e3722e67 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_sources.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1beta1_generated_SecurityCenter_ListSources_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListSources() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listSourcesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSources(); + // [END securitycenter_v1beta1_generated_SecurityCenter_ListSources_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js new file mode 100644 index 00000000..beed664c --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to run asset discovery for. Its format is + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callRunAssetDiscovery() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await securitycenterClient.runAssetDiscovery(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRunAssetDiscovery(); + // [END securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js new file mode 100644 index 00000000..db0cea43 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name, state, startTime) { + // [START securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the finding. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + */ + // const name = 'abc123' + /** + * Required. The desired State of the finding. + */ + // const state = {} + /** + * Required. The time at which the updated state takes effect. + */ + // const startTime = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetFindingState() { + // Construct request + const request = { + name, + state, + startTime, + }; + + // Run request + const response = await securitycenterClient.setFindingState(request); + console.log(response); + } + + callSetFindingState(); + // [END securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js new file mode 100644 index 00000000..458ee483 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(resource, policy) { + // [START securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + */ + // const policy = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await securitycenterClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js new file mode 100644 index 00000000..fbb5ee1f --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(resource, permissions) { + // [START securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). + */ + // const permissions = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await securitycenterClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_finding.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_finding.js new file mode 100644 index 00000000..5f0e87ad --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_finding.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(finding) { + // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The finding resource to update or create if it does not already exist. + * parent, security_marks, and update_time will be ignored. + * In the case of creation, the finding id portion of the name must + * alphanumeric and less than or equal to 32 characters and greater than 0 + * characters in length. + */ + // const finding = {} + /** + * The FieldMask to use when updating the finding resource. This field should + * not be specified when creating a finding. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateFinding() { + // Construct request + const request = { + finding, + }; + + // Run request + const response = await securitycenterClient.updateFinding(request); + console.log(response); + } + + callUpdateFinding(); + // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js new file mode 100644 index 00000000..6519c222 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(organizationSettings) { + // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The organization settings resource to update. + */ + // const organizationSettings = {} + /** + * The FieldMask to use when updating the settings resource. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateOrganizationSettings() { + // Construct request + const request = { + organizationSettings, + }; + + // Run request + const response = await securitycenterClient.updateOrganizationSettings(request); + console.log(response); + } + + callUpdateOrganizationSettings(); + // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js new file mode 100644 index 00000000..366bfa38 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js @@ -0,0 +1,61 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(securityMarks) { + // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The security marks resource to update. + */ + // const securityMarks = {} + /** + * The FieldMask to use when updating the security marks resource. + */ + // const updateMask = {} + /** + * The time at which the updated SecurityMarks take effect. + */ + // const startTime = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateSecurityMarks() { + // Construct request + const request = { + securityMarks, + }; + + // Run request + const response = await securitycenterClient.updateSecurityMarks(request); + console.log(response); + } + + callUpdateSecurityMarks(); + // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_source.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_source.js new file mode 100644 index 00000000..cba6870c --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_source.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(source) { + // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The source resource to update. + */ + // const source = {} + /** + * The FieldMask to use when updating the source resource. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateSource() { + // Construct request + const request = { + source, + }; + + // Run request + const response = await securitycenterClient.updateSource(request); + console.log(response); + } + + callUpdateSource(); + // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts new file mode 100644 index 00000000..0cb6dc5e --- /dev/null +++ b/owl-bot-staging/v1beta1/src/index.ts @@ -0,0 +1,25 @@ +// 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. +// +// ** 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 v1beta1 from './v1beta1'; +const SecurityCenterClient = v1beta1.SecurityCenterClient; +type SecurityCenterClient = v1beta1.SecurityCenterClient; +export {v1beta1, SecurityCenterClient}; +export default {v1beta1, SecurityCenterClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json new file mode 100644 index 00000000..02da4303 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json @@ -0,0 +1,223 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.securitycenter.v1beta1", + "libraryPackage": "@google-cloud/security-center", + "services": { + "SecurityCenter": { + "clients": { + "grpc": { + "libraryClient": "SecurityCenterClient", + "rpcs": { + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "CreateFinding": { + "methods": [ + "createFinding" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SecurityCenterClient", + "rpcs": { + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "CreateFinding": { + "methods": [ + "createFinding" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/v1beta1/src/v1beta1/index.ts new file mode 100644 index 00000000..de26020d --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/index.ts @@ -0,0 +1,19 @@ +// 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. +// +// ** 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 {SecurityCenterClient} from './security_center_client'; diff --git a/owl-bot-staging/v1beta1/src/v1beta1/security_center_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/security_center_client.ts new file mode 100644 index 00000000..f6bfb08c --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/security_center_client.ts @@ -0,0 +1,3248 @@ +// 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. +// +// ** 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, LROperation, 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/v1beta1/security_center_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './security_center_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * V1 Beta APIs for Security Center service. + * @class + * @memberof v1beta1 + */ +export class SecurityCenterClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + securityCenterStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SecurityCenterClient. + * + * @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). + * 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} [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. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SecurityCenterClient; + 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 = { + assetPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/assets/{asset}' + ), + findingPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}' + ), + organizationPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}' + ), + organizationAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/assets/{asset}/securityMarks' + ), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/organizationSettings' + ), + organizationSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' + ), + sourcePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}' + ), + }; + + // 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 = { + groupAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), + groupFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), + listAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listAssetsResults'), + listFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings'), + listSources: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const runAssetDiscoveryResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const runAssetDiscoveryMetadata = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + + this.descriptors.longrunning = { + runAssetDiscovery: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), + runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.securitycenter.v1beta1.SecurityCenter', 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.securityCenterStub) { + return this.securityCenterStub; + } + + // Put together the "service stub" for + // google.cloud.securitycenter.v1beta1.SecurityCenter. + this.securityCenterStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.securitycenter.v1beta1.SecurityCenter') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.securitycenter.v1beta1.SecurityCenter, + 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 securityCenterStubMethods = + ['createSource', 'createFinding', 'getIamPolicy', 'getOrganizationSettings', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listFindings', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setIamPolicy', 'testIamPermissions', 'updateFinding', 'updateOrganizationSettings', 'updateSource', 'updateSecurityMarks']; + for (const methodName of securityCenterStubMethods) { + const callPromise = this.securityCenterStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.securityCenterStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'securitycenter.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 'securitycenter.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 source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + * @param {google.cloud.securitycenter.v1beta1.Source} request.source + * Required. The Source being created, only the display_name and description will be + * used. All other fields will be ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Source]{@link google.cloud.securitycenter.v1beta1.Source}. + * 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/v1beta1/security_center.create_source.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async + */ + createSource( + request?: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|undefined, {}|undefined + ]>; + createSource( + request: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): void; + createSource( + request: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): void; + createSource( + request?: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|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.createSource(request, options, callback); + } +/** + * Creates a finding. The corresponding source must exist for finding creation + * to succeed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + * @param {string} request.findingId + * Required. Unique identifier provided by the client within the parent scope. + * It must be alphanumeric and less than or equal to 32 characters and + * greater than 0 characters in length. + * @param {google.cloud.securitycenter.v1beta1.Finding} request.finding + * Required. The Finding being created. The name and security_marks will be ignored as + * they are both output only fields on this resource. + * @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.securitycenter.v1beta1.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/v1beta1/security_center.create_finding.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async + */ + createFinding( + request?: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|undefined, {}|undefined + ]>; + createFinding( + request: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): void; + createFinding( + request: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): void; + createFinding( + request?: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|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.createFinding(request, options, callback); + } +/** + * Gets the access control policy on the specified Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * @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 [Policy]{@link google.iam.v1.Policy}. + * 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/v1beta1/security_center.get_iam_policy.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async + */ + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|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({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } +/** + * Gets the settings for an organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the organization to get organization settings for. Its format is + * "organizations/[organization_id]/organizationSettings". + * @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 [OrganizationSettings]{@link google.cloud.securitycenter.v1beta1.OrganizationSettings}. + * 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/v1beta1/security_center.get_organization_settings.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async + */ + getOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|undefined, {}|undefined + ]>; + getOrganizationSettings( + request: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + getOrganizationSettings( + request: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + getOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|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.getOrganizationSettings(request, options, callback); + } +/** + * Gets a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Source]{@link google.cloud.securitycenter.v1beta1.Source}. + * 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/v1beta1/security_center.get_source.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GetSource_async + */ + getSource( + request?: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|undefined, {}|undefined + ]>; + getSource( + request: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request?: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|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.getSource(request, options, callback); + } +/** + * Updates the state of a finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the finding. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + * @param {google.cloud.securitycenter.v1beta1.Finding.State} request.state + * Required. The desired State of the finding. + * @param {google.protobuf.Timestamp} request.startTime + * Required. The time at which the updated state takes effect. + * @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.securitycenter.v1beta1.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/v1beta1/security_center.set_finding_state.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async + */ + setFindingState( + request?: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|undefined, {}|undefined + ]>; + setFindingState( + request: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): void; + setFindingState( + request: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): void; + setFindingState( + request?: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|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.setFindingState(request, options, callback); + } +/** + * Sets the access control policy on the specified Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @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 [Policy]{@link google.iam.v1.Policy}. + * 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/v1beta1/security_center.set_iam_policy.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async + */ + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|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({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.setIamPolicy(request, options, callback); + } +/** + * Returns the permissions that a caller has on the specified source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * 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/v1beta1/security_center.test_iam_permissions.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async + */ + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|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({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.testIamPermissions(request, options, callback); + } +/** + * Creates or updates a finding. The corresponding source must exist for a + * finding creation to succeed. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1beta1.Finding} request.finding + * Required. The finding resource to update or create if it does not already exist. + * parent, security_marks, and update_time will be ignored. + * + * In the case of creation, the finding id portion of the name must + * alphanumeric and less than or equal to 32 characters and greater than 0 + * characters in length. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the finding resource. This field should + * not be specified when creating a finding. + * @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.securitycenter.v1beta1.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/v1beta1/security_center.update_finding.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async + */ + updateFinding( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|undefined, {}|undefined + ]>; + updateFinding( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): void; + updateFinding( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): void; + updateFinding( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding, + protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|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({ + 'finding.name': request.finding!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateFinding(request, options, callback); + } +/** + * Updates an organization's settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1beta1.OrganizationSettings} request.organizationSettings + * Required. The organization settings resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the settings resource. + * @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 [OrganizationSettings]{@link google.cloud.securitycenter.v1beta1.OrganizationSettings}. + * 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/v1beta1/security_center.update_organization_settings.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async + */ + updateOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined + ]>; + updateOrganizationSettings( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateOrganizationSettings( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|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({ + 'organization_settings.name': request.organizationSettings!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateOrganizationSettings(request, options, callback); + } +/** + * Updates a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1beta1.Source} request.source + * Required. The source resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the source resource. + * @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 [Source]{@link google.cloud.securitycenter.v1beta1.Source}. + * 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/v1beta1/security_center.update_source.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async + */ + updateSource( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|undefined, {}|undefined + ]>; + updateSource( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): void; + updateSource( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): void; + updateSource( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource, + protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|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({ + 'source.name': request.source!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSource(request, options, callback); + } +/** + * Updates security marks. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1beta1.SecurityMarks} request.securityMarks + * Required. The security marks resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the security marks resource. + * @param {google.protobuf.Timestamp} request.startTime + * The time at which the updated SecurityMarks take effect. + * @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 [SecurityMarks]{@link google.cloud.securitycenter.v1beta1.SecurityMarks}. + * 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/v1beta1/security_center.update_security_marks.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async + */ + updateSecurityMarks( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|undefined, {}|undefined + ]>; + updateSecurityMarks( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityMarks( + request: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityMarks( + request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|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({ + 'security_marks.name': request.securityMarks!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSecurityMarks(request, options, callback); + } + +/** + * Runs asset discovery. The discovery is tracked with a long-running + * operation. + * + * This API can only be called with limited frequency for an organization. If + * it is called too frequently the caller will receive a TOO_MANY_REQUESTS + * error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to run asset discovery for. Its format is + * "organizations/[organization_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.run_asset_discovery.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async + */ + runAssetDiscovery( + request?: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runAssetDiscovery( + request: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runAssetDiscovery( + request: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runAssetDiscovery( + request?: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.runAssetDiscovery(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runAssetDiscovery()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta1/security_center.run_asset_discovery.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async + */ + async checkRunAssetDiscoveryProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.runAssetDiscovery, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Filters an organization's assets and groups them by their specified + * properties. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * For example, `resource_properties.size = 100` is a valid filter string. + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the Asset's "state" property is updated to + * indicate whether the asset was added, removed, or remained present during + * the compare_duration period of time that precedes the read_time. This is + * the time between (read_time - compare_duration) and read_time. + * + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * This field is ignored if `state` is not a field in `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [GroupResult]{@link google.cloud.securitycenter.v1beta1.GroupResult}. + * 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 `groupAssetsAsync()` + * 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. + */ + groupAssets( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse + ]>; + groupAssets( + request: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; + groupAssets( + request: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; + groupAssets( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse + ]>|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.groupAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * For example, `resource_properties.size = 100` is a valid filter string. + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the Asset's "state" property is updated to + * indicate whether the asset was added, removed, or remained present during + * the compare_duration period of time that precedes the read_time. This is + * the time between (read_time - compare_duration) and read_time. + * + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * This field is ignored if `state` is not a field in `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [GroupResult]{@link google.cloud.securitycenter.v1beta1.GroupResult} 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 `groupAssetsAsync()` + * 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. + */ + groupAssetsStream( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + 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['groupAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupAssets.createStream( + this.innerApiCalls.groupAssets as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `groupAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * For example, `resource_properties.size = 100` is a valid filter string. + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the Asset's "state" property is updated to + * indicate whether the asset was added, removed, or remained present during + * the compare_duration period of time that precedes the read_time. This is + * the time between (read_time - compare_duration) and read_time. + * + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * This field is ignored if `state` is not a field in `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [GroupResult]{@link google.cloud.securitycenter.v1beta1.GroupResult}. 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/v1beta1/security_center.group_assets.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async + */ + groupAssetsAsync( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, + 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['groupAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupAssets.asyncIterate( + this.innerApiCalls['groupAssets'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Filters an organization or source's findings and groups them by their + * specified properties. + * + * To group across all sources provide a `-` as the source id. + * Example: /v1beta1/organizations/{organization_id}/sources/-/findings + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]". To groupBy across + * all sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * For example, `source_properties.size = 100` is a valid filter string. + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state`). The string value should follow SQL syntax: comma separated list + * of fields. For example: + * "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [GroupResult]{@link google.cloud.securitycenter.v1beta1.GroupResult}. + * 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 `groupFindingsAsync()` + * 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. + */ + groupFindings( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse + ]>; + groupFindings( + request: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; + groupFindings( + request: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; + groupFindings( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IGroupResult>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse + ]>|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.groupFindings(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]". To groupBy across + * all sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * For example, `source_properties.size = 100` is a valid filter string. + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state`). The string value should follow SQL syntax: comma separated list + * of fields. For example: + * "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [GroupResult]{@link google.cloud.securitycenter.v1beta1.GroupResult} 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 `groupFindingsAsync()` + * 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. + */ + groupFindingsStream( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + 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['groupFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupFindings.createStream( + this.innerApiCalls.groupFindings as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `groupFindings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]". To groupBy across + * all sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * For example, `source_properties.size = 100` is a valid filter string. + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state`). The string value should follow SQL syntax: comma separated list + * of fields. For example: + * "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [GroupResult]{@link google.cloud.securitycenter.v1beta1.GroupResult}. 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/v1beta1/security_center.group_findings.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async + */ + groupFindingsAsync( + request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, + 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['groupFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupFindings.asyncIterate( + this.innerApiCalls['groupFindings'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists an organization's assets. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * For example, `resource_properties.size = 100` is a valid filter string. + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetResult's "state" attribute is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - + * compare_duration) and read_time. + * + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state is + * "UNUSED", which indicates that the asset is present at read_time. + * @param {google.protobuf.FieldMask} [request.fieldMask] + * Optional. A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [ListAssetsResult]{@link google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssets( + request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[], + protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse + ]>; + listAssets( + request: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>): void; + listAssets( + request: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>): void; + listAssets( + request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[], + protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * For example, `resource_properties.size = 100` is a valid filter string. + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetResult's "state" attribute is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - + * compare_duration) and read_time. + * + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state is + * "UNUSED", which indicates that the asset is present at read_time. + * @param {google.protobuf.FieldMask} [request.fieldMask] + * Optional. A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [ListAssetsResult]{@link google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssetsStream( + request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.createStream( + this.innerApiCalls.listAssets as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * For example, `resource_properties.size = 100` is a valid filter string. + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetResult's "state" attribute is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - + * compare_duration) and read_time. + * + * The state value is derived based on the presence of the asset at the two + * points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present before + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state is + * "UNUSED", which indicates that the asset is present at read_time. + * @param {google.protobuf.FieldMask} [request.fieldMask] + * Optional. A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [ListAssetsResult]{@link google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult}. 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/v1beta1/security_center.list_assets.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async + */ + listAssetsAsync( + request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.asyncIterate( + this.innerApiCalls['listAssets'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists an organization or source's findings. + * + * To list across all sources provide a `-` as the source id. + * Example: /v1beta1/organizations/{organization_id}/sources/-/findings + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id]". To list across all + * sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * For example, `source_properties.size = 100` is a valid filter string. + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.FieldMask} [request.fieldMask] + * Optional. A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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.securitycenter.v1beta1.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.securitycenter.v1beta1.IListFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding[], + protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest|null, + protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse + ]>; + listFindings( + request: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IFinding>): void; + listFindings( + request: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IFinding>): void; + listFindings( + request?: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IFinding>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.IFinding>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.IFinding[], + protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest|null, + protos.google.cloud.securitycenter.v1beta1.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. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id]". To list across all + * sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * For example, `source_properties.size = 100` is a valid filter string. + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.FieldMask} [request.fieldMask] + * Optional. A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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.securitycenter.v1beta1.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.securitycenter.v1beta1.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. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id]". To list across all + * sources provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are not supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * For example, `source_properties.size = 100` is a valid filter string. + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.FieldMask} [request.fieldMask] + * Optional. A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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.securitycenter.v1beta1.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/v1beta1/security_center.list_findings.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async + */ + listFindingsAsync( + request?: protos.google.cloud.securitycenter.v1beta1.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; + } + /** + * Lists all sources belonging to an organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [Source]{@link google.cloud.securitycenter.v1beta1.Source}. + * 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 `listSourcesAsync()` + * 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. + */ + listSources( + request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource[], + protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest|null, + protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse + ]>; + listSources( + request: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ISource>): void; + listSources( + request: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ISource>): void; + listSources( + request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ISource>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1beta1.ISource>): + Promise<[ + protos.google.cloud.securitycenter.v1beta1.ISource[], + protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest|null, + protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse + ]>|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.listSources(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. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [Source]{@link google.cloud.securitycenter.v1beta1.Source} 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 `listSourcesAsync()` + * 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. + */ + listSourcesStream( + request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + 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['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.createStream( + this.innerApiCalls.listSources as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSources`, 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. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [Source]{@link google.cloud.securitycenter.v1beta1.Source}. 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/v1beta1/security_center.list_sources.js + * region_tag:securitycenter_v1beta1_generated_SecurityCenter_ListSources_async + */ + listSourcesAsync( + request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, + 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['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.asyncIterate( + this.innerApiCalls['listSources'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified asset resource name string. + * + * @param {string} organization + * @param {string} asset + * @returns {string} Resource name string. + */ + assetPath(organization:string,asset:string) { + return this.pathTemplates.assetPathTemplate.render({ + organization: organization, + asset: asset, + }); + } + + /** + * Parse the organization from Asset resource. + * + * @param {string} assetName + * A fully-qualified path representing Asset resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromAssetName(assetName: string) { + return this.pathTemplates.assetPathTemplate.match(assetName).organization; + } + + /** + * Parse the asset from Asset resource. + * + * @param {string} assetName + * A fully-qualified path representing Asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromAssetName(assetName: string) { + return this.pathTemplates.assetPathTemplate.match(assetName).asset; + } + + /** + * Return a fully-qualified finding resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + findingPath(organization:string,source:string,finding:string) { + return this.pathTemplates.findingPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + }); + } + + /** + * Parse the organization from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).organization; + } + + /** + * Parse the source from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).source; + } + + /** + * 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 organization resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationPath(organization:string) { + return this.pathTemplates.organizationPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from Organization resource. + * + * @param {string} organizationName + * A fully-qualified path representing Organization resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationName(organizationName: string) { + return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; + } + + /** + * Return a fully-qualified organizationAssetSecurityMarks resource name string. + * + * @param {string} organization + * @param {string} asset + * @returns {string} Resource name string. + */ + organizationAssetSecurityMarksPath(organization:string,asset:string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.render({ + organization: organization, + asset: asset, + }); + } + + /** + * Parse the organization from OrganizationAssetSecurityMarks resource. + * + * @param {string} organizationAssetSecurityMarksName + * A fully-qualified path representing organization_asset_securityMarks resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).organization; + } + + /** + * Parse the asset from OrganizationAssetSecurityMarks resource. + * + * @param {string} organizationAssetSecurityMarksName + * A fully-qualified path representing organization_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization:string) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing OrganizationSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + + /** + * Return a fully-qualified organizationSourceFindingSecurityMarks resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + organizationSourceFindingSecurityMarksPath(organization:string,source:string,finding:string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + }); + } + + /** + * Parse the organization from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).organization; + } + + /** + * Parse the source from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).finding; + } + + /** + * Return a fully-qualified source resource name string. + * + * @param {string} organization + * @param {string} source + * @returns {string} Resource name string. + */ + sourcePath(organization:string,source:string) { + return this.pathTemplates.sourcePathTemplate.render({ + organization: organization, + source: source, + }); + } + + /** + * Parse the organization from Source resource. + * + * @param {string} sourceName + * A fully-qualified path representing Source resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromSourceName(sourceName: string) { + return this.pathTemplates.sourcePathTemplate.match(sourceName).organization; + } + + /** + * Parse the source from Source resource. + * + * @param {string} sourceName + * A fully-qualified path representing Source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromSourceName(sourceName: string) { + return this.pathTemplates.sourcePathTemplate.match(sourceName).source; + } + + /** + * 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 { + this.initialize(); + if (!this._terminated) { + return this.securityCenterStub!.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/security_center_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/security_center_client_config.json new file mode 100644 index 00000000..a1a7e2d9 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/security_center_client_config.json @@ -0,0 +1,116 @@ +{ + "interfaces": { + "google.cloud.securitycenter.v1beta1.SecurityCenter": { + "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": { + "CreateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetOrganizationSettings": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetSource": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GroupAssets": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GroupFindings": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListAssets": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindings": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListSources": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RunAssetDiscovery": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetFindingState": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateFinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateOrganizationSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSecurityMarks": { + "timeout_millis": 480000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/security_center_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/security_center_proto_list.json new file mode 100644 index 00000000..d10dce6c --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/security_center_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/cloud/securitycenter/v1beta1/asset.proto", + "../../protos/google/cloud/securitycenter/v1beta1/finding.proto", + "../../protos/google/cloud/securitycenter/v1beta1/organization_settings.proto", + "../../protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto", + "../../protos/google/cloud/securitycenter/v1beta1/security_marks.proto", + "../../protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto", + "../../protos/google/cloud/securitycenter/v1beta1/source.proto" +] diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000..37333715 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// 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. +// +// ** 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 securitycenter = require('@google-cloud/security-center'); + +function main() { + const securityCenterClient = new securitycenter.SecurityCenterClient(); +} + +main(); diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000..b4153c94 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// 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. +// +// ** 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 {SecurityCenterClient} from '@google-cloud/security-center'; + +// check that the client class type name can be used +function doStuffWithSecurityCenterClient(client: SecurityCenterClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const securityCenterClient = new SecurityCenterClient(); + doStuffWithSecurityCenterClient(securityCenterClient); +} + +main(); diff --git a/owl-bot-staging/v1beta1/system-test/install.ts b/owl-bot-staging/v1beta1/system-test/install.ts new file mode 100644 index 00000000..1f850b52 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// 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. +// +// ** 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/v1beta1/test/gapic_security_center_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_security_center_v1beta1.ts new file mode 100644 index 00000000..539e3123 --- /dev/null +++ b/owl-bot-staging/v1beta1/test/gapic_security_center_v1beta1.ts @@ -0,0 +1,2731 @@ +// 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. +// +// ** 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 securitycenterModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta1.SecurityCenterClient', () => { + it('has servicePath', () => { + const servicePath = securitycenterModule.v1beta1.SecurityCenterClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = securitycenterModule.v1beta1.SecurityCenterClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = securitycenterModule.v1beta1.SecurityCenterClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.securityCenterStub, undefined); + await client.initialize(); + assert(client.securityCenterStub); + }); + + it('has close method', () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + 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 securitycenterModule.v1beta1.SecurityCenterClient({ + 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('createSource', () => { + it('invokes createSource without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()); + client.innerApiCalls.createSource = stubSimpleCall(expectedResponse); + const [response] = await client.createSource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSource without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()); + client.innerApiCalls.createSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createSource with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSource(request), expectedError); + assert((client.innerApiCalls.createSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createFinding', () => { + it('invokes createFinding without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()); + client.innerApiCalls.createFinding = stubSimpleCall(expectedResponse); + const [response] = await client.createFinding(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createFinding without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()); + client.innerApiCalls.createFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFinding( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createFinding with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createFinding(request), expectedError); + assert((client.innerApiCalls.createFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getOrganizationSettings', () => { + it('invokes getOrganizationSettings without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings()); + client.innerApiCalls.getOrganizationSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getOrganizationSettings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getOrganizationSettings without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings()); + client.innerApiCalls.getOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getOrganizationSettings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getOrganizationSettings with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getOrganizationSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getOrganizationSettings(request), expectedError); + assert((client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getSource', () => { + it('invokes getSource without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()); + client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); + const [response] = await client.getSource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSource without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()); + client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getSource with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSource(request), expectedError); + assert((client.innerApiCalls.getSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('setFindingState', () => { + it('invokes setFindingState without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()); + client.innerApiCalls.setFindingState = stubSimpleCall(expectedResponse); + const [response] = await client.setFindingState(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setFindingState without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()); + client.innerApiCalls.setFindingState = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setFindingState( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setFindingState with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setFindingState = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setFindingState(request), expectedError); + assert((client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateFinding', () => { + it('invokes updateFinding without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest()); + request.finding = {}; + request.finding.name = ''; + const expectedHeaderRequestParams = "finding.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()); + client.innerApiCalls.updateFinding = stubSimpleCall(expectedResponse); + const [response] = await client.updateFinding(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateFinding without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest()); + request.finding = {}; + request.finding.name = ''; + const expectedHeaderRequestParams = "finding.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()); + client.innerApiCalls.updateFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFinding( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateFinding with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest()); + request.finding = {}; + request.finding.name = ''; + const expectedHeaderRequestParams = "finding.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateFinding(request), expectedError); + assert((client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateOrganizationSettings', () => { + it('invokes updateOrganizationSettings without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest()); + request.organizationSettings = {}; + request.organizationSettings.name = ''; + const expectedHeaderRequestParams = "organization_settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings()); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateOrganizationSettings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateOrganizationSettings without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest()); + request.organizationSettings = {}; + request.organizationSettings.name = ''; + const expectedHeaderRequestParams = "organization_settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings()); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateOrganizationSettings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateOrganizationSettings with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest()); + request.organizationSettings = {}; + request.organizationSettings.name = ''; + const expectedHeaderRequestParams = "organization_settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateOrganizationSettings(request), expectedError); + assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateSource', () => { + it('invokes updateSource without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest()); + request.source = {}; + request.source.name = ''; + const expectedHeaderRequestParams = "source.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()); + client.innerApiCalls.updateSource = stubSimpleCall(expectedResponse); + const [response] = await client.updateSource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSource without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest()); + request.source = {}; + request.source.name = ''; + const expectedHeaderRequestParams = "source.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()); + client.innerApiCalls.updateSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateSource with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest()); + request.source = {}; + request.source.name = ''; + const expectedHeaderRequestParams = "source.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSource(request), expectedError); + assert((client.innerApiCalls.updateSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateSecurityMarks', () => { + it('invokes updateSecurityMarks without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest()); + request.securityMarks = {}; + request.securityMarks.name = ''; + const expectedHeaderRequestParams = "security_marks.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.SecurityMarks()); + client.innerApiCalls.updateSecurityMarks = stubSimpleCall(expectedResponse); + const [response] = await client.updateSecurityMarks(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSecurityMarks without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest()); + request.securityMarks = {}; + request.securityMarks.name = ''; + const expectedHeaderRequestParams = "security_marks.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.SecurityMarks()); + client.innerApiCalls.updateSecurityMarks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecurityMarks( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISecurityMarks|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateSecurityMarks with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest()); + request.securityMarks = {}; + request.securityMarks.name = ''; + const expectedHeaderRequestParams = "security_marks.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityMarks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSecurityMarks(request), expectedError); + assert((client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('runAssetDiscovery', () => { + it('invokes runAssetDiscovery without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(expectedResponse); + const [operation] = await client.runAssetDiscovery(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes runAssetDiscovery without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runAssetDiscovery( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes runAssetDiscovery with call error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runAssetDiscovery(request), expectedError); + assert((client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes runAssetDiscovery with LRO error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runAssetDiscovery(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkRunAssetDiscoveryProgress without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRunAssetDiscoveryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRunAssetDiscoveryProgress with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRunAssetDiscoveryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('groupAssets', () => { + it('invokes groupAssets without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.innerApiCalls.groupAssets = stubSimpleCall(expectedResponse); + const [response] = await client.groupAssets(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes groupAssets without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.innerApiCalls.groupAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.groupAssets( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IGroupResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes groupAssets with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.groupAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.groupAssets(request), expectedError); + assert((client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes groupAssetsStream without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.groupAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { + 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.groupAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); + assert.strictEqual( + (client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes groupAssetsStream with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.groupAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); + assert.strictEqual( + (client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with groupAssets without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; + const iterable = client.groupAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with groupAssets with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.groupAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('groupFindings', () => { + it('invokes groupFindings without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.innerApiCalls.groupFindings = stubSimpleCall(expectedResponse); + const [response] = await client.groupFindings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes groupFindings without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.innerApiCalls.groupFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.groupFindings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IGroupResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes groupFindings with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.groupFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.groupFindings(request), expectedError); + assert((client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes groupFindingsStream without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.groupFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { + 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.groupFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); + assert.strictEqual( + (client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes groupFindingsStream with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.groupFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); + assert.strictEqual( + (client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with groupFindings without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), + ]; + client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; + const iterable = client.groupFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with groupFindings with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.groupFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listAssets', () => { + it('invokes listAssets without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); + const [response] = await client.listAssets(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAssets without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAssets( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listAssets with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAssets(request), expectedError); + assert((client.innerApiCalls.listAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAssetsStream without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert.strictEqual( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listAssetsStream with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert.strictEqual( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAssets without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[] = []; + const iterable = client.listAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAssets with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAssets.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 securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.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 securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.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 securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.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 securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + ]; + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.Finding[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.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 securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.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.securitycenter.v1beta1.Finding[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.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 securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), + ]; + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1beta1.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 securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.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.securitycenter.v1beta1.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('listSources', () => { + it('invokes listSources without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); + const [response] = await client.listSources(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSources as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSources without error using callback', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSources( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSources as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listSources with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSources(request), expectedError); + assert((client.innerApiCalls.listSources as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSourcesStream without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + ]; + client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.Source[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.Source) => { + 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.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert.strictEqual( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listSourcesStream with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1beta1.Source[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.Source) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert.strictEqual( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSources without error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), + ]; + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1beta1.ISource[] = []; + const iterable = client.listSourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSources with error', async () => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1beta1.ISource[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('asset', () => { + const fakePath = "/rendered/path/asset"; + const expectedParameters = { + organization: "organizationValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.assetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.assetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('assetPath', () => { + const result = client.assetPath("organizationValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.assetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromAssetName', () => { + const result = client.matchOrganizationFromAssetName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromAssetName', () => { + const result = client.matchAssetFromAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('finding', () => { + const fakePath = "/rendered/path/finding"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + 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("organizationValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.findingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromFindingName', () => { + const result = client.matchOrganizationFromFindingName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFindingName', () => { + const result = client.matchSourceFromFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + 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('organization', () => { + const fakePath = "/rendered/path/organization"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationPath', () => { + const result = client.organizationPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationName', () => { + const result = client.matchOrganizationFromOrganizationName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationAssetSecurityMarks', () => { + const fakePath = "/rendered/path/organizationAssetSecurityMarks"; + const expectedParameters = { + organization: "organizationValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAssetSecurityMarksPath', () => { + const result = client.organizationAssetSecurityMarksPath("organizationValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationAssetSecurityMarksName', () => { + const result = client.matchOrganizationFromOrganizationAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromOrganizationAssetSecurityMarksName', () => { + const result = client.matchAssetFromOrganizationAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSettings', () => { + const fakePath = "/rendered/path/organizationSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSettingsPath', () => { + const result = client.organizationSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSettingsName', () => { + const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/organizationSourceFindingSecurityMarks"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourceFindingSecurityMarksPath', () => { + const result = client.organizationSourceFindingSecurityMarksPath("organizationValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchOrganizationFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('source', () => { + const fakePath = "/rendered/path/source"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.sourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.sourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('sourcePath', () => { + const result = client.sourcePath("organizationValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.sourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromSourceName', () => { + const result = client.matchOrganizationFromSourceName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromSourceName', () => { + const result = client.matchSourceFromSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1beta1/tsconfig.json b/owl-bot-staging/v1beta1/tsconfig.json new file mode 100644 index 00000000..c78f1c88 --- /dev/null +++ b/owl-bot-staging/v1beta1/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/v1beta1/webpack.config.js b/owl-bot-staging/v1beta1/webpack.config.js new file mode 100644 index 00000000..4aeca8bf --- /dev/null +++ b/owl-bot-staging/v1beta1/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: 'SecurityCenter', + filename: './security-center.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/v1p1beta1/.eslintignore b/owl-bot-staging/v1p1beta1/.eslintignore new file mode 100644 index 00000000..cfc348ec --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1p1beta1/.eslintrc.json b/owl-bot-staging/v1p1beta1/.eslintrc.json new file mode 100644 index 00000000..78215349 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1p1beta1/.gitignore b/owl-bot-staging/v1p1beta1/.gitignore new file mode 100644 index 00000000..5d32b237 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1p1beta1/.jsdoc.js b/owl-bot-staging/v1p1beta1/.jsdoc.js new file mode 100644 index 00000000..e201160b --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// 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. +// +// ** 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 2021 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/security-center', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1p1beta1/.mocharc.js b/owl-bot-staging/v1p1beta1/.mocharc.js new file mode 100644 index 00000000..50bc7f79 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.mocharc.js @@ -0,0 +1,33 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1p1beta1/.prettierrc.js b/owl-bot-staging/v1p1beta1/.prettierrc.js new file mode 100644 index 00000000..84f4713a --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1p1beta1/README.md b/owl-bot-staging/v1p1beta1/README.md new file mode 100644 index 00000000..73f34764 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/README.md @@ -0,0 +1 @@ +Securitycenter: Nodejs Client diff --git a/owl-bot-staging/v1p1beta1/linkinator.config.json b/owl-bot-staging/v1p1beta1/linkinator.config.json new file mode 100644 index 00000000..0121dfa6 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 5 +} diff --git a/owl-bot-staging/v1p1beta1/package.json b/owl-bot-staging/v1p1beta1/package.json new file mode 100644 index 00000000..b88a2160 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/security-center", + "version": "0.1.0", + "description": "Securitycenter client for Node.js", + "repository": "googleapis/nodejs-securitycenter", + "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 securitycenter", + "securitycenter", + "security center" + ], + "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": "^2.28.0" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^14.17.32", + "@types/sinon": "^10.0.6", + "c8": "^7.10.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^2.14.5", + "mocha": "^9.1.3", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.2", + "ts-loader": "^9.2.6", + "typescript": "^4.4.4", + "webpack": "^5.62.1", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto new file mode 100644 index 00000000..9ee30783 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto @@ -0,0 +1,135 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1p1beta1/folder.proto"; +import "google/cloud/securitycenter/v1p1beta1/security_marks.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// Security Command Center representation of a Google Cloud +// resource. +// +// The Asset is a Security Command Center resource that captures information +// about a single Google Cloud resource. All modifications to an Asset are only +// within the context of Security Command Center and don't affect the referenced +// Google Cloud resource. +message Asset { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Asset" + pattern: "organizations/{organization}/assets/{asset}" + pattern: "folders/{folder}/assets/{asset}" + pattern: "projects/{project}/assets/{asset}" + }; + + // Security Command Center managed properties. These properties are managed by + // Security Command Center and cannot be modified by the user. + message SecurityCenterProperties { + // The full resource name of the Google Cloud resource this asset + // represents. This field is immutable after create time. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_name = 1; + + // The type of the Google Cloud resource. Examples include: APPLICATION, + // PROJECT, and ORGANIZATION. This is a case insensitive field defined by + // Security Command Center and/or the producer of the resource and is + // immutable after create time. + string resource_type = 2; + + // The full resource name of the immediate parent of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_parent = 3; + + // The full resource name of the project the resource belongs to. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_project = 4; + + // Owners of the Google Cloud resource. + repeated string resource_owners = 5; + + // The user defined display name for this resource. + string resource_display_name = 6; + + // The user defined display name for the parent of this resource. + string resource_parent_display_name = 7; + + // The user defined display name for the project of this resource. + string resource_project_display_name = 8; + + // Contains a Folder message for each folder in the assets ancestry. + // The first folder is the deepest nested folder, and the last folder is the + // folder directly under the Organization. + repeated Folder folders = 10; + } + + // Cloud IAM Policy information associated with the Google Cloud resource + // described by the Security Command Center asset. This information is managed + // and defined by the Google Cloud resource and cannot be modified by the + // user. + message IamPolicy { + // The JSON representation of the Policy associated with the asset. + // See https://cloud.google.com/iam/docs/reference/rest/v1/Policy for + // format details. + string policy_blob = 1; + } + + // The relative resource name of this asset. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/assets/{asset_id}". + string name = 1; + + // Security Command Center managed properties. These properties are managed by + // Security Command Center and cannot be modified by the user. + SecurityCenterProperties security_center_properties = 2; + + // Resource managed properties. These properties are managed and defined by + // the Google Cloud resource and cannot be modified by the user. + map resource_properties = 7; + + // User specified security marks. These marks are entirely managed by the user + // and come from the SecurityMarks resource that belongs to the asset. + SecurityMarks security_marks = 8; + + // The time at which the asset was created in Security Command Center. + google.protobuf.Timestamp create_time = 9; + + // The time at which the asset was last updated or added in Cloud SCC. + google.protobuf.Timestamp update_time = 10; + + // Cloud IAM Policy information associated with the Google Cloud resource + // described by the Security Command Center asset. This information is managed + // and defined by the Google Cloud resource and cannot be modified by the + // user. + IamPolicy iam_policy = 11; + + // The canonical name of the resource. It's either + // "organizations/{organization_id}/assets/{asset_id}", + // "folders/{folder_id}/assets/{asset_id}" or + // "projects/{project_number}/assets/{asset_id}", depending on the closest CRM + // ancestor of the resource. + string canonical_name = 13; +} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto new file mode 100644 index 00000000..572a368f --- /dev/null +++ b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto @@ -0,0 +1,146 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1p1beta1/security_marks.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// Security Command Center finding. +// +// A finding is a record of assessment data (security, risk, health or privacy) +// ingested into Security Command Center for presentation, notification, +// analysis, policy testing, and enforcement. For example, an XSS vulnerability +// in an App Engine application is a finding. +message Finding { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Finding" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}" + pattern: "folders/{folder}/sources/{source}/findings/{finding}" + pattern: "projects/{project}/sources/{source}/findings/{finding}" + }; + + // The state of the finding. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // The finding requires attention and has not been addressed yet. + ACTIVE = 1; + + // The finding has been fixed, triaged as a non-issue or otherwise addressed + // and is no longer active. + INACTIVE = 2; + } + + // The severity of the finding. This field is managed by the source that + // writes the finding. + 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; + } + + // The relative resource name of this finding. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}" + string name = 1; + + // The relative resource name of the source the finding belongs to. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // This field is immutable after creation time. + // For example: + // "organizations/{organization_id}/sources/{source_id}" + string parent = 2; + + // For findings on Google Cloud resources, the full resource + // name of the Google Cloud resource this finding is for. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + // When the finding is for a non-Google Cloud resource, the resourceName can + // be a customer or partner defined string. This field is immutable after + // creation time. + string resource_name = 3; + + // The state of the finding. + State state = 4; + + // The additional taxonomy group within findings from a given source. + // This field is immutable after creation time. + // Example: "XSS_FLASH_INJECTION" + string category = 5; + + // The URI that, if available, points to a web page outside of Security + // Command Center where additional information about the finding can be found. + // This field is guaranteed to be either empty or a well formed URL. + string external_uri = 6; + + // Source specific properties. These properties are managed by the source + // that writes the finding. The key names in the source_properties map must be + // between 1 and 255 characters, and must start with a letter and contain + // alphanumeric characters or underscores only. + map source_properties = 7; + + // Output only. User specified security marks. These marks are entirely + // managed by the user and come from the SecurityMarks resource that belongs + // to the finding. + SecurityMarks security_marks = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The time at which the event took place, or when an update to the finding + // occurred. For example, if the finding represents an open firewall it would + // capture the time the detector believes the firewall became open. The + // accuracy is determined by the detector. If the finding were to be resolved + // afterward, this time would reflect when the finding was resolved. Must not + // be set to a value greater than the current timestamp. + google.protobuf.Timestamp event_time = 9; + + // The time at which the finding was created in Security Command Center. + google.protobuf.Timestamp create_time = 10; + + // The severity of the finding. This field is managed by the source that + // writes the finding. + Severity severity = 13; + + // The canonical name of the finding. It's either + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", + // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}" or + // "projects/{project_number}/sources/{source_id}/findings/{finding_id}", + // depending on the closest CRM ancestor of the resource associated with the + // finding. + string canonical_name = 14; +} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto new file mode 100644 index 00000000..ec6df5ed --- /dev/null +++ b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto @@ -0,0 +1,38 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; +option java_multiple_files = true; +option java_outer_classname = "FolderProto"; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1Beta1"; + +// Message that contains the resource name and display name of a folder +// resource. +message Folder { + // Full resource name of this folder. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string resource_folder = 1; + + // The user defined display name for this folder. + string resource_folder_display_name = 2; +} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto new file mode 100644 index 00000000..be5f6e0f --- /dev/null +++ b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto @@ -0,0 +1,108 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; +option (google.api.resource_definition) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" +}; + +// Security Command Center notification configs. +// +// A notification config is a Security Command Center resource that contains the +// configuration to send notifications for create/update events of findings, +// assets and etc. +message NotificationConfig { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/NotificationConfig" + pattern: "organizations/{organization}/notificationConfigs/{notification_config}" + }; + + // The config for streaming-based notifications, which send each event as soon + // as it is detected. + message StreamingConfig { + // Expression that defines the filter to apply across create/update events + // of assets or findings as specified by the event type. The expression is a + // list of zero or more restrictions combined via logical operators `AND` + // and `OR`. Parentheses are supported, and `OR` has higher precedence than + // `AND`. + // + // Restrictions have the form ` ` and may have a + // `-` character in front of them to indicate negation. The fields map to + // those defined in the corresponding resource. + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + string filter = 1; + } + + // The type of events. + enum EventType { + // Unspecified event type. + EVENT_TYPE_UNSPECIFIED = 0; + + // Events for findings. + FINDING = 1; + } + + // The relative resource name of this notification config. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/notificationConfigs/notify_public_bucket". + string name = 1; + + // The description of the notification config (max of 1024 characters). + string description = 2; + + // The type of events the config is for, e.g. FINDING. + EventType event_type = 3; + + // The Pub/Sub topic to send notifications to. Its format is + // "projects/[project_id]/topics/[topic]". + string pubsub_topic = 4 [(google.api.resource_reference) = { + type: "pubsub.googleapis.com/Topic" + }]; + + // Output only. The service account that needs "pubsub.topics.publish" + // permission to publish to the Pub/Sub topic. + string service_account = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The config for triggering notifications. + oneof notify_config { + // The config for triggering streaming-based notifications. + StreamingConfig streaming_config = 6; + } +} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto new file mode 100644 index 00000000..5e671dd0 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto @@ -0,0 +1,44 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/cloud/securitycenter/v1p1beta1/finding.proto"; +import "google/cloud/securitycenter/v1p1beta1/resource.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// Security Command Center's Notification +message NotificationMessage { + // Name of the notification config that generated current notification. + string notification_config_name = 1; + + // Notification Event. + oneof event { + // If it's a Finding based notification config, this field will be + // populated. + Finding finding = 2; + } + + // The Cloud resource tied to the notification. + Resource resource = 3; +} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto new file mode 100644 index 00000000..ad36d58a --- /dev/null +++ b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto @@ -0,0 +1,86 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// User specified settings that are attached to the Security Command +// Center organization. +message OrganizationSettings { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/OrganizationSettings" + pattern: "organizations/{organization}/organizationSettings" + }; + + // The configuration used for Asset Discovery runs. + message AssetDiscoveryConfig { + // The mode of inclusion when running Asset Discovery. + // Asset discovery can be limited by explicitly identifying projects to be + // included or excluded. If INCLUDE_ONLY is set, then only those projects + // within the organization and their children are discovered during asset + // discovery. If EXCLUDE is set, then projects that don't match those + // projects are discovered during asset discovery. If neither are set, then + // all projects within the organization are discovered during asset + // discovery. + enum InclusionMode { + // Unspecified. Setting the mode with this value will disable + // inclusion/exclusion filtering for Asset Discovery. + INCLUSION_MODE_UNSPECIFIED = 0; + + // Asset Discovery will capture only the resources within the projects + // specified. All other resources will be ignored. + INCLUDE_ONLY = 1; + + // Asset Discovery will ignore all resources under the projects specified. + // All other resources will be retrieved. + EXCLUDE = 2; + } + + // The project ids to use for filtering asset discovery. + repeated string project_ids = 1; + + // The mode to use for filtering asset discovery. + InclusionMode inclusion_mode = 2; + + // The folder ids to use for filtering asset discovery. + // It consists of only digits, e.g., 756619654966. + repeated string folder_ids = 3; + } + + // The relative resource name of the settings. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/organizationSettings". + string name = 1; + + // A flag that indicates if Asset Discovery should be enabled. If the flag is + // set to `true`, then discovery of assets will occur. If it is set to `false, + // all historical assets will remain, but discovery of future assets will not + // occur. + bool enable_asset_discovery = 2; + + // The configuration used for Asset Discovery runs. + AssetDiscoveryConfig asset_discovery_config = 3; +} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto new file mode 100644 index 00000000..0fe2d362 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/field_behavior.proto"; +import "google/cloud/securitycenter/v1p1beta1/folder.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; +option java_multiple_files = true; +option java_outer_classname = "ResourceProto"; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// Information related to the Google Cloud resource. +message Resource { + // The full resource name of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string name = 1; + + // The full resource name of project that the resource belongs to. + string project = 2; + + // The human readable name of project that the resource belongs to. + string project_display_name = 3; + + // The full resource name of resource's parent. + string parent = 4; + + // The human readable name of resource's parent. + string parent_display_name = 5; + + // Output only. Contains a Folder message for each folder in the assets ancestry. + // The first folder is the deepest nested folder, and the last folder is the + // folder directly under the Organization. + repeated Folder folders = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto new file mode 100644 index 00000000..d867d201 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/protobuf/duration.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// Response of asset discovery run +message RunAssetDiscoveryResponse { + // The state of an asset discovery run. + enum State { + // Asset discovery run state was unspecified. + STATE_UNSPECIFIED = 0; + + // Asset discovery run completed successfully. + COMPLETED = 1; + + // Asset discovery run was cancelled with tasks still pending, as another + // run for the same organization was started with a higher priority. + SUPERSEDED = 2; + + // Asset discovery run was killed and terminated. + TERMINATED = 3; + } + + // The state of an asset discovery run. + State state = 1; + + // The duration between asset discovery run start and end + google.protobuf.Duration duration = 2; +} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto new file mode 100644 index 00000000..22db26cb --- /dev/null +++ b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// User specified security marks that are attached to the parent Security +// Command Center resource. Security marks are scoped within a Security Command +// Center organization -- they can be modified and viewed by all users who have +// proper permissions on the organization. +message SecurityMarks { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/SecurityMarks" + pattern: "organizations/{organization}/assets/{asset}/securityMarks" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}/securityMarks" + pattern: "folders/{folder}/assets/{asset}/securityMarks" + pattern: "projects/{project}/assets/{asset}/securityMarks" + pattern: "folders/{folder}/sources/{source}/findings/{finding}/securityMarks" + pattern: "projects/{project}/sources/{source}/findings/{finding}/securityMarks" + }; + + // The relative resource name of the SecurityMarks. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Examples: + // "organizations/{organization_id}/assets/{asset_id}/securityMarks" + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks". + string name = 1; + + // Mutable user specified security marks belonging to the parent resource. + // Constraints are as follows: + // + // * Keys and values are treated as case insensitive + // * Keys must be between 1 - 256 characters (inclusive) + // * Keys must be letters, numbers, underscores, or dashes + // * Values have leading and trailing whitespace trimmed, remaining + // characters must be between 1 - 4096 characters (inclusive) + map marks = 2; + + // The canonical name of the marks. + // Examples: + // "organizations/{organization_id}/assets/{asset_id}/securityMarks" + // "folders/{folder_id}/assets/{asset_id}/securityMarks" + // "projects/{project_number}/assets/{asset_id}/securityMarks" + // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks" + // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}/securityMarks" + // "projects/{project_number}/sources/{source_id}/findings/{finding_id}/securityMarks" + string canonical_name = 3; +} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto new file mode 100644 index 00000000..958e6971 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto @@ -0,0 +1,1351 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import public "google/cloud/securitycenter/v1p1beta1/notification_message.proto"; +import public "google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto"; +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/securitycenter/v1p1beta1/asset.proto"; +import "google/cloud/securitycenter/v1p1beta1/finding.proto"; +import "google/cloud/securitycenter/v1p1beta1/folder.proto"; +import "google/cloud/securitycenter/v1p1beta1/notification_config.proto"; +import "google/cloud/securitycenter/v1p1beta1/organization_settings.proto"; +import "google/cloud/securitycenter/v1p1beta1/security_marks.proto"; +import "google/cloud/securitycenter/v1p1beta1/source.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// V1p1Beta1 APIs for Security Center service. +service SecurityCenter { + option (google.api.default_host) = "securitycenter.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a source. + rpc CreateSource(CreateSourceRequest) returns (Source) { + option (google.api.http) = { + post: "/v1p1beta1/{parent=organizations/*}/sources" + body: "source" + }; + option (google.api.method_signature) = "parent,source"; + } + + // Creates a finding. The corresponding source must exist for finding + // creation to succeed. + rpc CreateFinding(CreateFindingRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1p1beta1/{parent=organizations/*/sources/*}/findings" + body: "finding" + }; + option (google.api.method_signature) = "parent,finding_id,finding"; + option (google.api.method_signature) = "parent,finding,finding_id"; + } + + // Creates a notification config. + rpc CreateNotificationConfig(CreateNotificationConfigRequest) returns (NotificationConfig) { + option (google.api.http) = { + post: "/v1p1beta1/{parent=organizations/*}/notificationConfigs" + body: "notification_config" + }; + option (google.api.method_signature) = "parent,config_id,notification_config"; + option (google.api.method_signature) = "parent,notification_config"; + } + + // Deletes a notification config. + rpc DeleteNotificationConfig(DeleteNotificationConfigRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1p1beta1/{name=organizations/*/notificationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets the access control policy on the specified Source. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1p1beta1/{resource=organizations/*/sources/*}:getIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource"; + } + + // Gets a notification config. + rpc GetNotificationConfig(GetNotificationConfigRequest) returns (NotificationConfig) { + option (google.api.http) = { + get: "/v1p1beta1/{name=organizations/*/notificationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets the settings for an organization. + rpc GetOrganizationSettings(GetOrganizationSettingsRequest) returns (OrganizationSettings) { + option (google.api.http) = { + get: "/v1p1beta1/{name=organizations/*/organizationSettings}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a source. + rpc GetSource(GetSourceRequest) returns (Source) { + option (google.api.http) = { + get: "/v1p1beta1/{name=organizations/*/sources/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Filters an organization's assets and groups them by their specified + // properties. + rpc GroupAssets(GroupAssetsRequest) returns (GroupAssetsResponse) { + option (google.api.http) = { + post: "/v1p1beta1/{parent=organizations/*}/assets:group" + body: "*" + additional_bindings { + post: "/v1p1beta1/{parent=folders/*}/assets:group" + body: "*" + } + additional_bindings { + post: "/v1p1beta1/{parent=projects/*}/assets:group" + body: "*" + } + }; + } + + // Filters an organization or source's findings and groups them by their + // specified properties. + // + // To group across all sources provide a `-` as the source id. + // Example: /v1/organizations/{organization_id}/sources/-/findings, + // /v1/folders/{folder_id}/sources/-/findings, + // /v1/projects/{project_id}/sources/-/findings + rpc GroupFindings(GroupFindingsRequest) returns (GroupFindingsResponse) { + option (google.api.http) = { + post: "/v1p1beta1/{parent=organizations/*/sources/*}/findings:group" + body: "*" + additional_bindings { + post: "/v1p1beta1/{parent=folders/*/sources/*}/findings:group" + body: "*" + } + additional_bindings { + post: "/v1p1beta1/{parent=projects/*/sources/*}/findings:group" + body: "*" + } + }; + option (google.api.method_signature) = "parent,group_by"; + } + + // Lists an organization's assets. + rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { + option (google.api.http) = { + get: "/v1p1beta1/{parent=organizations/*}/assets" + additional_bindings { + get: "/v1p1beta1/{parent=folders/*}/assets" + } + additional_bindings { + get: "/v1p1beta1/{parent=projects/*}/assets" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Lists an organization or source's findings. + // + // To list across all sources provide a `-` as the source id. + // Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings + rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { + option (google.api.http) = { + get: "/v1p1beta1/{parent=organizations/*/sources/*}/findings" + additional_bindings { + get: "/v1p1beta1/{parent=folders/*/sources/*}/findings" + } + additional_bindings { + get: "/v1p1beta1/{parent=projects/*/sources/*}/findings" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Lists notification configs. + rpc ListNotificationConfigs(ListNotificationConfigsRequest) returns (ListNotificationConfigsResponse) { + option (google.api.http) = { + get: "/v1p1beta1/{parent=organizations/*}/notificationConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists all sources belonging to an organization. + rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { + option (google.api.http) = { + get: "/v1p1beta1/{parent=organizations/*}/sources" + additional_bindings { + get: "/v1p1beta1/{parent=folders/*}/sources" + } + additional_bindings { + get: "/v1p1beta1/{parent=projects/*}/sources" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Runs asset discovery. The discovery is tracked with a long-running + // operation. + // + // This API can only be called with limited frequency for an organization. If + // it is called too frequently the caller will receive a TOO_MANY_REQUESTS + // error. + rpc RunAssetDiscovery(RunAssetDiscoveryRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1p1beta1/{parent=organizations/*}/assets:runDiscovery" + body: "*" + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryResponse" + metadata_type: "google.protobuf.Empty" + }; + } + + // Updates the state of a finding. + rpc SetFindingState(SetFindingStateRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1p1beta1/{name=organizations/*/sources/*/findings/*}:setState" + body: "*" + additional_bindings { + post: "/v1p1beta1/{name=folders/*/sources/*/findings/*}:setState" + body: "*" + } + additional_bindings { + post: "/v1p1beta1/{name=projects/*/sources/*/findings/*}:setState" + body: "*" + } + }; + option (google.api.method_signature) = "name,state,start_time"; + } + + // Sets the access control policy on the specified Source. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1p1beta1/{resource=organizations/*/sources/*}:setIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Returns the permissions that a caller has on the specified source. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1p1beta1/{resource=organizations/*/sources/*}:testIamPermissions" + body: "*" + }; + option (google.api.method_signature) = "resource,permissions"; + } + + // Creates or updates a finding. The corresponding source must exist for a + // finding creation to succeed. + rpc UpdateFinding(UpdateFindingRequest) returns (Finding) { + option (google.api.http) = { + patch: "/v1p1beta1/{finding.name=organizations/*/sources/*/findings/*}" + body: "finding" + additional_bindings { + patch: "/v1p1beta1/{finding.name=folders/*/sources/*/findings/*}" + body: "finding" + } + additional_bindings { + patch: "/v1p1beta1/{finding.name=projects/*/sources/*/findings/*}" + body: "finding" + } + }; + option (google.api.method_signature) = "finding"; + option (google.api.method_signature) = "finding,update_mask"; + } + + // Updates a notification config. The following update + // fields are allowed: description, pubsub_topic, streaming_config.filter + rpc UpdateNotificationConfig(UpdateNotificationConfigRequest) returns (NotificationConfig) { + option (google.api.http) = { + patch: "/v1p1beta1/{notification_config.name=organizations/*/notificationConfigs/*}" + body: "notification_config" + }; + option (google.api.method_signature) = "notification_config"; + option (google.api.method_signature) = "notification_config,update_mask"; + } + + // Updates an organization's settings. + rpc UpdateOrganizationSettings(UpdateOrganizationSettingsRequest) returns (OrganizationSettings) { + option (google.api.http) = { + patch: "/v1p1beta1/{organization_settings.name=organizations/*/organizationSettings}" + body: "organization_settings" + }; + option (google.api.method_signature) = "organization_settings"; + } + + // Updates a source. + rpc UpdateSource(UpdateSourceRequest) returns (Source) { + option (google.api.http) = { + patch: "/v1p1beta1/{source.name=organizations/*/sources/*}" + body: "source" + }; + option (google.api.method_signature) = "source"; + option (google.api.method_signature) = "source,update_mask"; + } + + // Updates security marks. + rpc UpdateSecurityMarks(UpdateSecurityMarksRequest) returns (SecurityMarks) { + option (google.api.http) = { + patch: "/v1p1beta1/{security_marks.name=organizations/*/assets/*/securityMarks}" + body: "security_marks" + additional_bindings { + patch: "/v1p1beta1/{security_marks.name=folders/*/assets/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1p1beta1/{security_marks.name=projects/*/assets/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1p1beta1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1p1beta1/{security_marks.name=folders/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + additional_bindings { + patch: "/v1p1beta1/{security_marks.name=projects/*/sources/*/findings/*/securityMarks}" + body: "security_marks" + } + }; + option (google.api.method_signature) = "security_marks"; + option (google.api.method_signature) = "security_marks,update_mask"; + } +} + +// Request message for creating a finding. +message CreateFindingRequest { + // Required. Resource name of the new finding's parent. Its format should be + // "organizations/[organization_id]/sources/[source_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Required. Unique identifier provided by the client within the parent scope. + string finding_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Finding being created. The name and security_marks will be ignored as + // they are both output only fields on this resource. + Finding finding = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for creating a notification config. +message CreateNotificationConfigRequest { + // Required. Resource name of the new notification config's parent. Its format is + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Required. Unique identifier provided by the client within the parent scope. + // It must be between 1 and 128 characters, and contains alphanumeric + // characters, underscores or hyphens only. + string config_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The notification config being created. The name and the service account + // will be ignored as they are both output only fields on this resource. + NotificationConfig notification_config = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for creating a source. +message CreateSourceRequest { + // Required. Resource name of the new source's parent. Its format should be + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // Required. The Source being created, only the display_name and description will be + // used. All other fields will be ignored. + Source source = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for deleting a notification config. +message DeleteNotificationConfigRequest { + // Required. Name of the notification config to delete. Its format is + // "organizations/[organization_id]/notificationConfigs/[config_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/NotificationConfig" + } + ]; +} + +// Request message for getting a notification config. +message GetNotificationConfigRequest { + // Required. Name of the notification config to get. Its format is + // "organizations/[organization_id]/notificationConfigs/[config_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/NotificationConfig" + } + ]; +} + +// Request message for getting organization settings. +message GetOrganizationSettingsRequest { + // Required. Name of the organization to get organization settings for. Its format is + // "organizations/[organization_id]/organizationSettings". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/OrganizationSettings" + } + ]; +} + +// Request message for getting a source. +message GetSourceRequest { + // Required. Relative resource name of the source. Its format is + // "organizations/[organization_id]/source/[source_id]". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; +} + +// Request message for grouping by assets. +message GroupAssetsRequest { + // Required. Name of the organization to groupBy. Its format is + // "organizations/[organization_id], folders/[folder_id], or + // projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/Asset" + } + ]; + + // Expression that defines the filter to apply across assets. + // The expression is a list of zero or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. The fields map to those + // defined in the Asset resource. Examples include: + // + // * name + // * security_center_properties.resource_name + // * resource_properties.a_property + // * security_marks.marks.marka + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + // + // The following field and operator combinations are supported: + // + // * name: `=` + // * update_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `update_time = "2019-06-10T16:07:18-07:00"` + // `update_time = 1560208038000` + // + // * create_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `create_time = "2019-06-10T16:07:18-07:00"` + // `create_time = 1560208038000` + // + // * iam_policy.policy_blob: `=`, `:` + // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // * security_marks.marks: `=`, `:` + // * security_center_properties.resource_name: `=`, `:` + // * security_center_properties.resource_name_display_name: `=`, `:` + // * security_center_properties.resource_type: `=`, `:` + // * security_center_properties.resource_parent: `=`, `:` + // * security_center_properties.resource_parent_display_name: `=`, `:` + // * security_center_properties.resource_project: `=`, `:` + // * security_center_properties.resource_project_display_name: `=`, `:` + // * security_center_properties.resource_owners: `=`, `:` + // + // For example, `resource_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `resource_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-resource_properties.my_property : ""` + string filter = 2; + + // Required. Expression that defines what assets fields to use for grouping. The string + // value should follow SQL syntax: comma separated list of fields. For + // example: + // "security_center_properties.resource_project,security_center_properties.project". + // + // The following fields are supported when compare_duration is not set: + // + // * security_center_properties.resource_project + // * security_center_properties.resource_project_display_name + // * security_center_properties.resource_type + // * security_center_properties.resource_parent + // * security_center_properties.resource_parent_display_name + // + // The following fields are supported when compare_duration is set: + // + // * security_center_properties.resource_type + // * security_center_properties.resource_project_display_name + // * security_center_properties.resource_parent_display_name + string group_by = 3 [(google.api.field_behavior) = REQUIRED]; + + // When compare_duration is set, the GroupResult's "state_change" property is + // updated to indicate whether the asset was added, removed, or remained + // present during the compare_duration period of time that precedes the + // read_time. This is the time between (read_time - compare_duration) and + // read_time. + // + // The state change value is derived based on the presence of the asset at the + // two points in time. Intermediate state changes between the two times don't + // affect the result. For example, the results aren't affected if the asset is + // removed and re-created again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "ADDED": indicates that the asset was not present at the start of + // compare_duration, but present at reference_time. + // * "REMOVED": indicates that the asset was present at the start of + // compare_duration, but not present at reference_time. + // * "ACTIVE": indicates that the asset was present at both the + // start and the end of the time period defined by + // compare_duration and reference_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all assets present at + // read_time. + // + // If this field is set then `state_change` must be a specified field in + // `group_by`. + google.protobuf.Duration compare_duration = 4; + + // Time used as a reference point when filtering assets. The filter is limited + // to assets existing at the supplied time and their values are those at that + // specific time. Absence of this field will default to the API's version of + // NOW. + google.protobuf.Timestamp read_time = 5; + + // The value returned by the last `GroupAssetsResponse`; indicates + // that this is a continuation of a prior `GroupAssets` call, and that the + // system should return the next page of data. + string page_token = 7; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 8; +} + +// Response message for grouping by assets. +message GroupAssetsResponse { + // Group results. There exists an element for each existing unique + // combination of property/values. The element contains a count for the number + // of times those specific property/values appear. + repeated GroupResult group_by_results = 1; + + // Time used for executing the groupBy request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of results matching the query. + int32 total_size = 4; +} + +// Request message for grouping by findings. +message GroupFindingsRequest { + // Required. Name of the source to groupBy. Its format is + // "organizations/[organization_id]/sources/[source_id]", + // folders/[folder_id]/sources/[source_id], or + // projects/[project_id]/sources/[source_id]. To groupBy across all sources + // provide a source_id of `-`. For example: + // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + // or projects/{project_id}/sources/- + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Expression that defines the filter to apply across findings. + // The expression is a list of one or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. Examples include: + // + // * name + // * source_properties.a_property + // * security_marks.marks.marka + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + // + // The following field and operator combinations are supported: + // + // * name: `=` + // * parent: `=`, `:` + // * resource_name: `=`, `:` + // * state: `=`, `:` + // * category: `=`, `:` + // * external_uri: `=`, `:` + // * event_time: `=`, `>`, `<`, `>=`, `<=` + // * severity: `=`, `:` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `event_time = "2019-06-10T16:07:18-07:00"` + // `event_time = 1560208038000` + // + // * security_marks.marks: `=`, `:` + // * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // + // For example, `source_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `source_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-source_properties.my_property : ""` + string filter = 2; + + // Required. Expression that defines what assets fields to use for grouping (including + // `state_change`). The string value should follow SQL syntax: comma separated + // list of fields. For example: "parent,resource_name". + // + // The following fields are supported: + // + // * resource_name + // * category + // * state + // * parent + // * severity + // + // The following fields are supported when compare_duration is set: + // + // * state_change + string group_by = 3 [(google.api.field_behavior) = REQUIRED]; + + // Time used as a reference point when filtering findings. The filter is + // limited to findings existing at the supplied time and their values are + // those at that specific time. Absence of this field will default to the + // API's version of NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the GroupResult's "state_change" attribute is + // updated to indicate whether the finding had its state changed, the + // finding's state remained unchanged, or if the finding was added during the + // compare_duration period of time that precedes the read_time. This is the + // time between (read_time - compare_duration) and read_time. + // + // The state_change value is derived based on the presence and state of the + // finding at the two points in time. Intermediate state changes between the + // two times don't affect the result. For example, the results aren't affected + // if the finding is made inactive and then active again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "CHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration, but changed its + // state at read_time. + // * "UNCHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration and did not change + // state at read_time. + // * "ADDED": indicates that the finding did not match the given filter or + // was not present at the start of compare_duration, but was + // present at read_time. + // * "REMOVED": indicates that the finding was present and matched the + // filter at the start of compare_duration, but did not match + // the filter at read_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all findings present + // at read_time. + // + // If this field is set then `state_change` must be a specified field in + // `group_by`. + google.protobuf.Duration compare_duration = 5; + + // The value returned by the last `GroupFindingsResponse`; indicates + // that this is a continuation of a prior `GroupFindings` call, and + // that the system should return the next page of data. + string page_token = 7; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 8; +} + +// Response message for group by findings. +message GroupFindingsResponse { + // Group results. There exists an element for each existing unique + // combination of property/values. The element contains a count for the number + // of times those specific property/values appear. + repeated GroupResult group_by_results = 1; + + // Time used for executing the groupBy request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of results matching the query. + int32 total_size = 4; +} + +// Result containing the properties and count of a groupBy request. +message GroupResult { + // Properties matching the groupBy fields in the request. + map properties = 1; + + // Total count of resources for the given properties. + int64 count = 2; +} + +// Request message for listing notification configs. +message ListNotificationConfigsRequest { + // Required. Name of the organization to list notification configs. + // Its format is "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; + + // The value returned by the last `ListNotificationConfigsResponse`; indicates + // that this is a continuation of a prior `ListNotificationConfigs` call, and + // that the system should return the next page of data. + string page_token = 2; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 3; +} + +// Response message for listing notification configs. +message ListNotificationConfigsResponse { + // Notification configs belonging to the requested parent. + repeated NotificationConfig notification_configs = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 2; +} + +// Request message for listing sources. +message ListSourcesRequest { + // Required. Resource name of the parent of sources to list. Its format should be + // "organizations/[organization_id], folders/[folder_id], or + // projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/Source" + } + ]; + + // The value returned by the last `ListSourcesResponse`; indicates + // that this is a continuation of a prior `ListSources` call, and + // that the system should return the next page of data. + string page_token = 2; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 7; +} + +// Response message for listing sources. +message ListSourcesResponse { + // Sources belonging to the requested parent. + repeated Source sources = 1; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 2; +} + +// Request message for listing assets. +message ListAssetsRequest { + // Required. Name of the organization assets should belong to. Its format is + // "organizations/[organization_id], folders/[folder_id], or + // projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/Asset" + } + ]; + + // Expression that defines the filter to apply across assets. + // The expression is a list of zero or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. The fields map to those + // defined in the Asset resource. Examples include: + // + // * name + // * security_center_properties.resource_name + // * resource_properties.a_property + // * security_marks.marks.marka + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + // + // The following are the allowed field and operator combinations: + // + // * name: `=` + // * update_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `update_time = "2019-06-10T16:07:18-07:00"` + // `update_time = 1560208038000` + // + // * create_time: `=`, `>`, `<`, `>=`, `<=` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `create_time = "2019-06-10T16:07:18-07:00"` + // `create_time = 1560208038000` + // + // * iam_policy.policy_blob: `=`, `:` + // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // * security_marks.marks: `=`, `:` + // * security_center_properties.resource_name: `=`, `:` + // * security_center_properties.resource_display_name: `=`, `:` + // * security_center_properties.resource_type: `=`, `:` + // * security_center_properties.resource_parent: `=`, `:` + // * security_center_properties.resource_parent_display_name: `=`, `:` + // * security_center_properties.resource_project: `=`, `:` + // * security_center_properties.resource_project_display_name: `=`, `:` + // * security_center_properties.resource_owners: `=`, `:` + // + // For example, `resource_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `resource_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-resource_properties.my_property : ""` + string filter = 2; + + // Expression that defines what fields and order to use for sorting. The + // string value should follow SQL syntax: comma separated list of fields. For + // example: "name,resource_properties.a_property". The default sorting order + // is ascending. To specify descending order for a field, a suffix " desc" + // should be appended to the field name. For example: "name + // desc,resource_properties.a_property". Redundant space characters in the + // syntax are insignificant. "name desc,resource_properties.a_property" and " + // name desc , resource_properties.a_property " are equivalent. + // + // The following fields are supported: + // name + // update_time + // resource_properties + // security_marks.marks + // security_center_properties.resource_name + // security_center_properties.resource_display_name + // security_center_properties.resource_parent + // security_center_properties.resource_parent_display_name + // security_center_properties.resource_project + // security_center_properties.resource_project_display_name + // security_center_properties.resource_type + string order_by = 3; + + // Time used as a reference point when filtering assets. The filter is limited + // to assets existing at the supplied time and their values are those at that + // specific time. Absence of this field will default to the API's version of + // NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the ListAssetsResult's "state_change" + // attribute is updated to indicate whether the asset was added, removed, or + // remained present during the compare_duration period of time that precedes + // the read_time. This is the time between (read_time - compare_duration) and + // read_time. + // + // The state_change value is derived based on the presence of the asset at the + // two points in time. Intermediate state changes between the two times don't + // affect the result. For example, the results aren't affected if the asset is + // removed and re-created again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "ADDED": indicates that the asset was not present at the start of + // compare_duration, but present at read_time. + // * "REMOVED": indicates that the asset was present at the start of + // compare_duration, but not present at read_time. + // * "ACTIVE": indicates that the asset was present at both the + // start and the end of the time period defined by + // compare_duration and read_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all assets present at + // read_time. + google.protobuf.Duration compare_duration = 5; + + // A field mask to specify the ListAssetsResult fields to be listed in the + // response. + // An empty field mask will list all fields. + google.protobuf.FieldMask field_mask = 7; + + // The value returned by the last `ListAssetsResponse`; indicates + // that this is a continuation of a prior `ListAssets` call, and + // that the system should return the next page of data. + string page_token = 8; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 9; +} + +// Response message for listing assets. +message ListAssetsResponse { + // Result containing the Asset and its State. + message ListAssetsResult { + // The change in state of the asset. + // + // When querying across two points in time this describes + // the change between the two points: ADDED, REMOVED, or ACTIVE. + // If there was no compare_duration supplied in the request the state change + // will be: UNUSED + enum StateChange { + // State change is unused, this is the canonical default for this enum. + UNUSED = 0; + + // Asset was added between the points in time. + ADDED = 1; + + // Asset was removed between the points in time. + REMOVED = 2; + + // Asset was present at both point(s) in time. + ACTIVE = 3; + } + + // Asset matching the search request. + Asset asset = 1; + + // State change of the asset between the points in time. + StateChange state_change = 2; + } + + // Assets matching the list request. + repeated ListAssetsResult list_assets_results = 1; + + // Time used for executing the list request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of assets matching the query. + int32 total_size = 4; +} + +// Request message for listing findings. +message ListFindingsRequest { + // Required. Name of the source the findings belong to. Its format is + // "organizations/[organization_id]/sources/[source_id], + // folders/[folder_id]/sources/[source_id], or + // projects/[project_id]/sources/[source_id]". To list across all sources + // provide a source_id of `-`. For example: + // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + // projects/{projects_id}/sources/- + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Source" + } + ]; + + // Expression that defines the filter to apply across findings. + // The expression is a list of one or more restrictions combined via logical + // operators `AND` and `OR`. + // Parentheses are supported, and `OR` has higher precedence than `AND`. + // + // Restrictions have the form ` ` and may have a `-` + // character in front of them to indicate negation. Examples include: + // + // * name + // * source_properties.a_property + // * security_marks.marks.marka + // + // The supported operators are: + // + // * `=` for all value types. + // * `>`, `<`, `>=`, `<=` for integer values. + // * `:`, meaning substring matching, for strings. + // + // The supported value types are: + // + // * string literals in quotes. + // * integer literals without quotes. + // * boolean literals `true` and `false` without quotes. + // + // The following field and operator combinations are supported: + // + // * name: `=` + // * parent: `=`, `:` + // * resource_name: `=`, `:` + // * state: `=`, `:` + // * category: `=`, `:` + // * external_uri: `=`, `:` + // * event_time: `=`, `>`, `<`, `>=`, `<=` + // * severity: `=`, `:` + // + // Usage: This should be milliseconds since epoch or an RFC3339 string. + // Examples: + // `event_time = "2019-06-10T16:07:18-07:00"` + // `event_time = 1560208038000` + // + // security_marks.marks: `=`, `:` + // source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + // + // For example, `source_properties.size = 100` is a valid filter string. + // + // Use a partial match on the empty string to filter based on a property + // existing: `source_properties.my_property : ""` + // + // Use a negated partial match on the empty string to filter based on a + // property not existing: `-source_properties.my_property : ""` + string filter = 2; + + // Expression that defines what fields and order to use for sorting. The + // string value should follow SQL syntax: comma separated list of fields. For + // example: "name,resource_properties.a_property". The default sorting order + // is ascending. To specify descending order for a field, a suffix " desc" + // should be appended to the field name. For example: "name + // desc,source_properties.a_property". Redundant space characters in the + // syntax are insignificant. "name desc,source_properties.a_property" and " + // name desc , source_properties.a_property " are equivalent. + // + // The following fields are supported: + // name + // parent + // state + // category + // resource_name + // event_time + // source_properties + // security_marks.marks + string order_by = 3; + + // Time used as a reference point when filtering findings. The filter is + // limited to findings existing at the supplied time and their values are + // those at that specific time. Absence of this field will default to the + // API's version of NOW. + google.protobuf.Timestamp read_time = 4; + + // When compare_duration is set, the ListFindingsResult's "state_change" + // attribute is updated to indicate whether the finding had its state changed, + // the finding's state remained unchanged, or if the finding was added in any + // state during the compare_duration period of time that precedes the + // read_time. This is the time between (read_time - compare_duration) and + // read_time. + // + // The state_change value is derived based on the presence and state of the + // finding at the two points in time. Intermediate state changes between the + // two times don't affect the result. For example, the results aren't affected + // if the finding is made inactive and then active again. + // + // Possible "state_change" values when compare_duration is specified: + // + // * "CHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration, but changed its + // state at read_time. + // * "UNCHANGED": indicates that the finding was present and matched the given + // filter at the start of compare_duration and did not change + // state at read_time. + // * "ADDED": indicates that the finding did not match the given filter or + // was not present at the start of compare_duration, but was + // present at read_time. + // * "REMOVED": indicates that the finding was present and matched the + // filter at the start of compare_duration, but did not match + // the filter at read_time. + // + // If compare_duration is not specified, then the only possible state_change + // is "UNUSED", which will be the state_change set for all findings present at + // read_time. + google.protobuf.Duration compare_duration = 5; + + // A field mask to specify the Finding fields to be listed in the response. + // An empty field mask will list all fields. + google.protobuf.FieldMask field_mask = 7; + + // The value returned by the last `ListFindingsResponse`; indicates + // that this is a continuation of a prior `ListFindings` call, and + // that the system should return the next page of data. + string page_token = 8; + + // The maximum number of results to return in a single response. Default is + // 10, minimum is 1, maximum is 1000. + int32 page_size = 9; +} + +// Response message for listing findings. +message ListFindingsResponse { + // Result containing the Finding and its StateChange. + message ListFindingsResult { + // Information related to the Google Cloud resource that is + // associated with this finding. + message Resource { + // The full resource name of the resource. See: + // https://cloud.google.com/apis/design/resource_names#full_resource_name + string name = 1; + + // The full resource name of project that the resource belongs to. + string project_name = 2; + + // The human readable name of project that the resource belongs to. + string project_display_name = 3; + + // The full resource name of resource's parent. + string parent_name = 4; + + // The human readable name of resource's parent. + string parent_display_name = 5; + + // Contains a Folder message for each folder in the assets ancestry. + // The first folder is the deepest nested folder, and the last folder is + // the folder directly under the Organization. + repeated Folder folders = 10; + } + + // The change in state of the finding. + // + // When querying across two points in time this describes + // the change in the finding between the two points: CHANGED, UNCHANGED, + // ADDED, or REMOVED. Findings can not be deleted, so REMOVED implies that + // the finding at timestamp does not match the filter specified, but it did + // at timestamp - compare_duration. If there was no compare_duration + // supplied in the request the state change will be: UNUSED + enum StateChange { + // State change is unused, this is the canonical default for this enum. + UNUSED = 0; + + // The finding has changed state in some way between the points in time + // and existed at both points. + CHANGED = 1; + + // The finding has not changed state between the points in time and + // existed at both points. + UNCHANGED = 2; + + // The finding was created between the points in time. + ADDED = 3; + + // The finding at timestamp does not match the filter specified, but it + // did at timestamp - compare_duration. + REMOVED = 4; + } + + // Finding matching the search request. + Finding finding = 1; + + // State change of the finding between the points in time. + StateChange state_change = 2; + + // Output only. Resource that is associated with this finding. + Resource resource = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Findings matching the list request. + repeated ListFindingsResult list_findings_results = 1; + + // Time used for executing the list request. + google.protobuf.Timestamp read_time = 2; + + // Token to retrieve the next page of results, or empty if there are no more + // results. + string next_page_token = 3; + + // The total number of findings matching the query. + int32 total_size = 4; +} + +// Request message for updating a finding's state. +message SetFindingStateRequest { + // Required. The relative resource name of the finding. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/Finding" + } + ]; + + // Required. The desired State of the finding. + Finding.State state = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The time at which the updated state takes effect. + google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for running asset discovery for an organization. +message RunAssetDiscoveryRequest { + // Required. Name of the organization to run asset discovery for. Its format is + // "organizations/[organization_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Organization" + } + ]; +} + +// Request message for updating or creating a finding. +message UpdateFindingRequest { + // Required. The finding resource to update or create if it does not already exist. + // parent, security_marks, and update_time will be ignored. + // + // In the case of creation, the finding id portion of the name must be + // alphanumeric and less than or equal to 32 characters and greater than 0 + // characters in length. + Finding finding = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the finding resource. This field should + // not be specified when creating a finding. + // + // When updating a finding, an empty mask is treated as updating all mutable + // fields and replacing source_properties. Individual source_properties can + // be added/updated by using "source_properties." in the field + // mask. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a notification config. +message UpdateNotificationConfigRequest { + // Required. The notification config to update. + NotificationConfig notification_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the notification config. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating an organization's settings. +message UpdateOrganizationSettingsRequest { + // Required. The organization settings resource to update. + OrganizationSettings organization_settings = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the settings resource. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a source. +message UpdateSourceRequest { + // Required. The source resource to update. + Source source = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the source resource. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for updating a SecurityMarks resource. +message UpdateSecurityMarksRequest { + // Required. The security marks resource to update. + SecurityMarks security_marks = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the security marks resource. + // + // The field mask must not contain duplicate fields. + // If empty or set to "marks", all marks will be replaced. Individual + // marks can be updated using "marks.". + google.protobuf.FieldMask update_mask = 2; + + // The time at which the updated SecurityMarks take effect. + // If not set uses current server time. Updates will be applied to the + // SecurityMarks that are active immediately preceding this time. + google.protobuf.Timestamp start_time = 3; +} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto new file mode 100644 index 00000000..5f36167a --- /dev/null +++ b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto @@ -0,0 +1,69 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1p1beta1; + +import "google/api/resource.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1p1beta1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; + +// Security Command Center finding source. A finding source +// is an entity or a mechanism that can produce a finding. A source is like a +// container of findings that come from the same scanner, logger, monitor, etc. +message Source { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/Source" + pattern: "organizations/{organization}/sources/{source}" + pattern: "folders/{folder}/sources/{source}" + pattern: "projects/{project}/sources/{source}" + }; + + // The relative resource name of this source. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name + // Example: + // "organizations/{organization_id}/sources/{source_id}" + string name = 1; + + // The source's display name. + // A source's display name must be unique amongst its siblings, for example, + // two sources with the same parent can't share the same display name. + // The display name must have a length between 1 and 64 characters + // (inclusive). + string display_name = 2; + + // The description of the source (max of 1024 characters). + // Example: + // "Web Security Scanner is a web security scanner for common + // vulnerabilities in App Engine applications. It can automatically + // scan and detect four common vulnerabilities, including cross-site-scripting + // (XSS), Flash injection, mixed content (HTTP in HTTPS), and + // outdated/insecure libraries." + string description = 3; + + // The canonical name of the finding. It's either + // "organizations/{organization_id}/sources/{source_id}", + // "folders/{folder_id}/sources/{source_id}" or + // "projects/{project_number}/sources/{source_id}", + // depending on the closest CRM ancestor of the resource associated with the + // finding. + string canonical_name = 14; +} diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js new file mode 100644 index 00000000..9eb96389 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js @@ -0,0 +1,65 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, findingId, finding) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + */ + // const parent = 'abc123' + /** + * Required. Unique identifier provided by the client within the parent scope. + */ + // const findingId = 'abc123' + /** + * Required. The Finding being created. The name and security_marks will be ignored as + * they are both output only fields on this resource. + */ + // const finding = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateFinding() { + // Construct request + const request = { + parent, + findingId, + finding, + }; + + // Run request + const response = await securitycenterClient.createFinding(request); + console.log(response); + } + + callCreateFinding(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js new file mode 100644 index 00000000..290b2f86 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, configId, notificationConfig) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new notification config's parent. Its format is + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * Required. Unique identifier provided by the client within the parent scope. + * It must be between 1 and 128 characters, and contains alphanumeric + * characters, underscores or hyphens only. + */ + // const configId = 'abc123' + /** + * Required. The notification config being created. The name and the service account + * will be ignored as they are both output only fields on this resource. + */ + // const notificationConfig = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateNotificationConfig() { + // Construct request + const request = { + parent, + configId, + notificationConfig, + }; + + // Run request + const response = await securitycenterClient.createNotificationConfig(request); + console.log(response); + } + + callCreateNotificationConfig(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js new file mode 100644 index 00000000..fba03b1b --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js @@ -0,0 +1,60 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, source) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * Required. The Source being created, only the display_name and description will be + * used. All other fields will be ignored. + */ + // const source = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateSource() { + // Construct request + const request = { + parent, + source, + }; + + // Run request + const response = await securitycenterClient.createSource(request); + console.log(response); + } + + callCreateSource(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js new file mode 100644 index 00000000..77462b2f --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the notification config to delete. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callDeleteNotificationConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.deleteNotificationConfig(request); + console.log(response); + } + + callDeleteNotificationConfig(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js new file mode 100644 index 00000000..90c348ab --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js @@ -0,0 +1,59 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(resource) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + */ + // const options = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await securitycenterClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js new file mode 100644 index 00000000..120dba67 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the notification config to get. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetNotificationConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getNotificationConfig(request); + console.log(response); + } + + callGetNotificationConfig(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js new file mode 100644 index 00000000..d09f46d4 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to get organization settings for. Its format is + * "organizations/[organization_id]/organizationSettings". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetOrganizationSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getOrganizationSettings(request); + console.log(response); + } + + callGetOrganizationSettings(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js new file mode 100644 index 00000000..968bb024 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + */ + // const name = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGetSource() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getSource(request); + console.log(response); + } + + callGetSource(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js new file mode 100644 index 00000000..2615ed82 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js @@ -0,0 +1,168 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, groupBy) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * The supported operators are: + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * The supported value types are: + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * The following field and operator combinations are supported: + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_name_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * For example, `resource_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + */ + // const filter = 'abc123' + /** + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * The following fields are supported when compare_duration is not set: + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * The following fields are supported when compare_duration is set: + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + */ + // const groupBy = 'abc123' + /** + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * Possible "state_change" values when compare_duration is specified: + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * If this field is set then `state_change` must be a specified field in + * `group_by`. + */ + // const compareDuration = {} + /** + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + */ + // const readTime = {} + /** + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGroupAssets() { + // Construct request + const request = { + parent, + groupBy, + }; + + // Run request + const iterable = await securitycenterClient.groupAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGroupAssets(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js new file mode 100644 index 00000000..87f7ec5a --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js @@ -0,0 +1,164 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent, groupBy) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * The supported operators are: + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * The supported value types are: + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * The following field and operator combinations are supported: + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + */ + // const filter = 'abc123' + /** + * Required. Expression that defines what assets fields to use for grouping (including + * `state_change`). The string value should follow SQL syntax: comma separated + * list of fields. For example: "parent,resource_name". + * The following fields are supported: + * * resource_name + * * category + * * state + * * parent + * * severity + * The following fields are supported when compare_duration is set: + * * state_change + */ + // const groupBy = 'abc123' + /** + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * Possible "state_change" values when compare_duration is specified: + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * If this field is set then `state_change` must be a specified field in + * `group_by`. + */ + // const compareDuration = {} + /** + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callGroupFindings() { + // Construct request + const request = { + parent, + groupBy, + }; + + // Run request + const iterable = await securitycenterClient.groupFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGroupFindings(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js new file mode 100644 index 00000000..edb3f4ae --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js @@ -0,0 +1,177 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * The supported operators are: + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * The supported value types are: + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * The following are the allowed field and operator combinations: + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * For example, `resource_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + */ + // const filter = 'abc123' + /** + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + */ + // const orderBy = 'abc123' + /** + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * Possible "state_change" values when compare_duration is specified: + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + */ + // const compareDuration = {} + /** + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + */ + // const fieldMask = {} + /** + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListAssets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAssets(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js new file mode 100644 index 00000000..58d5fd5f --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js @@ -0,0 +1,173 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + */ + // const parent = 'abc123' + /** + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * The supported operators are: + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * The supported value types are: + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * The following field and operator combinations are supported: + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * security_marks.marks: `=`, `:` + * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * For example, `source_properties.size = 100` is a valid filter string. + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + */ + // const filter = 'abc123' + /** + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + */ + // const orderBy = 'abc123' + /** + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + */ + // const readTime = {} + /** + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * Possible "state_change" values when compare_duration is specified: + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + */ + // const compareDuration = {} + /** + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + */ + // const fieldMask = {} + /** + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListFindings() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFindings(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js new file mode 100644 index 00000000..d00b3a8f --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + */ + // const parent = 'abc123' + /** + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListNotificationConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listNotificationConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListNotificationConfigs(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js new file mode 100644 index 00000000..d3e5613c --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js @@ -0,0 +1,68 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + */ + // const parent = 'abc123' + /** + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + */ + // const pageSize = 1234 + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListSources() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listSourcesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSources(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js new file mode 100644 index 00000000..0563f160 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the organization to run asset discovery for. Its format is + * "organizations/[organization_id]". + */ + // const parent = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callRunAssetDiscovery() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await securitycenterClient.runAssetDiscovery(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRunAssetDiscovery(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js new file mode 100644 index 00000000..99d97f27 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(name, state, startTime) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative resource name of the finding. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + */ + // const name = 'abc123' + /** + * Required. The desired State of the finding. + */ + // const state = {} + /** + * Required. The time at which the updated state takes effect. + */ + // const startTime = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetFindingState() { + // Construct request + const request = { + name, + state, + startTime, + }; + + // Run request + const response = await securitycenterClient.setFindingState(request); + console.log(response); + } + + callSetFindingState(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js new file mode 100644 index 00000000..8fdb23eb --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(resource, policy) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + */ + // const policy = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await securitycenterClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js new file mode 100644 index 00000000..e69d5caf --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(resource, permissions) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). + */ + // const permissions = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await securitycenterClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js new file mode 100644 index 00000000..9dcc69b5 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(finding) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The finding resource to update or create if it does not already exist. + * parent, security_marks, and update_time will be ignored. + * In the case of creation, the finding id portion of the name must be + * alphanumeric and less than or equal to 32 characters and greater than 0 + * characters in length. + */ + // const finding = {} + /** + * The FieldMask to use when updating the finding resource. This field should + * not be specified when creating a finding. + * When updating a finding, an empty mask is treated as updating all mutable + * fields and replacing source_properties. Individual source_properties can + * be added/updated by using "source_properties." in the field + * mask. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateFinding() { + // Construct request + const request = { + finding, + }; + + // Run request + const response = await securitycenterClient.updateFinding(request); + console.log(response); + } + + callUpdateFinding(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js new file mode 100644 index 00000000..54718b4b --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(notificationConfig) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The notification config to update. + */ + // const notificationConfig = {} + /** + * The FieldMask to use when updating the notification config. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateNotificationConfig() { + // Construct request + const request = { + notificationConfig, + }; + + // Run request + const response = await securitycenterClient.updateNotificationConfig(request); + console.log(response); + } + + callUpdateNotificationConfig(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js new file mode 100644 index 00000000..0786b122 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(organizationSettings) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The organization settings resource to update. + */ + // const organizationSettings = {} + /** + * The FieldMask to use when updating the settings resource. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateOrganizationSettings() { + // Construct request + const request = { + organizationSettings, + }; + + // Run request + const response = await securitycenterClient.updateOrganizationSettings(request); + console.log(response); + } + + callUpdateOrganizationSettings(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js new file mode 100644 index 00000000..33cfe18d --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(securityMarks) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The security marks resource to update. + */ + // const securityMarks = {} + /** + * The FieldMask to use when updating the security marks resource. + * The field mask must not contain duplicate fields. + * If empty or set to "marks", all marks will be replaced. Individual + * marks can be updated using "marks.". + */ + // const updateMask = {} + /** + * The time at which the updated SecurityMarks take effect. + * If not set uses current server time. Updates will be applied to the + * SecurityMarks that are active immediately preceding this time. + */ + // const startTime = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateSecurityMarks() { + // Construct request + const request = { + securityMarks, + }; + + // Run request + const response = await securitycenterClient.updateSecurityMarks(request); + console.log(response); + } + + callUpdateSecurityMarks(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js new file mode 100644 index 00000000..9078baab --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +'use strict'; + +function main(source) { + // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The source resource to update. + */ + // const source = {} + /** + * The FieldMask to use when updating the source resource. + * If empty all mutable fields will be updated. + */ + // const updateMask = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callUpdateSource() { + // Construct request + const request = { + source, + }; + + // Run request + const response = await securitycenterClient.updateSource(request); + console.log(response); + } + + callUpdateSource(); + // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/src/index.ts b/owl-bot-staging/v1p1beta1/src/index.ts new file mode 100644 index 00000000..6ddd67bf --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/index.ts @@ -0,0 +1,25 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1p1beta1 from './v1p1beta1'; +const SecurityCenterClient = v1p1beta1.SecurityCenterClient; +type SecurityCenterClient = v1p1beta1.SecurityCenterClient; +export {v1p1beta1, SecurityCenterClient}; +export default {v1p1beta1, SecurityCenterClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json b/owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json new file mode 100644 index 00000000..c0d8ccc6 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json @@ -0,0 +1,277 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.securitycenter.v1p1beta1", + "libraryPackage": "@google-cloud/security-center", + "services": { + "SecurityCenter": { + "clients": { + "grpc": { + "libraryClient": "SecurityCenterClient", + "rpcs": { + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "CreateFinding": { + "methods": [ + "createFinding" + ] + }, + "CreateNotificationConfig": { + "methods": [ + "createNotificationConfig" + ] + }, + "DeleteNotificationConfig": { + "methods": [ + "deleteNotificationConfig" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetNotificationConfig": { + "methods": [ + "getNotificationConfig" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateNotificationConfig": { + "methods": [ + "updateNotificationConfig" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListNotificationConfigs": { + "methods": [ + "listNotificationConfigs", + "listNotificationConfigsStream", + "listNotificationConfigsAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SecurityCenterClient", + "rpcs": { + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "CreateFinding": { + "methods": [ + "createFinding" + ] + }, + "CreateNotificationConfig": { + "methods": [ + "createNotificationConfig" + ] + }, + "DeleteNotificationConfig": { + "methods": [ + "deleteNotificationConfig" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetNotificationConfig": { + "methods": [ + "getNotificationConfig" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateNotificationConfig": { + "methods": [ + "updateNotificationConfig" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListNotificationConfigs": { + "methods": [ + "listNotificationConfigs", + "listNotificationConfigsStream", + "listNotificationConfigsAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts b/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts new file mode 100644 index 00000000..de26020d --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts @@ -0,0 +1,19 @@ +// 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. +// +// ** 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 {SecurityCenterClient} from './security_center_client'; diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client.ts b/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client.ts new file mode 100644 index 00000000..77aa23f6 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client.ts @@ -0,0 +1,4923 @@ +// 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. +// +// ** 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, LROperation, 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/v1p1beta1/security_center_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './security_center_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * V1p1Beta1 APIs for Security Center service. + * @class + * @memberof v1p1beta1 + */ +export class SecurityCenterClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + securityCenterStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SecurityCenterClient. + * + * @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). + * 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} [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. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SecurityCenterClient; + 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 = { + folderAssetPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/assets/{asset}' + ), + folderAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/assets/{asset}/securityMarks' + ), + folderSourcePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}' + ), + folderSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}/findings/{finding}' + ), + folderSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}/findings/{finding}/securityMarks' + ), + notificationConfigPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationConfigs/{notification_config}' + ), + organizationPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}' + ), + organizationAssetPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/assets/{asset}' + ), + organizationAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/assets/{asset}/securityMarks' + ), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/organizationSettings' + ), + organizationSourcePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}' + ), + organizationSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}' + ), + organizationSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' + ), + projectAssetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/assets/{asset}' + ), + projectAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/assets/{asset}/securityMarks' + ), + projectSourcePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}' + ), + projectSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}/findings/{finding}' + ), + projectSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}/findings/{finding}/securityMarks' + ), + }; + + // 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 = { + groupAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), + groupFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), + listAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listAssetsResults'), + listFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listFindingsResults'), + listNotificationConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notificationConfigs'), + listSources: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const runAssetDiscoveryResponse = protoFilesRoot.lookup( + '.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryResponse') as gax.protobuf.Type; + const runAssetDiscoveryMetadata = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + + this.descriptors.longrunning = { + runAssetDiscovery: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), + runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.securitycenter.v1p1beta1.SecurityCenter', 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.securityCenterStub) { + return this.securityCenterStub; + } + + // Put together the "service stub" for + // google.cloud.securitycenter.v1p1beta1.SecurityCenter. + this.securityCenterStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.securitycenter.v1p1beta1.SecurityCenter') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.securitycenter.v1p1beta1.SecurityCenter, + 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 securityCenterStubMethods = + ['createSource', 'createFinding', 'createNotificationConfig', 'deleteNotificationConfig', 'getIamPolicy', 'getNotificationConfig', 'getOrganizationSettings', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listFindings', 'listNotificationConfigs', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setIamPolicy', 'testIamPermissions', 'updateFinding', 'updateNotificationConfig', 'updateOrganizationSettings', 'updateSource', 'updateSecurityMarks']; + for (const methodName of securityCenterStubMethods) { + const callPromise = this.securityCenterStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.securityCenterStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'securitycenter.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 'securitycenter.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 source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new source's parent. Its format should be + * "organizations/[organization_id]". + * @param {google.cloud.securitycenter.v1p1beta1.Source} request.source + * Required. The Source being created, only the display_name and description will be + * used. All other fields will be ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Source]{@link google.cloud.securitycenter.v1p1beta1.Source}. + * 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/v1p1beta1/security_center.create_source.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async + */ + createSource( + request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|undefined, {}|undefined + ]>; + createSource( + request: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): void; + createSource( + request: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): void; + createSource( + request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|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.createSource(request, options, callback); + } +/** + * Creates a finding. The corresponding source must exist for finding + * creation to succeed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new finding's parent. Its format should be + * "organizations/[organization_id]/sources/[source_id]". + * @param {string} request.findingId + * Required. Unique identifier provided by the client within the parent scope. + * @param {google.cloud.securitycenter.v1p1beta1.Finding} request.finding + * Required. The Finding being created. The name and security_marks will be ignored as + * they are both output only fields on this resource. + * @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.securitycenter.v1p1beta1.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/v1p1beta1/security_center.create_finding.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async + */ + createFinding( + request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|undefined, {}|undefined + ]>; + createFinding( + request: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): void; + createFinding( + request: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): void; + createFinding( + request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|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.createFinding(request, options, callback); + } +/** + * Creates a notification config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new notification config's parent. Its format is + * "organizations/[organization_id]". + * @param {string} request.configId + * Required. Unique identifier provided by the client within the parent scope. + * It must be between 1 and 128 characters, and contains alphanumeric + * characters, underscores or hyphens only. + * @param {google.cloud.securitycenter.v1p1beta1.NotificationConfig} request.notificationConfig + * Required. The notification config being created. The name and the service account + * will be ignored as they are both output only fields on this resource. + * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1p1beta1.NotificationConfig}. + * 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/v1p1beta1/security_center.create_notification_config.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async + */ + createNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|undefined, {}|undefined + ]>; + createNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + createNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + createNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|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.createNotificationConfig(request, options, callback); + } +/** + * Deletes a notification config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the notification config to delete. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.delete_notification_config.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async + */ + deleteNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|undefined, {}|undefined + ]>; + deleteNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|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.deleteNotificationConfig(request, options, callback); + } +/** + * Gets the access control policy on the specified Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * @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 [Policy]{@link google.iam.v1.Policy}. + * 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/v1p1beta1/security_center.get_iam_policy.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async + */ + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|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({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } +/** + * Gets a notification config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the notification config to get. Its format is + * "organizations/[organization_id]/notificationConfigs/[config_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [NotificationConfig]{@link google.cloud.securitycenter.v1p1beta1.NotificationConfig}. + * 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/v1p1beta1/security_center.get_notification_config.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async + */ + getNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|undefined, {}|undefined + ]>; + getNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + getNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + getNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|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.getNotificationConfig(request, options, callback); + } +/** + * Gets the settings for an organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the organization to get organization settings for. Its format is + * "organizations/[organization_id]/organizationSettings". + * @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 [OrganizationSettings]{@link google.cloud.securitycenter.v1p1beta1.OrganizationSettings}. + * 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/v1p1beta1/security_center.get_organization_settings.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async + */ + getOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|undefined, {}|undefined + ]>; + getOrganizationSettings( + request: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + getOrganizationSettings( + request: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + getOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|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.getOrganizationSettings(request, options, callback); + } +/** + * Gets a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Relative resource name of the source. Its format is + * "organizations/[organization_id]/source/[source_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Source]{@link google.cloud.securitycenter.v1p1beta1.Source}. + * 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/v1p1beta1/security_center.get_source.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async + */ + getSource( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|undefined, {}|undefined + ]>; + getSource( + request: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>): void; + getSource( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|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.getSource(request, options, callback); + } +/** + * Updates the state of a finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The relative resource name of the finding. See: + * https://cloud.google.com/apis/design/resource_names#relative_resource_name + * Example: + * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". + * @param {google.cloud.securitycenter.v1p1beta1.Finding.State} request.state + * Required. The desired State of the finding. + * @param {google.protobuf.Timestamp} request.startTime + * Required. The time at which the updated state takes effect. + * @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.securitycenter.v1p1beta1.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/v1p1beta1/security_center.set_finding_state.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async + */ + setFindingState( + request?: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|undefined, {}|undefined + ]>; + setFindingState( + request: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): void; + setFindingState( + request: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): void; + setFindingState( + request?: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|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.setFindingState(request, options, callback); + } +/** + * Sets the access control policy on the specified Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @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 [Policy]{@link google.iam.v1.Policy}. + * 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/v1p1beta1/security_center.set_iam_policy.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async + */ + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|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({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.setIamPolicy(request, options, callback); + } +/** + * Returns the permissions that a caller has on the specified source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * 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/v1p1beta1/security_center.test_iam_permissions.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async + */ + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|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({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.testIamPermissions(request, options, callback); + } +/** + * Creates or updates a finding. The corresponding source must exist for a + * finding creation to succeed. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1p1beta1.Finding} request.finding + * Required. The finding resource to update or create if it does not already exist. + * parent, security_marks, and update_time will be ignored. + * + * In the case of creation, the finding id portion of the name must be + * alphanumeric and less than or equal to 32 characters and greater than 0 + * characters in length. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the finding resource. This field should + * not be specified when creating a finding. + * + * When updating a finding, an empty mask is treated as updating all mutable + * fields and replacing source_properties. Individual source_properties can + * be added/updated by using "source_properties." in the field + * mask. + * @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.securitycenter.v1p1beta1.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/v1p1beta1/security_center.update_finding.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async + */ + updateFinding( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|undefined, {}|undefined + ]>; + updateFinding( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): void; + updateFinding( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): void; + updateFinding( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IFinding, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|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({ + 'finding.name': request.finding!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateFinding(request, options, callback); + } +/** + * Updates a notification config. The following update + * fields are allowed: description, pubsub_topic, streaming_config.filter + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1p1beta1.NotificationConfig} request.notificationConfig + * Required. The notification config to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the notification config. + * + * If empty all mutable fields will be updated. + * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1p1beta1.NotificationConfig}. + * 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/v1p1beta1/security_center.update_notification_config.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async + */ + updateNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|undefined, {}|undefined + ]>; + updateNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + updateNotificationConfig( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>): void; + updateNotificationConfig( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|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({ + 'notification_config.name': request.notificationConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateNotificationConfig(request, options, callback); + } +/** + * Updates an organization's settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1p1beta1.OrganizationSettings} request.organizationSettings + * Required. The organization settings resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the settings resource. + * + * If empty all mutable fields will be updated. + * @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 [OrganizationSettings]{@link google.cloud.securitycenter.v1p1beta1.OrganizationSettings}. + * 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/v1p1beta1/security_center.update_organization_settings.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async + */ + updateOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined + ]>; + updateOrganizationSettings( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateOrganizationSettings( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateOrganizationSettings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|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({ + 'organization_settings.name': request.organizationSettings!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateOrganizationSettings(request, options, callback); + } +/** + * Updates a source. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1p1beta1.Source} request.source + * Required. The source resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the source resource. + * + * If empty all mutable fields will be updated. + * @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 [Source]{@link google.cloud.securitycenter.v1p1beta1.Source}. + * 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/v1p1beta1/security_center.update_source.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async + */ + updateSource( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|undefined, {}|undefined + ]>; + updateSource( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): void; + updateSource( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): void; + updateSource( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|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({ + 'source.name': request.source!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSource(request, options, callback); + } +/** + * Updates security marks. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1p1beta1.SecurityMarks} request.securityMarks + * Required. The security marks resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the security marks resource. + * + * The field mask must not contain duplicate fields. + * If empty or set to "marks", all marks will be replaced. Individual + * marks can be updated using "marks.". + * @param {google.protobuf.Timestamp} request.startTime + * The time at which the updated SecurityMarks take effect. + * If not set uses current server time. Updates will be applied to the + * SecurityMarks that are active immediately preceding this time. + * @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 [SecurityMarks]{@link google.cloud.securitycenter.v1p1beta1.SecurityMarks}. + * 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/v1p1beta1/security_center.update_security_marks.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async + */ + updateSecurityMarks( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|undefined, {}|undefined + ]>; + updateSecurityMarks( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityMarks( + request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): void; + updateSecurityMarks( + request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, + protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|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({ + 'security_marks.name': request.securityMarks!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSecurityMarks(request, options, callback); + } + +/** + * Runs asset discovery. The discovery is tracked with a long-running + * operation. + * + * This API can only be called with limited frequency for an organization. If + * it is called too frequently the caller will receive a TOO_MANY_REQUESTS + * error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to run asset discovery for. Its format is + * "organizations/[organization_id]". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.run_asset_discovery.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async + */ + runAssetDiscovery( + request?: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + runAssetDiscovery( + request: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runAssetDiscovery( + request: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + runAssetDiscovery( + request?: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.runAssetDiscovery(request, options, callback); + } +/** + * Check the status of the long running operation returned by `runAssetDiscovery()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.run_asset_discovery.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async + */ + async checkRunAssetDiscoveryProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.runAssetDiscovery, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Filters an organization's assets and groups them by their specified + * properties. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_name_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [GroupResult]{@link google.cloud.securitycenter.v1p1beta1.GroupResult}. + * 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 `groupAssetsAsync()` + * 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. + */ + groupAssets( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse + ]>; + groupAssets( + request: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; + groupAssets( + request: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; + groupAssets( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse + ]>|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.groupAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_name_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [GroupResult]{@link google.cloud.securitycenter.v1p1beta1.GroupResult} 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 `groupAssetsAsync()` + * 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. + */ + groupAssetsStream( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + 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['groupAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupAssets.createStream( + this.innerApiCalls.groupAssets as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `groupAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to groupBy. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_name_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping. The string + * value should follow SQL syntax: comma separated list of fields. For + * example: + * "security_center_properties.resource_project,security_center_properties.project". + * + * The following fields are supported when compare_duration is not set: + * + * * security_center_properties.resource_project + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_type + * * security_center_properties.resource_parent + * * security_center_properties.resource_parent_display_name + * + * The following fields are supported when compare_duration is set: + * + * * security_center_properties.resource_type + * * security_center_properties.resource_project_display_name + * * security_center_properties.resource_parent_display_name + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" property is + * updated to indicate whether the asset was added, removed, or remained + * present during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at reference_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at reference_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and reference_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {string} request.pageToken + * The value returned by the last `GroupAssetsResponse`; indicates + * that this is a continuation of a prior `GroupAssets` call, and that the + * system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [GroupResult]{@link google.cloud.securitycenter.v1p1beta1.GroupResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.group_assets.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async + */ + groupAssetsAsync( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, + 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['groupAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupAssets.asyncIterate( + this.innerApiCalls['groupAssets'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Filters an organization or source's findings and groups them by their + * specified properties. + * + * To group across all sources provide a `-` as the source id. + * Example: /v1/organizations/{organization_id}/sources/-/findings, + * /v1/folders/{folder_id}/sources/-/findings, + * /v1/projects/{project_id}/sources/-/findings + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state_change`). The string value should follow SQL syntax: comma separated + * list of fields. For example: "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * * severity + * + * The following fields are supported when compare_duration is set: + * + * * state_change + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [GroupResult]{@link google.cloud.securitycenter.v1p1beta1.GroupResult}. + * 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 `groupFindingsAsync()` + * 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. + */ + groupFindings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse + ]>; + groupFindings( + request: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; + groupFindings( + request: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; + groupFindings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse + ]>|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.groupFindings(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state_change`). The string value should follow SQL syntax: comma separated + * list of fields. For example: "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * * severity + * + * The following fields are supported when compare_duration is set: + * + * * state_change + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [GroupResult]{@link google.cloud.securitycenter.v1p1beta1.GroupResult} 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 `groupFindingsAsync()` + * 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. + */ + groupFindingsStream( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + 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['groupFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupFindings.createStream( + this.innerApiCalls.groupFindings as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `groupFindings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source to groupBy. Its format is + * "organizations/[organization_id]/sources/[source_id]", + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]. To groupBy across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, + * or projects/{project_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * * security_marks.marks: `=`, `:` + * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * @param {string} request.groupBy + * Required. Expression that defines what assets fields to use for grouping (including + * `state_change`). The string value should follow SQL syntax: comma separated + * list of fields. For example: "parent,resource_name". + * + * The following fields are supported: + * + * * resource_name + * * category + * * state + * * parent + * * severity + * + * The following fields are supported when compare_duration is set: + * + * * state_change + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the GroupResult's "state_change" attribute is + * updated to indicate whether the finding had its state changed, the + * finding's state remained unchanged, or if the finding was added during the + * compare_duration period of time that precedes the read_time. This is the + * time between (read_time - compare_duration) and read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present + * at read_time. + * + * If this field is set then `state_change` must be a specified field in + * `group_by`. + * @param {string} request.pageToken + * The value returned by the last `GroupFindingsResponse`; indicates + * that this is a continuation of a prior `GroupFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [GroupResult]{@link google.cloud.securitycenter.v1p1beta1.GroupResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.group_findings.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async + */ + groupFindingsAsync( + request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, + 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['groupFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.groupFindings.asyncIterate( + this.innerApiCalls['groupFindings'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists an organization's assets. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following are the allowed field and operator combinations: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [ListAssetsResult]{@link google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssets( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[], + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse + ]>; + listAssets( + request: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>): void; + listAssets( + request: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>): void; + listAssets( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[], + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following are the allowed field and operator combinations: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [ListAssetsResult]{@link google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssetsStream( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.createStream( + this.innerApiCalls.listAssets as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization assets should belong to. Its format is + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.filter + * Expression that defines the filter to apply across assets. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. The fields map to those + * defined in the Asset resource. Examples include: + * + * * name + * * security_center_properties.resource_name + * * resource_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following are the allowed field and operator combinations: + * + * * name: `=` + * * update_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `update_time = "2019-06-10T16:07:18-07:00"` + * `update_time = 1560208038000` + * + * * create_time: `=`, `>`, `<`, `>=`, `<=` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `create_time = "2019-06-10T16:07:18-07:00"` + * `create_time = 1560208038000` + * + * * iam_policy.policy_blob: `=`, `:` + * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * * security_marks.marks: `=`, `:` + * * security_center_properties.resource_name: `=`, `:` + * * security_center_properties.resource_display_name: `=`, `:` + * * security_center_properties.resource_type: `=`, `:` + * * security_center_properties.resource_parent: `=`, `:` + * * security_center_properties.resource_parent_display_name: `=`, `:` + * * security_center_properties.resource_project: `=`, `:` + * * security_center_properties.resource_project_display_name: `=`, `:` + * * security_center_properties.resource_owners: `=`, `:` + * + * For example, `resource_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `resource_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-resource_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,resource_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,resource_properties.a_property" and " + * name desc , resource_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * update_time + * resource_properties + * security_marks.marks + * security_center_properties.resource_name + * security_center_properties.resource_display_name + * security_center_properties.resource_parent + * security_center_properties.resource_parent_display_name + * security_center_properties.resource_project + * security_center_properties.resource_project_display_name + * security_center_properties.resource_type + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering assets. The filter is limited + * to assets existing at the supplied time and their values are those at that + * specific time. Absence of this field will default to the API's version of + * NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListAssetsResult's "state_change" + * attribute is updated to indicate whether the asset was added, removed, or + * remained present during the compare_duration period of time that precedes + * the read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence of the asset at the + * two points in time. Intermediate state changes between the two times don't + * affect the result. For example, the results aren't affected if the asset is + * removed and re-created again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "ADDED": indicates that the asset was not present at the start of + * compare_duration, but present at read_time. + * * "REMOVED": indicates that the asset was present at the start of + * compare_duration, but not present at read_time. + * * "ACTIVE": indicates that the asset was present at both the + * start and the end of the time period defined by + * compare_duration and read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all assets present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the ListAssetsResult fields to be listed in the + * response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListAssetsResponse`; indicates + * that this is a continuation of a prior `ListAssets` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [ListAssetsResult]{@link google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.list_assets.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async + */ + listAssetsAsync( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.asyncIterate( + this.innerApiCalls['listAssets'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists an organization or source's findings. + * + * To list across all sources provide a `-` as the source id. + * Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * security_marks.marks: `=`, `:` + * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [ListFindingsResult]{@link google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult}. + * 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.securitycenter.v1p1beta1.IListFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[], + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse + ]>; + listFindings( + request: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>): void; + listFindings( + request: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>): void; + listFindings( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[], + protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.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. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * security_marks.marks: `=`, `:` + * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [ListFindingsResult]{@link google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult} 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.securitycenter.v1p1beta1.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. Name of the source the findings belong to. Its format is + * "organizations/[organization_id]/sources/[source_id], + * folders/[folder_id]/sources/[source_id], or + * projects/[project_id]/sources/[source_id]". To list across all sources + * provide a source_id of `-`. For example: + * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or + * projects/{projects_id}/sources/- + * @param {string} request.filter + * Expression that defines the filter to apply across findings. + * The expression is a list of one or more restrictions combined via logical + * operators `AND` and `OR`. + * Parentheses are supported, and `OR` has higher precedence than `AND`. + * + * Restrictions have the form ` ` and may have a `-` + * character in front of them to indicate negation. Examples include: + * + * * name + * * source_properties.a_property + * * security_marks.marks.marka + * + * The supported operators are: + * + * * `=` for all value types. + * * `>`, `<`, `>=`, `<=` for integer values. + * * `:`, meaning substring matching, for strings. + * + * The supported value types are: + * + * * string literals in quotes. + * * integer literals without quotes. + * * boolean literals `true` and `false` without quotes. + * + * The following field and operator combinations are supported: + * + * * name: `=` + * * parent: `=`, `:` + * * resource_name: `=`, `:` + * * state: `=`, `:` + * * category: `=`, `:` + * * external_uri: `=`, `:` + * * event_time: `=`, `>`, `<`, `>=`, `<=` + * * severity: `=`, `:` + * + * Usage: This should be milliseconds since epoch or an RFC3339 string. + * Examples: + * `event_time = "2019-06-10T16:07:18-07:00"` + * `event_time = 1560208038000` + * + * security_marks.marks: `=`, `:` + * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` + * + * For example, `source_properties.size = 100` is a valid filter string. + * + * Use a partial match on the empty string to filter based on a property + * existing: `source_properties.my_property : ""` + * + * Use a negated partial match on the empty string to filter based on a + * property not existing: `-source_properties.my_property : ""` + * @param {string} request.orderBy + * Expression that defines what fields and order to use for sorting. The + * string value should follow SQL syntax: comma separated list of fields. For + * example: "name,resource_properties.a_property". The default sorting order + * is ascending. To specify descending order for a field, a suffix " desc" + * should be appended to the field name. For example: "name + * desc,source_properties.a_property". Redundant space characters in the + * syntax are insignificant. "name desc,source_properties.a_property" and " + * name desc , source_properties.a_property " are equivalent. + * + * The following fields are supported: + * name + * parent + * state + * category + * resource_name + * event_time + * source_properties + * security_marks.marks + * @param {google.protobuf.Timestamp} request.readTime + * Time used as a reference point when filtering findings. The filter is + * limited to findings existing at the supplied time and their values are + * those at that specific time. Absence of this field will default to the + * API's version of NOW. + * @param {google.protobuf.Duration} request.compareDuration + * When compare_duration is set, the ListFindingsResult's "state_change" + * attribute is updated to indicate whether the finding had its state changed, + * the finding's state remained unchanged, or if the finding was added in any + * state during the compare_duration period of time that precedes the + * read_time. This is the time between (read_time - compare_duration) and + * read_time. + * + * The state_change value is derived based on the presence and state of the + * finding at the two points in time. Intermediate state changes between the + * two times don't affect the result. For example, the results aren't affected + * if the finding is made inactive and then active again. + * + * Possible "state_change" values when compare_duration is specified: + * + * * "CHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration, but changed its + * state at read_time. + * * "UNCHANGED": indicates that the finding was present and matched the given + * filter at the start of compare_duration and did not change + * state at read_time. + * * "ADDED": indicates that the finding did not match the given filter or + * was not present at the start of compare_duration, but was + * present at read_time. + * * "REMOVED": indicates that the finding was present and matched the + * filter at the start of compare_duration, but did not match + * the filter at read_time. + * + * If compare_duration is not specified, then the only possible state_change + * is "UNUSED", which will be the state_change set for all findings present at + * read_time. + * @param {google.protobuf.FieldMask} request.fieldMask + * A field mask to specify the Finding fields to be listed in the response. + * An empty field mask will list all fields. + * @param {string} request.pageToken + * The value returned by the last `ListFindingsResponse`; indicates + * that this is a continuation of a prior `ListFindings` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [ListFindingsResult]{@link google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.list_findings.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async + */ + listFindingsAsync( + request?: protos.google.cloud.securitycenter.v1p1beta1.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; + } + /** + * Lists notification configs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1p1beta1.NotificationConfig}. + * 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 `listNotificationConfigsAsync()` + * 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. + */ + listNotificationConfigs( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[], + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse + ]>; + listNotificationConfigs( + request: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>): void; + listNotificationConfigs( + request: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>): void; + listNotificationConfigs( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[], + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse + ]>|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.listNotificationConfigs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1p1beta1.NotificationConfig} 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 `listNotificationConfigsAsync()` + * 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. + */ + listNotificationConfigsStream( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + 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['listNotificationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNotificationConfigs.createStream( + this.innerApiCalls.listNotificationConfigs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listNotificationConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization to list notification configs. + * Its format is "organizations/[organization_id]". + * @param {string} request.pageToken + * The value returned by the last `ListNotificationConfigsResponse`; indicates + * that this is a continuation of a prior `ListNotificationConfigs` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [NotificationConfig]{@link google.cloud.securitycenter.v1p1beta1.NotificationConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.list_notification_configs.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async + */ + listNotificationConfigsAsync( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, + 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['listNotificationConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listNotificationConfigs.asyncIterate( + this.innerApiCalls['listNotificationConfigs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists all sources belonging to an organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [Source]{@link google.cloud.securitycenter.v1p1beta1.Source}. + * 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 `listSourcesAsync()` + * 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. + */ + listSources( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource[], + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse + ]>; + listSources( + request: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ISource>): void; + listSources( + request: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ISource>): void; + listSources( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ISource>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, + protos.google.cloud.securitycenter.v1p1beta1.ISource>): + Promise<[ + protos.google.cloud.securitycenter.v1p1beta1.ISource[], + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest|null, + protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse + ]>|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.listSources(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. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 [Source]{@link google.cloud.securitycenter.v1p1beta1.Source} 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 `listSourcesAsync()` + * 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. + */ + listSourcesStream( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + 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['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.createStream( + this.innerApiCalls.listSources as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSources`, 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. Resource name of the parent of sources to list. Its format should be + * "organizations/[organization_id], folders/[folder_id], or + * projects/[project_id]". + * @param {string} request.pageToken + * The value returned by the last `ListSourcesResponse`; indicates + * that this is a continuation of a prior `ListSources` call, and + * that the system should return the next page of data. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. Default is + * 10, minimum is 1, maximum is 1000. + * @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 + * [Source]{@link google.cloud.securitycenter.v1p1beta1.Source}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/security_center.list_sources.js + * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async + */ + listSourcesAsync( + request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, + 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['listSources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSources.asyncIterate( + this.innerApiCalls['listSources'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderAsset resource name string. + * + * @param {string} folder + * @param {string} asset + * @returns {string} Resource name string. + */ + folderAssetPath(folder:string,asset:string) { + return this.pathTemplates.folderAssetPathTemplate.render({ + folder: folder, + asset: asset, + }); + } + + /** + * Parse the folder from FolderAsset resource. + * + * @param {string} folderAssetName + * A fully-qualified path representing folder_asset resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAssetName(folderAssetName: string) { + return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).folder; + } + + /** + * Parse the asset from FolderAsset resource. + * + * @param {string} folderAssetName + * A fully-qualified path representing folder_asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromFolderAssetName(folderAssetName: string) { + return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).asset; + } + + /** + * Return a fully-qualified folderAssetSecurityMarks resource name string. + * + * @param {string} folder + * @param {string} asset + * @returns {string} Resource name string. + */ + folderAssetSecurityMarksPath(folder:string,asset:string) { + return this.pathTemplates.folderAssetSecurityMarksPathTemplate.render({ + folder: folder, + asset: asset, + }); + } + + /** + * Parse the folder from FolderAssetSecurityMarks resource. + * + * @param {string} folderAssetSecurityMarksName + * A fully-qualified path representing folder_asset_securityMarks resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { + return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).folder; + } + + /** + * Parse the asset from FolderAssetSecurityMarks resource. + * + * @param {string} folderAssetSecurityMarksName + * A fully-qualified path representing folder_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { + return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified folderSource resource name string. + * + * @param {string} folder + * @param {string} source + * @returns {string} Resource name string. + */ + folderSourcePath(folder:string,source:string) { + return this.pathTemplates.folderSourcePathTemplate.render({ + folder: folder, + source: source, + }); + } + + /** + * Parse the folder from FolderSource resource. + * + * @param {string} folderSourceName + * A fully-qualified path representing folder_source resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceName(folderSourceName: string) { + return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).folder; + } + + /** + * Parse the source from FolderSource resource. + * + * @param {string} folderSourceName + * A fully-qualified path representing folder_source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceName(folderSourceName: string) { + return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).source; + } + + /** + * Return a fully-qualified folderSourceFinding resource name string. + * + * @param {string} folder + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + folderSourceFindingPath(folder:string,source:string,finding:string) { + return this.pathTemplates.folderSourceFindingPathTemplate.render({ + folder: folder, + source: source, + finding: finding, + }); + } + + /** + * Parse the folder from FolderSourceFinding resource. + * + * @param {string} folderSourceFindingName + * A fully-qualified path representing folder_source_finding resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceFindingName(folderSourceFindingName: string) { + return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).folder; + } + + /** + * Parse the source from FolderSourceFinding resource. + * + * @param {string} folderSourceFindingName + * A fully-qualified path representing folder_source_finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceFindingName(folderSourceFindingName: string) { + return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).source; + } + + /** + * Parse the finding from FolderSourceFinding resource. + * + * @param {string} folderSourceFindingName + * A fully-qualified path representing folder_source_finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFolderSourceFindingName(folderSourceFindingName: string) { + return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).finding; + } + + /** + * Return a fully-qualified folderSourceFindingSecurityMarks resource name string. + * + * @param {string} folder + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + folderSourceFindingSecurityMarksPath(folder:string,source:string,finding:string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render({ + folder: folder, + source: source, + finding: finding, + }); + } + + /** + * Parse the folder from FolderSourceFindingSecurityMarks resource. + * + * @param {string} folderSourceFindingSecurityMarksName + * A fully-qualified path representing folder_source_finding_securityMarks resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).folder; + } + + /** + * Parse the source from FolderSourceFindingSecurityMarks resource. + * + * @param {string} folderSourceFindingSecurityMarksName + * A fully-qualified path representing folder_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from FolderSourceFindingSecurityMarks resource. + * + * @param {string} folderSourceFindingSecurityMarksName + * A fully-qualified path representing folder_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { + return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).finding; + } + + /** + * Return a fully-qualified notificationConfig resource name string. + * + * @param {string} organization + * @param {string} notification_config + * @returns {string} Resource name string. + */ + notificationConfigPath(organization:string,notificationConfig:string) { + return this.pathTemplates.notificationConfigPathTemplate.render({ + organization: organization, + notification_config: notificationConfig, + }); + } + + /** + * Parse the organization from NotificationConfig resource. + * + * @param {string} notificationConfigName + * A fully-qualified path representing NotificationConfig resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromNotificationConfigName(notificationConfigName: string) { + return this.pathTemplates.notificationConfigPathTemplate.match(notificationConfigName).organization; + } + + /** + * Parse the notification_config from NotificationConfig resource. + * + * @param {string} notificationConfigName + * A fully-qualified path representing NotificationConfig resource. + * @returns {string} A string representing the notification_config. + */ + matchNotificationConfigFromNotificationConfigName(notificationConfigName: string) { + return this.pathTemplates.notificationConfigPathTemplate.match(notificationConfigName).notification_config; + } + + /** + * Return a fully-qualified organization resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationPath(organization:string) { + return this.pathTemplates.organizationPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from Organization resource. + * + * @param {string} organizationName + * A fully-qualified path representing Organization resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationName(organizationName: string) { + return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; + } + + /** + * Return a fully-qualified organizationAsset resource name string. + * + * @param {string} organization + * @param {string} asset + * @returns {string} Resource name string. + */ + organizationAssetPath(organization:string,asset:string) { + return this.pathTemplates.organizationAssetPathTemplate.render({ + organization: organization, + asset: asset, + }); + } + + /** + * Parse the organization from OrganizationAsset resource. + * + * @param {string} organizationAssetName + * A fully-qualified path representing organization_asset resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAssetName(organizationAssetName: string) { + return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).organization; + } + + /** + * Parse the asset from OrganizationAsset resource. + * + * @param {string} organizationAssetName + * A fully-qualified path representing organization_asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromOrganizationAssetName(organizationAssetName: string) { + return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).asset; + } + + /** + * Return a fully-qualified organizationAssetSecurityMarks resource name string. + * + * @param {string} organization + * @param {string} asset + * @returns {string} Resource name string. + */ + organizationAssetSecurityMarksPath(organization:string,asset:string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.render({ + organization: organization, + asset: asset, + }); + } + + /** + * Parse the organization from OrganizationAssetSecurityMarks resource. + * + * @param {string} organizationAssetSecurityMarksName + * A fully-qualified path representing organization_asset_securityMarks resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).organization; + } + + /** + * Parse the asset from OrganizationAssetSecurityMarks resource. + * + * @param {string} organizationAssetSecurityMarksName + * A fully-qualified path representing organization_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { + return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization:string) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing OrganizationSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + + /** + * Return a fully-qualified organizationSource resource name string. + * + * @param {string} organization + * @param {string} source + * @returns {string} Resource name string. + */ + organizationSourcePath(organization:string,source:string) { + return this.pathTemplates.organizationSourcePathTemplate.render({ + organization: organization, + source: source, + }); + } + + /** + * Parse the organization from OrganizationSource resource. + * + * @param {string} organizationSourceName + * A fully-qualified path representing organization_source resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceName(organizationSourceName: string) { + return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).organization; + } + + /** + * Parse the source from OrganizationSource resource. + * + * @param {string} organizationSourceName + * A fully-qualified path representing organization_source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceName(organizationSourceName: string) { + return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).source; + } + + /** + * Return a fully-qualified organizationSourceFinding resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + organizationSourceFindingPath(organization:string,source:string,finding:string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + }); + } + + /** + * Parse the organization from OrganizationSourceFinding resource. + * + * @param {string} organizationSourceFindingName + * A fully-qualified path representing organization_source_finding resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceFindingName(organizationSourceFindingName: string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).organization; + } + + /** + * Parse the source from OrganizationSourceFinding resource. + * + * @param {string} organizationSourceFindingName + * A fully-qualified path representing organization_source_finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceFindingName(organizationSourceFindingName: string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).source; + } + + /** + * Parse the finding from OrganizationSourceFinding resource. + * + * @param {string} organizationSourceFindingName + * A fully-qualified path representing organization_source_finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromOrganizationSourceFindingName(organizationSourceFindingName: string) { + return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).finding; + } + + /** + * Return a fully-qualified organizationSourceFindingSecurityMarks resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + organizationSourceFindingSecurityMarksPath(organization:string,source:string,finding:string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + }); + } + + /** + * Parse the organization from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).organization; + } + + /** + * Parse the source from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from OrganizationSourceFindingSecurityMarks resource. + * + * @param {string} organizationSourceFindingSecurityMarksName + * A fully-qualified path representing organization_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { + return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).finding; + } + + /** + * Return a fully-qualified projectAsset resource name string. + * + * @param {string} project + * @param {string} asset + * @returns {string} Resource name string. + */ + projectAssetPath(project:string,asset:string) { + return this.pathTemplates.projectAssetPathTemplate.render({ + project: project, + asset: asset, + }); + } + + /** + * Parse the project from ProjectAsset resource. + * + * @param {string} projectAssetName + * A fully-qualified path representing project_asset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAssetName(projectAssetName: string) { + return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).project; + } + + /** + * Parse the asset from ProjectAsset resource. + * + * @param {string} projectAssetName + * A fully-qualified path representing project_asset resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromProjectAssetName(projectAssetName: string) { + return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).asset; + } + + /** + * Return a fully-qualified projectAssetSecurityMarks resource name string. + * + * @param {string} project + * @param {string} asset + * @returns {string} Resource name string. + */ + projectAssetSecurityMarksPath(project:string,asset:string) { + return this.pathTemplates.projectAssetSecurityMarksPathTemplate.render({ + project: project, + asset: asset, + }); + } + + /** + * Parse the project from ProjectAssetSecurityMarks resource. + * + * @param {string} projectAssetSecurityMarksName + * A fully-qualified path representing project_asset_securityMarks resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { + return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).project; + } + + /** + * Parse the asset from ProjectAssetSecurityMarks resource. + * + * @param {string} projectAssetSecurityMarksName + * A fully-qualified path representing project_asset_securityMarks resource. + * @returns {string} A string representing the asset. + */ + matchAssetFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { + return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).asset; + } + + /** + * Return a fully-qualified projectSource resource name string. + * + * @param {string} project + * @param {string} source + * @returns {string} Resource name string. + */ + projectSourcePath(project:string,source:string) { + return this.pathTemplates.projectSourcePathTemplate.render({ + project: project, + source: source, + }); + } + + /** + * Parse the project from ProjectSource resource. + * + * @param {string} projectSourceName + * A fully-qualified path representing project_source resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceName(projectSourceName: string) { + return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).project; + } + + /** + * Parse the source from ProjectSource resource. + * + * @param {string} projectSourceName + * A fully-qualified path representing project_source resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceName(projectSourceName: string) { + return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).source; + } + + /** + * Return a fully-qualified projectSourceFinding resource name string. + * + * @param {string} project + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + projectSourceFindingPath(project:string,source:string,finding:string) { + return this.pathTemplates.projectSourceFindingPathTemplate.render({ + project: project, + source: source, + finding: finding, + }); + } + + /** + * Parse the project from ProjectSourceFinding resource. + * + * @param {string} projectSourceFindingName + * A fully-qualified path representing project_source_finding resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceFindingName(projectSourceFindingName: string) { + return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).project; + } + + /** + * Parse the source from ProjectSourceFinding resource. + * + * @param {string} projectSourceFindingName + * A fully-qualified path representing project_source_finding resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceFindingName(projectSourceFindingName: string) { + return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).source; + } + + /** + * Parse the finding from ProjectSourceFinding resource. + * + * @param {string} projectSourceFindingName + * A fully-qualified path representing project_source_finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromProjectSourceFindingName(projectSourceFindingName: string) { + return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).finding; + } + + /** + * Return a fully-qualified projectSourceFindingSecurityMarks resource name string. + * + * @param {string} project + * @param {string} source + * @param {string} finding + * @returns {string} Resource name string. + */ + projectSourceFindingSecurityMarksPath(project:string,source:string,finding:string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render({ + project: project, + source: source, + finding: finding, + }); + } + + /** + * Parse the project from ProjectSourceFindingSecurityMarks resource. + * + * @param {string} projectSourceFindingSecurityMarksName + * A fully-qualified path representing project_source_finding_securityMarks resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).project; + } + + /** + * Parse the source from ProjectSourceFindingSecurityMarks resource. + * + * @param {string} projectSourceFindingSecurityMarksName + * A fully-qualified path representing project_source_finding_securityMarks resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).source; + } + + /** + * Parse the finding from ProjectSourceFindingSecurityMarks resource. + * + * @param {string} projectSourceFindingSecurityMarksName + * A fully-qualified path representing project_source_finding_securityMarks resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { + return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).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 { + this.initialize(); + if (!this._terminated) { + return this.securityCenterStub!.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client_config.json b/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client_config.json new file mode 100644 index 00000000..b8821e07 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client_config.json @@ -0,0 +1,141 @@ +{ + "interfaces": { + "google.cloud.securitycenter.v1p1beta1.SecurityCenter": { + "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": { + "CreateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateFinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetOrganizationSettings": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetSource": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GroupAssets": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GroupFindings": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListAssets": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindings": { + "timeout_millis": 480000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListNotificationConfigs": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListSources": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RunAssetDiscovery": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetFindingState": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateFinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateOrganizationSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSource": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSecurityMarks": { + "timeout_millis": 480000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_proto_list.json b/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_proto_list.json new file mode 100644 index 00000000..dcb821bf --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_proto_list.json @@ -0,0 +1,13 @@ +[ + "../../protos/google/cloud/securitycenter/v1p1beta1/asset.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/finding.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/folder.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/resource.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto", + "../../protos/google/cloud/securitycenter/v1p1beta1/source.proto" +] diff --git a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000..37333715 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// 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. +// +// ** 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 securitycenter = require('@google-cloud/security-center'); + +function main() { + const securityCenterClient = new securitycenter.SecurityCenterClient(); +} + +main(); diff --git a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000..b4153c94 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// 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. +// +// ** 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 {SecurityCenterClient} from '@google-cloud/security-center'; + +// check that the client class type name can be used +function doStuffWithSecurityCenterClient(client: SecurityCenterClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const securityCenterClient = new SecurityCenterClient(); + doStuffWithSecurityCenterClient(securityCenterClient); +} + +main(); diff --git a/owl-bot-staging/v1p1beta1/system-test/install.ts b/owl-bot-staging/v1p1beta1/system-test/install.ts new file mode 100644 index 00000000..1f850b52 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts b/owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts new file mode 100644 index 00000000..e392d53b --- /dev/null +++ b/owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts @@ -0,0 +1,3743 @@ +// 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. +// +// ** 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 securitycenterModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1p1beta1.SecurityCenterClient', () => { + it('has servicePath', () => { + const servicePath = securitycenterModule.v1p1beta1.SecurityCenterClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = securitycenterModule.v1p1beta1.SecurityCenterClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = securitycenterModule.v1p1beta1.SecurityCenterClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.securityCenterStub, undefined); + await client.initialize(); + assert(client.securityCenterStub); + }); + + it('has close method', () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + 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 securitycenterModule.v1p1beta1.SecurityCenterClient({ + 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('createSource', () => { + it('invokes createSource without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()); + client.innerApiCalls.createSource = stubSimpleCall(expectedResponse); + const [response] = await client.createSource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSource without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()); + client.innerApiCalls.createSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createSource with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSource(request), expectedError); + assert((client.innerApiCalls.createSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createFinding', () => { + it('invokes createFinding without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Finding()); + client.innerApiCalls.createFinding = stubSimpleCall(expectedResponse); + const [response] = await client.createFinding(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createFinding without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Finding()); + client.innerApiCalls.createFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFinding( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createFinding with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createFinding(request), expectedError); + assert((client.innerApiCalls.createFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createNotificationConfig', () => { + it('invokes createNotificationConfig without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()); + client.innerApiCalls.createNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()); + client.innerApiCalls.createNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNotificationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createNotificationConfig with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createNotificationConfig(request), expectedError); + assert((client.innerApiCalls.createNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteNotificationConfig', () => { + it('invokes deleteNotificationConfig without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNotificationConfig( + 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.deleteNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteNotificationConfig with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteNotificationConfig(request), expectedError); + assert((client.innerApiCalls.deleteNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getNotificationConfig', () => { + it('invokes getNotificationConfig without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()); + client.innerApiCalls.getNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()); + client.innerApiCalls.getNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNotificationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getNotificationConfig with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNotificationConfig(request), expectedError); + assert((client.innerApiCalls.getNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getOrganizationSettings', () => { + it('invokes getOrganizationSettings without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings()); + client.innerApiCalls.getOrganizationSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getOrganizationSettings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getOrganizationSettings without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings()); + client.innerApiCalls.getOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getOrganizationSettings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getOrganizationSettings with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getOrganizationSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getOrganizationSettings(request), expectedError); + assert((client.innerApiCalls.getOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getSource', () => { + it('invokes getSource without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()); + client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); + const [response] = await client.getSource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSource without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()); + client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getSource with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSource(request), expectedError); + assert((client.innerApiCalls.getSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('setFindingState', () => { + it('invokes setFindingState without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Finding()); + client.innerApiCalls.setFindingState = stubSimpleCall(expectedResponse); + const [response] = await client.setFindingState(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setFindingState without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Finding()); + client.innerApiCalls.setFindingState = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setFindingState( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setFindingState with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setFindingState = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setFindingState(request), expectedError); + assert((client.innerApiCalls.setFindingState as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateFinding', () => { + it('invokes updateFinding without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest()); + request.finding = {}; + request.finding.name = ''; + const expectedHeaderRequestParams = "finding.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Finding()); + client.innerApiCalls.updateFinding = stubSimpleCall(expectedResponse); + const [response] = await client.updateFinding(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateFinding without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest()); + request.finding = {}; + request.finding.name = ''; + const expectedHeaderRequestParams = "finding.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Finding()); + client.innerApiCalls.updateFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFinding( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateFinding with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest()); + request.finding = {}; + request.finding.name = ''; + const expectedHeaderRequestParams = "finding.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateFinding(request), expectedError); + assert((client.innerApiCalls.updateFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateNotificationConfig', () => { + it('invokes updateNotificationConfig without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest()); + request.notificationConfig = {}; + request.notificationConfig.name = ''; + const expectedHeaderRequestParams = "notification_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()); + client.innerApiCalls.updateNotificationConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateNotificationConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateNotificationConfig without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest()); + request.notificationConfig = {}; + request.notificationConfig.name = ''; + const expectedHeaderRequestParams = "notification_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()); + client.innerApiCalls.updateNotificationConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNotificationConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateNotificationConfig with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest()); + request.notificationConfig = {}; + request.notificationConfig.name = ''; + const expectedHeaderRequestParams = "notification_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNotificationConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateNotificationConfig(request), expectedError); + assert((client.innerApiCalls.updateNotificationConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateOrganizationSettings', () => { + it('invokes updateOrganizationSettings without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest()); + request.organizationSettings = {}; + request.organizationSettings.name = ''; + const expectedHeaderRequestParams = "organization_settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings()); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateOrganizationSettings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateOrganizationSettings without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest()); + request.organizationSettings = {}; + request.organizationSettings.name = ''; + const expectedHeaderRequestParams = "organization_settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings()); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateOrganizationSettings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateOrganizationSettings with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest()); + request.organizationSettings = {}; + request.organizationSettings.name = ''; + const expectedHeaderRequestParams = "organization_settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateOrganizationSettings(request), expectedError); + assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateSource', () => { + it('invokes updateSource without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest()); + request.source = {}; + request.source.name = ''; + const expectedHeaderRequestParams = "source.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()); + client.innerApiCalls.updateSource = stubSimpleCall(expectedResponse); + const [response] = await client.updateSource(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSource without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest()); + request.source = {}; + request.source.name = ''; + const expectedHeaderRequestParams = "source.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()); + client.innerApiCalls.updateSource = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSource( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateSource with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest()); + request.source = {}; + request.source.name = ''; + const expectedHeaderRequestParams = "source.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSource(request), expectedError); + assert((client.innerApiCalls.updateSource as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateSecurityMarks', () => { + it('invokes updateSecurityMarks without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest()); + request.securityMarks = {}; + request.securityMarks.name = ''; + const expectedHeaderRequestParams = "security_marks.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.SecurityMarks()); + client.innerApiCalls.updateSecurityMarks = stubSimpleCall(expectedResponse); + const [response] = await client.updateSecurityMarks(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSecurityMarks without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest()); + request.securityMarks = {}; + request.securityMarks.name = ''; + const expectedHeaderRequestParams = "security_marks.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.SecurityMarks()); + client.innerApiCalls.updateSecurityMarks = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecurityMarks( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateSecurityMarks with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest()); + request.securityMarks = {}; + request.securityMarks.name = ''; + const expectedHeaderRequestParams = "security_marks.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecurityMarks = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSecurityMarks(request), expectedError); + assert((client.innerApiCalls.updateSecurityMarks as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('runAssetDiscovery', () => { + it('invokes runAssetDiscovery without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(expectedResponse); + const [operation] = await client.runAssetDiscovery(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes runAssetDiscovery without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runAssetDiscovery( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes runAssetDiscovery with call error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.runAssetDiscovery(request), expectedError); + assert((client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes runAssetDiscovery with LRO error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.runAssetDiscovery(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.runAssetDiscovery as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkRunAssetDiscoveryProgress without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRunAssetDiscoveryProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRunAssetDiscoveryProgress with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkRunAssetDiscoveryProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('groupAssets', () => { + it('invokes groupAssets without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.innerApiCalls.groupAssets = stubSimpleCall(expectedResponse); + const [response] = await client.groupAssets(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes groupAssets without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.innerApiCalls.groupAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.groupAssets( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes groupAssets with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.groupAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.groupAssets(request), expectedError); + assert((client.innerApiCalls.groupAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes groupAssetsStream without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.groupAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { + 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.groupAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); + assert.strictEqual( + (client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes groupAssetsStream with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.groupAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); + assert.strictEqual( + (client.descriptors.page.groupAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with groupAssets without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; + const iterable = client.groupAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with groupAssets with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.groupAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.groupAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('groupFindings', () => { + it('invokes groupFindings without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.innerApiCalls.groupFindings = stubSimpleCall(expectedResponse); + const [response] = await client.groupFindings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes groupFindings without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.innerApiCalls.groupFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.groupFindings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes groupFindings with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.groupFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.groupFindings(request), expectedError); + assert((client.innerApiCalls.groupFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes groupFindingsStream without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.groupFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { + 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.groupFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); + assert.strictEqual( + (client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes groupFindingsStream with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.groupFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); + assert.strictEqual( + (client.descriptors.page.groupFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with groupFindings without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), + ]; + client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; + const iterable = client.groupFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with groupFindings with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.groupFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.groupFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listAssets', () => { + it('invokes listAssets without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); + const [response] = await client.listAssets(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAssets without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAssets( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listAssets with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAssets(request), expectedError); + assert((client.innerApiCalls.listAssets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAssetsStream without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert.strictEqual( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listAssetsStream with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert.strictEqual( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAssets without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), + ]; + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[] = []; + const iterable = client.listAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAssets with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAssets.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 securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + ]; + 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 securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + ]; + client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[]|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 securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.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 securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + ]; + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult) => { + 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 securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.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.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult) => { + 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 securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), + ]; + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[] = []; + 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 securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.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.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[] = []; + 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('listNotificationConfigs', () => { + it('invokes listNotificationConfigs without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + ]; + client.innerApiCalls.listNotificationConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listNotificationConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listNotificationConfigs without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + ]; + client.innerApiCalls.listNotificationConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNotificationConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listNotificationConfigs with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listNotificationConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNotificationConfigs(request), expectedError); + assert((client.innerApiCalls.listNotificationConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listNotificationConfigsStream without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + ]; + client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listNotificationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig) => { + 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.listNotificationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listNotificationConfigsStream with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listNotificationConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listNotificationConfigs without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), + ]; + client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[] = []; + const iterable = client.listNotificationConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listNotificationConfigs with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNotificationConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listSources', () => { + it('invokes listSources without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); + const [response] = await client.listSources(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSources as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSources without error using callback', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSources( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSources as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listSources with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSources(request), expectedError); + assert((client.innerApiCalls.listSources as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSourcesStream without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + ]; + client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.Source[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.Source) => { + 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.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert.strictEqual( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listSourcesStream with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.Source[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.Source) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSources, request)); + assert.strictEqual( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSources without error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), + ]; + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1p1beta1.ISource[] = []; + const iterable = client.listSourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSources with error', async () => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1p1beta1.ISource[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('folderAsset', () => { + const fakePath = "/rendered/path/folderAsset"; + const expectedParameters = { + folder: "folderValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAssetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderAssetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderAssetPath', () => { + const result = client.folderAssetPath("folderValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderAssetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderAssetName', () => { + const result = client.matchFolderFromFolderAssetName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromFolderAssetName', () => { + const result = client.matchAssetFromFolderAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderAssetSecurityMarks', () => { + const fakePath = "/rendered/path/folderAssetSecurityMarks"; + const expectedParameters = { + folder: "folderValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderAssetSecurityMarksPath', () => { + const result = client.folderAssetSecurityMarksPath("folderValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderAssetSecurityMarksName', () => { + const result = client.matchFolderFromFolderAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromFolderAssetSecurityMarksName', () => { + const result = client.matchAssetFromFolderAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSource', () => { + const fakePath = "/rendered/path/folderSource"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourcePath', () => { + const result = client.folderSourcePath("folderValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceName', () => { + const result = client.matchFolderFromFolderSourceName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceName', () => { + const result = client.matchSourceFromFolderSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSourceFinding', () => { + const fakePath = "/rendered/path/folderSourceFinding"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourceFindingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourceFindingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourceFindingPath', () => { + const result = client.folderSourceFindingPath("folderValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourceFindingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceFindingName', () => { + const result = client.matchFolderFromFolderSourceFindingName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceFindingName', () => { + const result = client.matchSourceFromFolderSourceFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFolderSourceFindingName', () => { + const result = client.matchFindingFromFolderSourceFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/folderSourceFindingSecurityMarks"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourceFindingSecurityMarksPath', () => { + const result = client.folderSourceFindingSecurityMarksPath("folderValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceFindingSecurityMarksName', () => { + const result = client.matchFolderFromFolderSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromFolderSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFolderSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromFolderSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('notificationConfig', () => { + const fakePath = "/rendered/path/notificationConfig"; + const expectedParameters = { + organization: "organizationValue", + notification_config: "notificationConfigValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.notificationConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.notificationConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('notificationConfigPath', () => { + const result = client.notificationConfigPath("organizationValue", "notificationConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.notificationConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromNotificationConfigName', () => { + const result = client.matchOrganizationFromNotificationConfigName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.notificationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchNotificationConfigFromNotificationConfigName', () => { + const result = client.matchNotificationConfigFromNotificationConfigName(fakePath); + assert.strictEqual(result, "notificationConfigValue"); + assert((client.pathTemplates.notificationConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organization', () => { + const fakePath = "/rendered/path/organization"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationPath', () => { + const result = client.organizationPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationName', () => { + const result = client.matchOrganizationFromOrganizationName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationAsset', () => { + const fakePath = "/rendered/path/organizationAsset"; + const expectedParameters = { + organization: "organizationValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAssetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAssetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAssetPath', () => { + const result = client.organizationAssetPath("organizationValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationAssetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationAssetName', () => { + const result = client.matchOrganizationFromOrganizationAssetName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromOrganizationAssetName', () => { + const result = client.matchAssetFromOrganizationAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationAssetSecurityMarks', () => { + const fakePath = "/rendered/path/organizationAssetSecurityMarks"; + const expectedParameters = { + organization: "organizationValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAssetSecurityMarksPath', () => { + const result = client.organizationAssetSecurityMarksPath("organizationValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationAssetSecurityMarksName', () => { + const result = client.matchOrganizationFromOrganizationAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromOrganizationAssetSecurityMarksName', () => { + const result = client.matchAssetFromOrganizationAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSettings', () => { + const fakePath = "/rendered/path/organizationSettings"; + const expectedParameters = { + organization: "organizationValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSettingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSettingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSettingsPath', () => { + const result = client.organizationSettingsPath("organizationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSettingsName', () => { + const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSource', () => { + const fakePath = "/rendered/path/organizationSource"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourcePath', () => { + const result = client.organizationSourcePath("organizationValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceName', () => { + const result = client.matchOrganizationFromOrganizationSourceName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceName', () => { + const result = client.matchSourceFromOrganizationSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSourceFinding', () => { + const fakePath = "/rendered/path/organizationSourceFinding"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourceFindingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourceFindingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourceFindingPath', () => { + const result = client.organizationSourceFindingPath("organizationValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceFindingName', () => { + const result = client.matchOrganizationFromOrganizationSourceFindingName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceFindingName', () => { + const result = client.matchSourceFromOrganizationSourceFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromOrganizationSourceFindingName', () => { + const result = client.matchFindingFromOrganizationSourceFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/organizationSourceFindingSecurityMarks"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourceFindingSecurityMarksPath', () => { + const result = client.organizationSourceFindingSecurityMarksPath("organizationValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchOrganizationFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromOrganizationSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromOrganizationSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAsset', () => { + const fakePath = "/rendered/path/projectAsset"; + const expectedParameters = { + project: "projectValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAssetPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAssetPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAssetPath', () => { + const result = client.projectAssetPath("projectValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAssetPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAssetName', () => { + const result = client.matchProjectFromProjectAssetName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromProjectAssetName', () => { + const result = client.matchAssetFromProjectAssetName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectAssetSecurityMarks', () => { + const fakePath = "/rendered/path/projectAssetSecurityMarks"; + const expectedParameters = { + project: "projectValue", + asset: "assetValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAssetSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAssetSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAssetSecurityMarksPath', () => { + const result = client.projectAssetSecurityMarksPath("projectValue", "assetValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectAssetSecurityMarksName', () => { + const result = client.matchProjectFromProjectAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAssetFromProjectAssetSecurityMarksName', () => { + const result = client.matchAssetFromProjectAssetSecurityMarksName(fakePath); + assert.strictEqual(result, "assetValue"); + assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSource', () => { + const fakePath = "/rendered/path/projectSource"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourcePath', () => { + const result = client.projectSourcePath("projectValue", "sourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceName', () => { + const result = client.matchProjectFromProjectSourceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceName', () => { + const result = client.matchSourceFromProjectSourceName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSourceFinding', () => { + const fakePath = "/rendered/path/projectSourceFinding"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourceFindingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourceFindingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourceFindingPath', () => { + const result = client.projectSourceFindingPath("projectValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourceFindingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceFindingName', () => { + const result = client.matchProjectFromProjectSourceFindingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceFindingName', () => { + const result = client.matchSourceFromProjectSourceFindingName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromProjectSourceFindingName', () => { + const result = client.matchFindingFromProjectSourceFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSourceFindingSecurityMarks', () => { + const fakePath = "/rendered/path/projectSourceFindingSecurityMarks"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + finding: "findingValue", + }; + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourceFindingSecurityMarksPath', () => { + const result = client.projectSourceFindingSecurityMarksPath("projectValue", "sourceValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceFindingSecurityMarksName', () => { + const result = client.matchProjectFromProjectSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceFindingSecurityMarksName', () => { + const result = client.matchSourceFromProjectSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromProjectSourceFindingSecurityMarksName', () => { + const result = client.matchFindingFromProjectSourceFindingSecurityMarksName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1p1beta1/tsconfig.json b/owl-bot-staging/v1p1beta1/tsconfig.json new file mode 100644 index 00000000..c78f1c88 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1p1beta1/webpack.config.js b/owl-bot-staging/v1p1beta1/webpack.config.js new file mode 100644 index 00000000..4aeca8bf --- /dev/null +++ b/owl-bot-staging/v1p1beta1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'SecurityCenter', + filename: './security-center.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 d91264ea5665980f6b476802c30eaf0c758694dd Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 10 Nov 2021 22:06:59 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= 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 | 10 - owl-bot-staging/v1/package.json | 64 - .../cloud/securitycenter/v1/asset.proto | 135 - .../cloud/securitycenter/v1/finding.proto | 224 - .../cloud/securitycenter/v1/folder.proto | 38 - .../cloud/securitycenter/v1/indicator.proto | 40 - .../v1/notification_config.proto | 96 - .../v1/notification_message.proto | 45 - .../v1/organization_settings.proto | 86 - .../cloud/securitycenter/v1/resource.proto | 59 - .../v1/run_asset_discovery_response.proto | 52 - .../securitycenter/v1/security_marks.proto | 70 - .../v1/securitycenter_service.proto | 1374 ----- .../cloud/securitycenter/v1/source.proto | 70 - .../securitycenter/v1/vulnerability.proto | 215 - .../v1/security_center.create_finding.js | 67 - ...urity_center.create_notification_config.js | 68 - .../v1/security_center.create_source.js | 60 - ...urity_center.delete_notification_config.js | 54 - .../v1/security_center.get_iam_policy.js | 59 - ...security_center.get_notification_config.js | 54 - ...curity_center.get_organization_settings.js | 54 - .../v1/security_center.get_source.js | 54 - .../v1/security_center.group_assets.js | 168 - .../v1/security_center.group_findings.js | 172 - .../v1/security_center.list_assets.js | 177 - .../v1/security_center.list_findings.js | 183 - ...curity_center.list_notification_configs.js | 67 - .../v1/security_center.list_sources.js | 68 - .../v1/security_center.run_asset_discovery.js | 55 - .../v1/security_center.set_finding_state.js | 66 - .../v1/security_center.set_iam_policy.js | 62 - .../security_center.test_iam_permissions.js | 62 - .../v1/security_center.update_finding.js | 66 - ...urity_center.update_notification_config.js | 58 - ...ity_center.update_organization_settings.js | 58 - .../security_center.update_security_marks.js | 66 - .../v1/security_center.update_source.js | 58 - owl-bot-staging/v1/src/index.ts | 25 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 277 - owl-bot-staging/v1/src/v1/index.ts | 19 - .../v1/src/v1/security_center_client.ts | 4987 ----------------- .../src/v1/security_center_client_config.json | 141 - .../v1/src/v1/security_center_proto_list.json | 15 - .../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_security_center_v1.ts | 3743 ------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - owl-bot-staging/v1beta1/.eslintignore | 7 - owl-bot-staging/v1beta1/.eslintrc.json | 3 - owl-bot-staging/v1beta1/.gitignore | 14 - owl-bot-staging/v1beta1/.jsdoc.js | 55 - owl-bot-staging/v1beta1/.mocharc.js | 33 - owl-bot-staging/v1beta1/.prettierrc.js | 22 - owl-bot-staging/v1beta1/README.md | 1 - .../v1beta1/linkinator.config.json | 10 - owl-bot-staging/v1beta1/package.json | 64 - .../cloud/securitycenter/v1beta1/asset.proto | 93 - .../securitycenter/v1beta1/finding.proto | 110 - .../v1beta1/organization_settings.proto | 79 - .../run_asset_discovery_response.proto | 49 - .../v1beta1/security_marks.proto | 53 - .../v1beta1/securitycenter_service.proto | 824 --- .../cloud/securitycenter/v1beta1/source.proto | 56 - .../v1beta1/security_center.create_finding.js | 67 - .../v1beta1/security_center.create_source.js | 60 - .../v1beta1/security_center.get_iam_policy.js | 59 - ...curity_center.get_organization_settings.js | 54 - .../v1beta1/security_center.get_source.js | 54 - .../v1beta1/security_center.group_assets.js | 131 - .../v1beta1/security_center.group_findings.js | 110 - .../v1beta1/security_center.list_assets.js | 136 - .../v1beta1/security_center.list_findings.js | 113 - .../v1beta1/security_center.list_sources.js | 67 - .../security_center.run_asset_discovery.js | 55 - .../security_center.set_finding_state.js | 66 - .../v1beta1/security_center.set_iam_policy.js | 62 - .../security_center.test_iam_permissions.js | 62 - .../v1beta1/security_center.update_finding.js | 62 - ...ity_center.update_organization_settings.js | 57 - .../security_center.update_security_marks.js | 61 - .../v1beta1/security_center.update_source.js | 57 - owl-bot-staging/v1beta1/src/index.ts | 25 - .../v1beta1/src/v1beta1/gapic_metadata.json | 223 - owl-bot-staging/v1beta1/src/v1beta1/index.ts | 19 - .../src/v1beta1/security_center_client.ts | 3248 ----------- .../security_center_client_config.json | 116 - .../v1beta1/security_center_proto_list.json | 9 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1beta1/system-test/install.ts | 49 - .../test/gapic_security_center_v1beta1.ts | 2731 --------- owl-bot-staging/v1beta1/tsconfig.json | 19 - owl-bot-staging/v1beta1/webpack.config.js | 64 - owl-bot-staging/v1p1beta1/.eslintignore | 7 - owl-bot-staging/v1p1beta1/.eslintrc.json | 3 - owl-bot-staging/v1p1beta1/.gitignore | 14 - owl-bot-staging/v1p1beta1/.jsdoc.js | 55 - owl-bot-staging/v1p1beta1/.mocharc.js | 33 - owl-bot-staging/v1p1beta1/.prettierrc.js | 22 - owl-bot-staging/v1p1beta1/README.md | 1 - .../v1p1beta1/linkinator.config.json | 10 - owl-bot-staging/v1p1beta1/package.json | 64 - .../securitycenter/v1p1beta1/asset.proto | 135 - .../securitycenter/v1p1beta1/finding.proto | 146 - .../securitycenter/v1p1beta1/folder.proto | 38 - .../v1p1beta1/notification_config.proto | 108 - .../v1p1beta1/notification_message.proto | 44 - .../v1p1beta1/organization_settings.proto | 86 - .../securitycenter/v1p1beta1/resource.proto | 53 - .../run_asset_discovery_response.proto | 52 - .../v1p1beta1/security_marks.proto | 70 - .../v1p1beta1/securitycenter_service.proto | 1351 ----- .../securitycenter/v1p1beta1/source.proto | 69 - .../security_center.create_finding.js | 65 - ...urity_center.create_notification_config.js | 67 - .../security_center.create_source.js | 60 - ...urity_center.delete_notification_config.js | 54 - .../security_center.get_iam_policy.js | 59 - ...security_center.get_notification_config.js | 54 - ...curity_center.get_organization_settings.js | 54 - .../v1p1beta1/security_center.get_source.js | 54 - .../v1p1beta1/security_center.group_assets.js | 168 - .../security_center.group_findings.js | 164 - .../v1p1beta1/security_center.list_assets.js | 177 - .../security_center.list_findings.js | 173 - ...curity_center.list_notification_configs.js | 67 - .../v1p1beta1/security_center.list_sources.js | 68 - .../security_center.run_asset_discovery.js | 55 - .../security_center.set_finding_state.js | 66 - .../security_center.set_iam_policy.js | 62 - .../security_center.test_iam_permissions.js | 62 - .../security_center.update_finding.js | 66 - ...urity_center.update_notification_config.js | 58 - ...ity_center.update_organization_settings.js | 58 - .../security_center.update_security_marks.js | 66 - .../security_center.update_source.js | 58 - owl-bot-staging/v1p1beta1/src/index.ts | 25 - .../src/v1p1beta1/gapic_metadata.json | 277 - .../v1p1beta1/src/v1p1beta1/index.ts | 19 - .../src/v1p1beta1/security_center_client.ts | 4923 ---------------- .../security_center_client_config.json | 141 - .../v1p1beta1/security_center_proto_list.json | 13 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1p1beta1/system-test/install.ts | 49 - .../test/gapic_security_center_v1p1beta1.ts | 3743 ------------- owl-bot-staging/v1p1beta1/tsconfig.json | 19 - owl-bot-staging/v1p1beta1/webpack.config.js | 64 - .../v1p1beta1/securitycenter_service.proto | 2 +- ...ity_center.update_organization_settings.js | 2 +- src/v1p1beta1/security_center_client.ts | 2 +- 161 files changed, 3 insertions(+), 36866 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/securitycenter/v1/asset.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/finding.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/folder.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/indicator.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_config.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_message.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/resource.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/security_marks.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/source.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.create_finding.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.create_notification_config.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.create_source.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.delete_notification_config.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.get_iam_policy.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.get_notification_config.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.get_organization_settings.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.get_source.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.group_assets.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.group_findings.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.list_assets.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.list_findings.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.list_notification_configs.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.list_sources.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.run_asset_discovery.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.set_finding_state.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.set_iam_policy.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.test_iam_permissions.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.update_finding.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.update_notification_config.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.update_organization_settings.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.update_security_marks.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.update_source.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/security_center_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/security_center_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/security_center_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_security_center_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/v1beta1/.eslintignore delete mode 100644 owl-bot-staging/v1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/v1beta1/.gitignore delete mode 100644 owl-bot-staging/v1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/v1beta1/.mocharc.js delete mode 100644 owl-bot-staging/v1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/v1beta1/README.md delete mode 100644 owl-bot-staging/v1beta1/linkinator.config.json delete mode 100644 owl-bot-staging/v1beta1/package.json delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto delete mode 100644 owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_finding.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_source.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_source.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_assets.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_findings.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_assets.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_findings.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_sources.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_finding.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js delete mode 100644 owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_source.js delete mode 100644 owl-bot-staging/v1beta1/src/index.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/index.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/security_center_client.ts delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/security_center_client_config.json delete mode 100644 owl-bot-staging/v1beta1/src/v1beta1/security_center_proto_list.json delete mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/v1beta1/test/gapic_security_center_v1beta1.ts delete mode 100644 owl-bot-staging/v1beta1/tsconfig.json delete mode 100644 owl-bot-staging/v1beta1/webpack.config.js delete mode 100644 owl-bot-staging/v1p1beta1/.eslintignore delete mode 100644 owl-bot-staging/v1p1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/v1p1beta1/.gitignore delete mode 100644 owl-bot-staging/v1p1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/v1p1beta1/.mocharc.js delete mode 100644 owl-bot-staging/v1p1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/v1p1beta1/README.md delete mode 100644 owl-bot-staging/v1p1beta1/linkinator.config.json delete mode 100644 owl-bot-staging/v1p1beta1/package.json delete mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto delete mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto delete mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto delete mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto delete mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto delete mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto delete mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto delete mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto delete mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto delete mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto delete mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js delete mode 100644 owl-bot-staging/v1p1beta1/src/index.ts delete mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts delete mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client.ts delete mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client_config.json delete mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_proto_list.json delete mode 100644 owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1p1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts delete mode 100644 owl-bot-staging/v1p1beta1/tsconfig.json delete mode 100644 owl-bot-staging/v1p1beta1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index cfc348ec..00000000 --- a/owl-bot-staging/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json deleted file mode 100644 index 78215349..00000000 --- a/owl-bot-staging/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore deleted file mode 100644 index 5d32b237..00000000 --- a/owl-bot-staging/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js deleted file mode 100644 index e201160b..00000000 --- a/owl-bot-staging/v1/.jsdoc.js +++ /dev/null @@ -1,55 +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. -// -// ** 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 2021 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/security-center', - 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 50bc7f79..00000000 --- a/owl-bot-staging/v1/.mocharc.js +++ /dev/null @@ -1,33 +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. -// -// ** 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 84f4713a..00000000 --- a/owl-bot-staging/v1/.prettierrc.js +++ /dev/null @@ -1,22 +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. -// -// ** 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 73f34764..00000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Securitycenter: 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 0121dfa6..00000000 --- a/owl-bot-staging/v1/linkinator.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io" - ], - "silent": true, - "concurrency": 5 -} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index b88a2160..00000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/security-center", - "version": "0.1.0", - "description": "Securitycenter client for Node.js", - "repository": "googleapis/nodejs-securitycenter", - "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 securitycenter", - "securitycenter", - "security center" - ], - "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": "^2.28.0" - }, - "devDependencies": { - "@types/mocha": "^9.0.0", - "@types/node": "^14.17.32", - "@types/sinon": "^10.0.6", - "c8": "^7.10.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^2.14.5", - "mocha": "^9.1.3", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.2", - "ts-loader": "^9.2.6", - "typescript": "^4.4.4", - "webpack": "^5.62.1", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/asset.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/asset.proto deleted file mode 100644 index b23a4232..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/asset.proto +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1/folder.proto"; -import "google/cloud/securitycenter/v1/security_marks.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Security Command Center representation of a Google Cloud -// resource. -// -// The Asset is a Security Command Center resource that captures information -// about a single Google Cloud resource. All modifications to an Asset are only -// within the context of Security Command Center and don't affect the referenced -// Google Cloud resource. -message Asset { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Asset" - pattern: "organizations/{organization}/assets/{asset}" - pattern: "folders/{folder}/assets/{asset}" - pattern: "projects/{project}/assets/{asset}" - }; - - // Security Command Center managed properties. These properties are managed by - // Security Command Center and cannot be modified by the user. - message SecurityCenterProperties { - // The full resource name of the Google Cloud resource this asset - // represents. This field is immutable after create time. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_name = 1; - - // The type of the Google Cloud resource. Examples include: APPLICATION, - // PROJECT, and ORGANIZATION. This is a case insensitive field defined by - // Security Command Center and/or the producer of the resource and is - // immutable after create time. - string resource_type = 2; - - // The full resource name of the immediate parent of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_parent = 3; - - // The full resource name of the project the resource belongs to. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_project = 4; - - // Owners of the Google Cloud resource. - repeated string resource_owners = 5; - - // The user defined display name for this resource. - string resource_display_name = 6; - - // The user defined display name for the parent of this resource. - string resource_parent_display_name = 7; - - // The user defined display name for the project of this resource. - string resource_project_display_name = 8; - - // Contains a Folder message for each folder in the assets ancestry. - // The first folder is the deepest nested folder, and the last folder is the - // folder directly under the Organization. - repeated Folder folders = 10; - } - - // Cloud IAM Policy information associated with the Google Cloud resource - // described by the Security Command Center asset. This information is managed - // and defined by the Google Cloud resource and cannot be modified by the - // user. - message IamPolicy { - // The JSON representation of the Policy associated with the asset. - // See https://cloud.google.com/iam/reference/rest/v1/Policy for format - // details. - string policy_blob = 1; - } - - // The relative resource name of this asset. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/assets/{asset_id}". - string name = 1; - - // Security Command Center managed properties. These properties are managed by - // Security Command Center and cannot be modified by the user. - SecurityCenterProperties security_center_properties = 2; - - // Resource managed properties. These properties are managed and defined by - // the Google Cloud resource and cannot be modified by the user. - map resource_properties = 7; - - // User specified security marks. These marks are entirely managed by the user - // and come from the SecurityMarks resource that belongs to the asset. - SecurityMarks security_marks = 8; - - // The time at which the asset was created in Security Command Center. - google.protobuf.Timestamp create_time = 9; - - // The time at which the asset was last updated or added in Cloud SCC. - google.protobuf.Timestamp update_time = 10; - - // Cloud IAM Policy information associated with the Google Cloud resource - // described by the Security Command Center asset. This information is managed - // and defined by the Google Cloud resource and cannot be modified by the - // user. - IamPolicy iam_policy = 11; - - // The canonical name of the resource. It's either - // "organizations/{organization_id}/assets/{asset_id}", - // "folders/{folder_id}/assets/{asset_id}" or - // "projects/{project_number}/assets/{asset_id}", depending on the closest CRM - // ancestor of the resource. - string canonical_name = 13; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/finding.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/finding.proto deleted file mode 100644 index e14266b4..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/finding.proto +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1/indicator.proto"; -import "google/cloud/securitycenter/v1/security_marks.proto"; -import "google/cloud/securitycenter/v1/vulnerability.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Security Command Center finding. -// -// A finding is a record of assessment data like security, risk, health, or -// privacy, that is ingested into Security Command Center for presentation, -// notification, analysis, policy testing, and enforcement. For example, a -// cross-site scripting (XSS) vulnerability in an App Engine application is a -// finding. -message Finding { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Finding" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}" - pattern: "folders/{folder}/sources/{source}/findings/{finding}" - pattern: "projects/{project}/sources/{source}/findings/{finding}" - }; - - // The state of the finding. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // The finding requires attention and has not been addressed yet. - ACTIVE = 1; - - // The finding has been fixed, triaged as a non-issue or otherwise addressed - // and is no longer active. - INACTIVE = 2; - } - - // The severity of the finding. - enum Severity { - // This value is used for findings when a source doesn't write a severity - // value. - SEVERITY_UNSPECIFIED = 0; - - // Vulnerability: - // A critical vulnerability is easily discoverable by an external actor, - // exploitable, and results in the direct ability to execute arbitrary code, - // exfiltrate data, and otherwise gain additional access and privileges to - // cloud resources and workloads. Examples include publicly accessible - // unprotected user data, public SSH access with weak or no passwords, etc. - // - // Threat: - // Indicates a threat that is able to access, modify, or delete data or - // execute unauthorized code within existing resources. - CRITICAL = 1; - - // Vulnerability: - // A high risk vulnerability can be easily discovered and exploited in - // combination with other vulnerabilities in order to gain direct access and - // the ability to execute arbitrary code, exfiltrate data, and otherwise - // gain additional access and privileges to cloud resources and workloads. - // An example is a database with weak or no passwords that is only - // accessible internally. This database could easily be compromised by an - // actor that had access to the internal network. - // - // Threat: - // Indicates a threat that is able to create new computational resources in - // an environment but not able to access data or execute code in existing - // resources. - HIGH = 2; - - // Vulnerability: - // A medium risk vulnerability could be used by an actor to gain access to - // resources or privileges that enable them to eventually (through multiple - // steps or a complex exploit) gain access and the ability to execute - // arbitrary code or exfiltrate data. An example is a service account with - // access to more projects than it should have. If an actor gains access to - // the service account, they could potentially use that access to manipulate - // a project the service account was not intended to. - // - // Threat: - // Indicates a threat that is able to cause operational impact but may not - // access data or execute unauthorized code. - MEDIUM = 3; - - // Vulnerability: - // A low risk vulnerability hampers a security organization’s ability to - // detect vulnerabilities or active threats in their deployment, or prevents - // the root cause investigation of security issues. An example is monitoring - // and logs being disabled for resource configurations and access. - // - // Threat: - // Indicates a threat that has obtained minimal access to an environment but - // is not able to access data, execute code, or create resources. - LOW = 4; - } - - // Represents what kind of Finding it is. - enum FindingClass { - // Unspecified finding class. - FINDING_CLASS_UNSPECIFIED = 0; - - // Describes unwanted or malicious activity. - THREAT = 1; - - // Describes a potential weakness in software that increases risk to - // Confidentiality & Integrity & Availability. - VULNERABILITY = 2; - - // Describes a potential weakness in cloud resource/asset configuration that - // increases risk. - MISCONFIGURATION = 3; - - // Describes a security observation that is for informational purposes. - OBSERVATION = 4; - } - - // The relative resource name of this finding. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}" - string name = 1; - - // The relative resource name of the source the finding belongs to. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // This field is immutable after creation time. - // For example: - // "organizations/{organization_id}/sources/{source_id}" - string parent = 2; - - // For findings on Google Cloud resources, the full resource - // name of the Google Cloud resource this finding is for. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - // When the finding is for a non-Google Cloud resource, the resourceName can - // be a customer or partner defined string. This field is immutable after - // creation time. - string resource_name = 3; - - // The state of the finding. - State state = 4; - - // The additional taxonomy group within findings from a given source. - // This field is immutable after creation time. - // Example: "XSS_FLASH_INJECTION" - string category = 5; - - // The URI that, if available, points to a web page outside of Security - // Command Center where additional information about the finding can be found. - // This field is guaranteed to be either empty or a well formed URL. - string external_uri = 6; - - // Source specific properties. These properties are managed by the source - // that writes the finding. The key names in the source_properties map must be - // between 1 and 255 characters, and must start with a letter and contain - // alphanumeric characters or underscores only. - map source_properties = 7; - - // Output only. User specified security marks. These marks are entirely - // managed by the user and come from the SecurityMarks resource that belongs - // to the finding. - SecurityMarks security_marks = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The time at which the event took place, or when an update to the finding - // occurred. For example, if the finding represents an open firewall it would - // capture the time the detector believes the firewall became open. The - // accuracy is determined by the detector. If the finding were to be resolved - // afterward, this time would reflect when the finding was resolved. Must not - // be set to a value greater than the current timestamp. - google.protobuf.Timestamp event_time = 9; - - // The time at which the finding was created in Security Command Center. - google.protobuf.Timestamp create_time = 10; - - // The severity of the finding. This field is managed by the source that - // writes the finding. - Severity severity = 12; - - // The canonical name of the finding. It's either - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", - // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}" or - // "projects/{project_number}/sources/{source_id}/findings/{finding_id}", - // depending on the closest CRM ancestor of the resource associated with the - // finding. - string canonical_name = 14; - - // The class of the finding. - FindingClass finding_class = 17; - - // Represents what's commonly known as an Indicator of compromise (IoC) in - // computer forensics. This is an artifact observed on a network or in an - // operating system that, with high confidence, indicates a computer - // intrusion. - // Reference: https://en.wikipedia.org/wiki/Indicator_of_compromise - Indicator indicator = 18; - - // Represents vulnerability specific fields like cve, cvss scores etc. - // CVE stands for Common Vulnerabilities and Exposures - // (https://cve.mitre.org/about/) - Vulnerability vulnerability = 20; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/folder.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/folder.proto deleted file mode 100644 index 49c114d4..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/folder.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; -option java_multiple_files = true; -option java_outer_classname = "FolderProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Message that contains the resource name and display name of a folder -// resource. -message Folder { - // Full resource name of this folder. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_folder = 1; - - // The user defined display name for this folder. - string resource_folder_display_name = 2; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/indicator.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/indicator.proto deleted file mode 100644 index f785156f..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/indicator.proto +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; -option java_multiple_files = true; -option java_outer_classname = "IndicatorProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - - -// Represents what's commonly known as an Indicator of compromise (IoC) in -// computer forensics. This is an artifact observed on a network or in an -// operating system that, with high confidence, indicates a computer intrusion. -// Reference: https://en.wikipedia.org/wiki/Indicator_of_compromise -message Indicator { - // List of ip addresses associated to the Finding. - repeated string ip_addresses = 1; - - // List of domains associated to the Finding. - repeated string domains = 2; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_config.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_config.proto deleted file mode 100644 index 7f670279..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_config.proto +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; -option java_multiple_files = true; -option java_outer_classname = "NotificationConfigProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" -}; - -// Cloud Security Command Center (Cloud SCC) notification configs. -// -// A notification config is a Cloud SCC resource that contains the configuration -// to send notifications for create/update events of findings, assets and etc. -message NotificationConfig { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/NotificationConfig" - pattern: "organizations/{organization}/notificationConfigs/{notification_config}" - }; - - // The config for streaming-based notifications, which send each event as soon - // as it is detected. - message StreamingConfig { - // Expression that defines the filter to apply across create/update events - // of assets or findings as specified by the event type. The expression is a - // list of zero or more restrictions combined via logical operators `AND` - // and `OR`. Parentheses are supported, and `OR` has higher precedence than - // `AND`. - // - // Restrictions have the form ` ` and may have a - // `-` character in front of them to indicate negation. The fields map to - // those defined in the corresponding resource. - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - string filter = 1; - } - - // The relative resource name of this notification config. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/notificationConfigs/notify_public_bucket". - string name = 1; - - // The description of the notification config (max of 1024 characters). - string description = 2; - - // The Pub/Sub topic to send notifications to. Its format is - // "projects/[project_id]/topics/[topic]". - string pubsub_topic = 3 [(google.api.resource_reference) = { - type: "pubsub.googleapis.com/Topic" - }]; - - // Output only. The service account that needs "pubsub.topics.publish" - // permission to publish to the Pub/Sub topic. - string service_account = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The config for triggering notifications. - oneof notify_config { - // The config for triggering streaming-based notifications. - StreamingConfig streaming_config = 5; - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_message.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_message.proto deleted file mode 100644 index 6a9ce085..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_message.proto +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/cloud/securitycenter/v1/finding.proto"; -import "google/cloud/securitycenter/v1/resource.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; -option java_multiple_files = true; -option java_outer_classname = "NotificationMessageProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Cloud SCC's Notification -message NotificationMessage { - // Name of the notification config that generated current notification. - string notification_config_name = 1; - - // Notification Event. - oneof event { - // If it's a Finding based notification config, this field will be - // populated. - Finding finding = 2; - } - - // The Cloud resource tied to this notification's Finding. - Resource resource = 3; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto deleted file mode 100644 index 1dc77257..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/resource.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// User specified settings that are attached to the Security Command -// Center organization. -message OrganizationSettings { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/OrganizationSettings" - pattern: "organizations/{organization}/organizationSettings" - }; - - // The configuration used for Asset Discovery runs. - message AssetDiscoveryConfig { - // The mode of inclusion when running Asset Discovery. - // Asset discovery can be limited by explicitly identifying projects to be - // included or excluded. If INCLUDE_ONLY is set, then only those projects - // within the organization and their children are discovered during asset - // discovery. If EXCLUDE is set, then projects that don't match those - // projects are discovered during asset discovery. If neither are set, then - // all projects within the organization are discovered during asset - // discovery. - enum InclusionMode { - // Unspecified. Setting the mode with this value will disable - // inclusion/exclusion filtering for Asset Discovery. - INCLUSION_MODE_UNSPECIFIED = 0; - - // Asset Discovery will capture only the resources within the projects - // specified. All other resources will be ignored. - INCLUDE_ONLY = 1; - - // Asset Discovery will ignore all resources under the projects specified. - // All other resources will be retrieved. - EXCLUDE = 2; - } - - // The project ids to use for filtering asset discovery. - repeated string project_ids = 1; - - // The mode to use for filtering asset discovery. - InclusionMode inclusion_mode = 2; - - // The folder ids to use for filtering asset discovery. - // It consists of only digits, e.g., 756619654966. - repeated string folder_ids = 3; - } - - // The relative resource name of the settings. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/organizationSettings". - string name = 1; - - // A flag that indicates if Asset Discovery should be enabled. If the flag is - // set to `true`, then discovery of assets will occur. If it is set to `false, - // all historical assets will remain, but discovery of future assets will not - // occur. - bool enable_asset_discovery = 2; - - // The configuration used for Asset Discovery runs. - AssetDiscoveryConfig asset_discovery_config = 3; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/resource.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/resource.proto deleted file mode 100644 index 8377329e..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/resource.proto +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/field_behavior.proto"; -import "google/cloud/securitycenter/v1/folder.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; -option java_multiple_files = true; -option java_outer_classname = "ResourceProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Information related to the Google Cloud resource. -message Resource { - // The full resource name of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string name = 1; - - // The full resource name of project that the resource belongs to. - string project = 2; - - // The human readable name of project that the resource belongs to. - string project_display_name = 3; - - // The full resource name of resource's parent. - string parent = 4; - - // The human readable name of resource's parent. - string parent_display_name = 5; - - // The full resource type of the resource. - string type = 6; - - // Output only. Contains a Folder message for each folder in the assets ancestry. - // The first folder is the deepest nested folder, and the last folder is the - // folder directly under the Organization. - repeated Folder folders = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The human readable name of the resource. - string display_name = 8; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto deleted file mode 100644 index 20d084ca..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/protobuf/duration.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Response of asset discovery run -message RunAssetDiscoveryResponse { - // The state of an asset discovery run. - enum State { - // Asset discovery run state was unspecified. - STATE_UNSPECIFIED = 0; - - // Asset discovery run completed successfully. - COMPLETED = 1; - - // Asset discovery run was cancelled with tasks still pending, as another - // run for the same organization was started with a higher priority. - SUPERSEDED = 2; - - // Asset discovery run was killed and terminated. - TERMINATED = 3; - } - - // The state of an asset discovery run. - State state = 1; - - // The duration between asset discovery run start and end - google.protobuf.Duration duration = 2; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/security_marks.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/security_marks.proto deleted file mode 100644 index f055cd5e..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/security_marks.proto +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/resource.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// User specified security marks that are attached to the parent Security -// Command Center resource. Security marks are scoped within a Security Command -// Center organization -- they can be modified and viewed by all users who have -// proper permissions on the organization. -message SecurityMarks { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/SecurityMarks" - pattern: "organizations/{organization}/assets/{asset}/securityMarks" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}/securityMarks" - pattern: "folders/{folder}/assets/{asset}/securityMarks" - pattern: "projects/{project}/assets/{asset}/securityMarks" - pattern: "folders/{folder}/sources/{source}/findings/{finding}/securityMarks" - pattern: "projects/{project}/sources/{source}/findings/{finding}/securityMarks" - }; - - // The relative resource name of the SecurityMarks. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Examples: - // "organizations/{organization_id}/assets/{asset_id}/securityMarks" - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks". - string name = 1; - - // Mutable user specified security marks belonging to the parent resource. - // Constraints are as follows: - // - // * Keys and values are treated as case insensitive - // * Keys must be between 1 - 256 characters (inclusive) - // * Keys must be letters, numbers, underscores, or dashes - // * Values have leading and trailing whitespace trimmed, remaining - // characters must be between 1 - 4096 characters (inclusive) - map marks = 2; - - // The canonical name of the marks. - // Examples: - // "organizations/{organization_id}/assets/{asset_id}/securityMarks" - // "folders/{folder_id}/assets/{asset_id}/securityMarks" - // "projects/{project_number}/assets/{asset_id}/securityMarks" - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks" - // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}/securityMarks" - // "projects/{project_number}/sources/{source_id}/findings/{finding_id}/securityMarks" - string canonical_name = 3; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto deleted file mode 100644 index 89f89a0c..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto +++ /dev/null @@ -1,1374 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import public "google/cloud/securitycenter/v1/run_asset_discovery_response.proto"; -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1/asset.proto"; -import "google/cloud/securitycenter/v1/finding.proto"; -import "google/cloud/securitycenter/v1/folder.proto"; -import "google/cloud/securitycenter/v1/notification_config.proto"; -import "google/cloud/securitycenter/v1/organization_settings.proto"; -import "google/cloud/securitycenter/v1/security_marks.proto"; -import "google/cloud/securitycenter/v1/source.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// V1 APIs for Security Center service. -service SecurityCenter { - option (google.api.default_host) = "securitycenter.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a source. - rpc CreateSource(CreateSourceRequest) returns (Source) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/sources" - body: "source" - }; - option (google.api.method_signature) = "parent,source"; - } - - // Creates a finding. The corresponding source must exist for finding creation - // to succeed. - rpc CreateFinding(CreateFindingRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*/sources/*}/findings" - body: "finding" - }; - option (google.api.method_signature) = "parent,finding_id,finding"; - } - - // Creates a notification config. - rpc CreateNotificationConfig(CreateNotificationConfigRequest) returns (NotificationConfig) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/notificationConfigs" - body: "notification_config" - }; - option (google.api.method_signature) = "parent,config_id,notification_config"; - option (google.api.method_signature) = "parent,notification_config"; - } - - // Deletes a notification config. - rpc DeleteNotificationConfig(DeleteNotificationConfigRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=organizations/*/notificationConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets the access control policy on the specified Source. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=organizations/*/sources/*}:getIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource"; - } - - // Gets a notification config. - rpc GetNotificationConfig(GetNotificationConfigRequest) returns (NotificationConfig) { - option (google.api.http) = { - get: "/v1/{name=organizations/*/notificationConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets the settings for an organization. - rpc GetOrganizationSettings(GetOrganizationSettingsRequest) returns (OrganizationSettings) { - option (google.api.http) = { - get: "/v1/{name=organizations/*/organizationSettings}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a source. - rpc GetSource(GetSourceRequest) returns (Source) { - option (google.api.http) = { - get: "/v1/{name=organizations/*/sources/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Filters an organization's assets and groups them by their specified - // properties. - rpc GroupAssets(GroupAssetsRequest) returns (GroupAssetsResponse) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/assets:group" - body: "*" - additional_bindings { - post: "/v1/{parent=folders/*}/assets:group" - body: "*" - } - additional_bindings { - post: "/v1/{parent=projects/*}/assets:group" - body: "*" - } - }; - } - - // Filters an organization or source's findings and groups them by their - // specified properties. - // - // To group across all sources provide a `-` as the source id. - // Example: /v1/organizations/{organization_id}/sources/-/findings, - // /v1/folders/{folder_id}/sources/-/findings, - // /v1/projects/{project_id}/sources/-/findings - rpc GroupFindings(GroupFindingsRequest) returns (GroupFindingsResponse) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*/sources/*}/findings:group" - body: "*" - additional_bindings { - post: "/v1/{parent=folders/*/sources/*}/findings:group" - body: "*" - } - additional_bindings { - post: "/v1/{parent=projects/*/sources/*}/findings:group" - body: "*" - } - }; - option (google.api.method_signature) = "parent,group_by"; - } - - // Lists an organization's assets. - rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*}/assets" - additional_bindings { - get: "/v1/{parent=folders/*}/assets" - } - additional_bindings { - get: "/v1/{parent=projects/*}/assets" - } - }; - } - - // Lists an organization or source's findings. - // - // To list across all sources provide a `-` as the source id. - // Example: /v1/organizations/{organization_id}/sources/-/findings - rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*/sources/*}/findings" - additional_bindings { - get: "/v1/{parent=folders/*/sources/*}/findings" - } - additional_bindings { - get: "/v1/{parent=projects/*/sources/*}/findings" - } - }; - } - - // Lists notification configs. - rpc ListNotificationConfigs(ListNotificationConfigsRequest) returns (ListNotificationConfigsResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*}/notificationConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Lists all sources belonging to an organization. - rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*}/sources" - additional_bindings { - get: "/v1/{parent=folders/*}/sources" - } - additional_bindings { - get: "/v1/{parent=projects/*}/sources" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Runs asset discovery. The discovery is tracked with a long-running - // operation. - // - // This API can only be called with limited frequency for an organization. If - // it is called too frequently the caller will receive a TOO_MANY_REQUESTS - // error. - rpc RunAssetDiscovery(RunAssetDiscoveryRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/assets:runDiscovery" - body: "*" - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.securitycenter.v1.RunAssetDiscoveryResponse" - metadata_type: "google.protobuf.Empty" - }; - } - - // Updates the state of a finding. - rpc SetFindingState(SetFindingStateRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1/{name=organizations/*/sources/*/findings/*}:setState" - body: "*" - additional_bindings { - post: "/v1/{name=folders/*/sources/*/findings/*}:setState" - body: "*" - } - additional_bindings { - post: "/v1/{name=projects/*/sources/*/findings/*}:setState" - body: "*" - } - }; - option (google.api.method_signature) = "name,state,start_time"; - } - - // Sets the access control policy on the specified Source. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=organizations/*/sources/*}:setIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Returns the permissions that a caller has on the specified source. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1/{resource=organizations/*/sources/*}:testIamPermissions" - body: "*" - }; - option (google.api.method_signature) = "resource,permissions"; - } - - // Creates or updates a finding. The corresponding source must exist for a - // finding creation to succeed. - rpc UpdateFinding(UpdateFindingRequest) returns (Finding) { - option (google.api.http) = { - patch: "/v1/{finding.name=organizations/*/sources/*/findings/*}" - body: "finding" - additional_bindings { - patch: "/v1/{finding.name=folders/*/sources/*/findings/*}" - body: "finding" - } - additional_bindings { - patch: "/v1/{finding.name=projects/*/sources/*/findings/*}" - body: "finding" - } - }; - option (google.api.method_signature) = "finding"; - } - - // - // Updates a notification config. The following update - // fields are allowed: description, pubsub_topic, streaming_config.filter - rpc UpdateNotificationConfig(UpdateNotificationConfigRequest) returns (NotificationConfig) { - option (google.api.http) = { - patch: "/v1/{notification_config.name=organizations/*/notificationConfigs/*}" - body: "notification_config" - }; - option (google.api.method_signature) = "notification_config"; - option (google.api.method_signature) = "notification_config,update_mask"; - } - - // Updates an organization's settings. - rpc UpdateOrganizationSettings(UpdateOrganizationSettingsRequest) returns (OrganizationSettings) { - option (google.api.http) = { - patch: "/v1/{organization_settings.name=organizations/*/organizationSettings}" - body: "organization_settings" - }; - option (google.api.method_signature) = "organization_settings"; - } - - // Updates a source. - rpc UpdateSource(UpdateSourceRequest) returns (Source) { - option (google.api.http) = { - patch: "/v1/{source.name=organizations/*/sources/*}" - body: "source" - }; - option (google.api.method_signature) = "source"; - } - - // Updates security marks. - rpc UpdateSecurityMarks(UpdateSecurityMarksRequest) returns (SecurityMarks) { - option (google.api.http) = { - patch: "/v1/{security_marks.name=organizations/*/assets/*/securityMarks}" - body: "security_marks" - additional_bindings { - patch: "/v1/{security_marks.name=folders/*/assets/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1/{security_marks.name=projects/*/assets/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1/{security_marks.name=folders/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1/{security_marks.name=projects/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - }; - option (google.api.method_signature) = "security_marks"; - } -} - -// Request message for creating a finding. -message CreateFindingRequest { - // Required. Resource name of the new finding's parent. Its format should be - // "organizations/[organization_id]/sources/[source_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Required. Unique identifier provided by the client within the parent scope. - // It must be alphanumeric and less than or equal to 32 characters and - // greater than 0 characters in length. - string finding_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Finding being created. The name and security_marks will be ignored as - // they are both output only fields on this resource. - Finding finding = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for creating a notification config. -message CreateNotificationConfigRequest { - // Required. Resource name of the new notification config's parent. Its format is - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Required. - // Unique identifier provided by the client within the parent scope. - // It must be between 1 and 128 characters, and contains alphanumeric - // characters, underscores or hyphens only. - string config_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The notification config being created. The name and the service account - // will be ignored as they are both output only fields on this resource. - NotificationConfig notification_config = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for creating a source. -message CreateSourceRequest { - // Required. Resource name of the new source's parent. Its format should be - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Required. The Source being created, only the display_name and description will be - // used. All other fields will be ignored. - Source source = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for deleting a notification config. -message DeleteNotificationConfigRequest { - // Required. Name of the notification config to delete. Its format is - // "organizations/[organization_id]/notificationConfigs/[config_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/NotificationConfig" - } - ]; -} - -// Request message for getting a notification config. -message GetNotificationConfigRequest { - // Required. Name of the notification config to get. Its format is - // "organizations/[organization_id]/notificationConfigs/[config_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/NotificationConfig" - } - ]; -} - -// Request message for getting organization settings. -message GetOrganizationSettingsRequest { - // Required. Name of the organization to get organization settings for. Its format is - // "organizations/[organization_id]/organizationSettings". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/OrganizationSettings" - } - ]; -} - -// Request message for getting a source. -message GetSourceRequest { - // Required. Relative resource name of the source. Its format is - // "organizations/[organization_id]/source/[source_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; -} - -// Request message for grouping by assets. -message GroupAssetsRequest { - // Required. Name of the organization to groupBy. Its format is - // "organizations/[organization_id], folders/[folder_id], or - // projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/Asset" - } - ]; - - // Expression that defines the filter to apply across assets. - // The expression is a list of zero or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. The fields map to those - // defined in the Asset resource. Examples include: - // - // * name - // * security_center_properties.resource_name - // * resource_properties.a_property - // * security_marks.marks.marka - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - // - // The following field and operator combinations are supported: - // - // * name: `=` - // * update_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `update_time = "2019-06-10T16:07:18-07:00"` - // `update_time = 1560208038000` - // - // * create_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `create_time = "2019-06-10T16:07:18-07:00"` - // `create_time = 1560208038000` - // - // * iam_policy.policy_blob: `=`, `:` - // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // * security_marks.marks: `=`, `:` - // * security_center_properties.resource_name: `=`, `:` - // * security_center_properties.resource_display_name: `=`, `:` - // * security_center_properties.resource_type: `=`, `:` - // * security_center_properties.resource_parent: `=`, `:` - // * security_center_properties.resource_parent_display_name: `=`, `:` - // * security_center_properties.resource_project: `=`, `:` - // * security_center_properties.resource_project_display_name: `=`, `:` - // * security_center_properties.resource_owners: `=`, `:` - // - // For example, `resource_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `resource_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-resource_properties.my_property : ""` - string filter = 2; - - // Required. Expression that defines what assets fields to use for grouping. The string - // value should follow SQL syntax: comma separated list of fields. For - // example: - // "security_center_properties.resource_project,security_center_properties.project". - // - // The following fields are supported when compare_duration is not set: - // - // * security_center_properties.resource_project - // * security_center_properties.resource_project_display_name - // * security_center_properties.resource_type - // * security_center_properties.resource_parent - // * security_center_properties.resource_parent_display_name - // - // The following fields are supported when compare_duration is set: - // - // * security_center_properties.resource_type - // * security_center_properties.resource_project_display_name - // * security_center_properties.resource_parent_display_name - string group_by = 3 [(google.api.field_behavior) = REQUIRED]; - - // When compare_duration is set, the GroupResult's "state_change" property is - // updated to indicate whether the asset was added, removed, or remained - // present during the compare_duration period of time that precedes the - // read_time. This is the time between (read_time - compare_duration) and - // read_time. - // - // The state change value is derived based on the presence of the asset at the - // two points in time. Intermediate state changes between the two times don't - // affect the result. For example, the results aren't affected if the asset is - // removed and re-created again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "ADDED": indicates that the asset was not present at the start of - // compare_duration, but present at reference_time. - // * "REMOVED": indicates that the asset was present at the start of - // compare_duration, but not present at reference_time. - // * "ACTIVE": indicates that the asset was present at both the - // start and the end of the time period defined by - // compare_duration and reference_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all assets present at - // read_time. - // - // If this field is set then `state_change` must be a specified field in - // `group_by`. - google.protobuf.Duration compare_duration = 4; - - // Time used as a reference point when filtering assets. The filter is limited - // to assets existing at the supplied time and their values are those at that - // specific time. Absence of this field will default to the API's version of - // NOW. - google.protobuf.Timestamp read_time = 5; - - // The value returned by the last `GroupAssetsResponse`; indicates - // that this is a continuation of a prior `GroupAssets` call, and that the - // system should return the next page of data. - string page_token = 7; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 8; -} - -// Response message for grouping by assets. -message GroupAssetsResponse { - // Group results. There exists an element for each existing unique - // combination of property/values. The element contains a count for the number - // of times those specific property/values appear. - repeated GroupResult group_by_results = 1; - - // Time used for executing the groupBy request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of results matching the query. - int32 total_size = 4; -} - -// Request message for grouping by findings. -message GroupFindingsRequest { - // Required. Name of the source to groupBy. Its format is - // "organizations/[organization_id]/sources/[source_id]", - // folders/[folder_id]/sources/[source_id], or - // projects/[project_id]/sources/[source_id]. To groupBy across all sources - // provide a source_id of `-`. For example: - // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - // or projects/{project_id}/sources/- - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Expression that defines the filter to apply across findings. - // The expression is a list of one or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. Examples include: - // - // * name - // * source_properties.a_property - // * security_marks.marks.marka - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - // - // The following field and operator combinations are supported: - // - // * name: `=` - // * parent: `=`, `:` - // * resource_name: `=`, `:` - // * state: `=`, `:` - // * category: `=`, `:` - // * external_uri: `=`, `:` - // * event_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `event_time = "2019-06-10T16:07:18-07:00"` - // `event_time = 1560208038000` - // - // * severity: `=`, `:` - // * workflow_state: `=`, `:` - // * security_marks.marks: `=`, `:` - // * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // - // For example, `source_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `source_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-source_properties.my_property : ""` - // - // * resource: - // * resource.name: `=`, `:` - // * resource.parent_name: `=`, `:` - // * resource.parent_display_name: `=`, `:` - // * resource.project_name: `=`, `:` - // * resource.project_display_name: `=`, `:` - // * resource.type: `=`, `:` - string filter = 2; - - // Required. Expression that defines what assets fields to use for grouping (including - // `state_change`). The string value should follow SQL syntax: comma separated - // list of fields. For example: "parent,resource_name". - // - // The following fields are supported: - // - // * resource_name - // * category - // * state - // * parent - // * severity - // - // The following fields are supported when compare_duration is set: - // - // * state_change - string group_by = 3 [(google.api.field_behavior) = REQUIRED]; - - // Time used as a reference point when filtering findings. The filter is - // limited to findings existing at the supplied time and their values are - // those at that specific time. Absence of this field will default to the - // API's version of NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the GroupResult's "state_change" attribute is - // updated to indicate whether the finding had its state changed, the - // finding's state remained unchanged, or if the finding was added during the - // compare_duration period of time that precedes the read_time. This is the - // time between (read_time - compare_duration) and read_time. - // - // The state_change value is derived based on the presence and state of the - // finding at the two points in time. Intermediate state changes between the - // two times don't affect the result. For example, the results aren't affected - // if the finding is made inactive and then active again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "CHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration, but changed its - // state at read_time. - // * "UNCHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration and did not change - // state at read_time. - // * "ADDED": indicates that the finding did not match the given filter or - // was not present at the start of compare_duration, but was - // present at read_time. - // * "REMOVED": indicates that the finding was present and matched the - // filter at the start of compare_duration, but did not match - // the filter at read_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all findings present - // at read_time. - // - // If this field is set then `state_change` must be a specified field in - // `group_by`. - google.protobuf.Duration compare_duration = 5; - - // The value returned by the last `GroupFindingsResponse`; indicates - // that this is a continuation of a prior `GroupFindings` call, and - // that the system should return the next page of data. - string page_token = 7; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 8; -} - -// Response message for group by findings. -message GroupFindingsResponse { - // Group results. There exists an element for each existing unique - // combination of property/values. The element contains a count for the number - // of times those specific property/values appear. - repeated GroupResult group_by_results = 1; - - // Time used for executing the groupBy request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of results matching the query. - int32 total_size = 4; -} - -// Result containing the properties and count of a groupBy request. -message GroupResult { - // Properties matching the groupBy fields in the request. - map properties = 1; - - // Total count of resources for the given properties. - int64 count = 2; -} - -// Request message for listing notification configs. -message ListNotificationConfigsRequest { - // Required. Name of the organization to list notification configs. - // Its format is "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // The value returned by the last `ListNotificationConfigsResponse`; indicates - // that this is a continuation of a prior `ListNotificationConfigs` call, and - // that the system should return the next page of data. - string page_token = 2; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 3; -} - -// Response message for listing notification configs. -message ListNotificationConfigsResponse { - // Notification configs belonging to the requested parent. - repeated NotificationConfig notification_configs = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 2; -} - -// Request message for listing sources. -message ListSourcesRequest { - // Required. Resource name of the parent of sources to list. Its format should be - // "organizations/[organization_id], folders/[folder_id], or - // projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/Source" - } - ]; - - // The value returned by the last `ListSourcesResponse`; indicates - // that this is a continuation of a prior `ListSources` call, and - // that the system should return the next page of data. - string page_token = 2; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 7; -} - -// Response message for listing sources. -message ListSourcesResponse { - // Sources belonging to the requested parent. - repeated Source sources = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 2; -} - -// Request message for listing assets. -message ListAssetsRequest { - // Required. Name of the organization assets should belong to. Its format is - // "organizations/[organization_id], folders/[folder_id], or - // projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/Asset" - } - ]; - - // Expression that defines the filter to apply across assets. - // The expression is a list of zero or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. The fields map to those - // defined in the Asset resource. Examples include: - // - // * name - // * security_center_properties.resource_name - // * resource_properties.a_property - // * security_marks.marks.marka - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - // - // The following are the allowed field and operator combinations: - // - // * name: `=` - // * update_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `update_time = "2019-06-10T16:07:18-07:00"` - // `update_time = 1560208038000` - // - // * create_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `create_time = "2019-06-10T16:07:18-07:00"` - // `create_time = 1560208038000` - // - // * iam_policy.policy_blob: `=`, `:` - // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // * security_marks.marks: `=`, `:` - // * security_center_properties.resource_name: `=`, `:` - // * security_center_properties.resource_display_name: `=`, `:` - // * security_center_properties.resource_type: `=`, `:` - // * security_center_properties.resource_parent: `=`, `:` - // * security_center_properties.resource_parent_display_name: `=`, `:` - // * security_center_properties.resource_project: `=`, `:` - // * security_center_properties.resource_project_display_name: `=`, `:` - // * security_center_properties.resource_owners: `=`, `:` - // - // For example, `resource_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `resource_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-resource_properties.my_property : ""` - string filter = 2; - - // Expression that defines what fields and order to use for sorting. The - // string value should follow SQL syntax: comma separated list of fields. For - // example: "name,resource_properties.a_property". The default sorting order - // is ascending. To specify descending order for a field, a suffix " desc" - // should be appended to the field name. For example: "name - // desc,resource_properties.a_property". Redundant space characters in the - // syntax are insignificant. "name desc,resource_properties.a_property" and " - // name desc , resource_properties.a_property " are equivalent. - // - // The following fields are supported: - // name - // update_time - // resource_properties - // security_marks.marks - // security_center_properties.resource_name - // security_center_properties.resource_display_name - // security_center_properties.resource_parent - // security_center_properties.resource_parent_display_name - // security_center_properties.resource_project - // security_center_properties.resource_project_display_name - // security_center_properties.resource_type - string order_by = 3; - - // Time used as a reference point when filtering assets. The filter is limited - // to assets existing at the supplied time and their values are those at that - // specific time. Absence of this field will default to the API's version of - // NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the ListAssetsResult's "state_change" - // attribute is updated to indicate whether the asset was added, removed, or - // remained present during the compare_duration period of time that precedes - // the read_time. This is the time between (read_time - compare_duration) and - // read_time. - // - // The state_change value is derived based on the presence of the asset at the - // two points in time. Intermediate state changes between the two times don't - // affect the result. For example, the results aren't affected if the asset is - // removed and re-created again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "ADDED": indicates that the asset was not present at the start of - // compare_duration, but present at read_time. - // * "REMOVED": indicates that the asset was present at the start of - // compare_duration, but not present at read_time. - // * "ACTIVE": indicates that the asset was present at both the - // start and the end of the time period defined by - // compare_duration and read_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all assets present at - // read_time. - google.protobuf.Duration compare_duration = 5; - - // A field mask to specify the ListAssetsResult fields to be listed in the - // response. - // An empty field mask will list all fields. - google.protobuf.FieldMask field_mask = 7; - - // The value returned by the last `ListAssetsResponse`; indicates - // that this is a continuation of a prior `ListAssets` call, and - // that the system should return the next page of data. - string page_token = 8; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 9; -} - -// Response message for listing assets. -message ListAssetsResponse { - // Result containing the Asset and its State. - message ListAssetsResult { - // The change in state of the asset. - // - // When querying across two points in time this describes - // the change between the two points: ADDED, REMOVED, or ACTIVE. - // If there was no compare_duration supplied in the request the state change - // will be: UNUSED - enum StateChange { - // State change is unused, this is the canonical default for this enum. - UNUSED = 0; - - // Asset was added between the points in time. - ADDED = 1; - - // Asset was removed between the points in time. - REMOVED = 2; - - // Asset was present at both point(s) in time. - ACTIVE = 3; - } - - // Asset matching the search request. - Asset asset = 1; - - // State change of the asset between the points in time. - StateChange state_change = 2; - } - - // Assets matching the list request. - repeated ListAssetsResult list_assets_results = 1; - - // Time used for executing the list request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of assets matching the query. - int32 total_size = 4; -} - -// Request message for listing findings. -message ListFindingsRequest { - // Required. Name of the source the findings belong to. Its format is - // "organizations/[organization_id]/sources/[source_id], - // folders/[folder_id]/sources/[source_id], or - // projects/[project_id]/sources/[source_id]". To list across all sources - // provide a source_id of `-`. For example: - // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - // projects/{projects_id}/sources/- - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Expression that defines the filter to apply across findings. - // The expression is a list of one or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. Examples include: - // - // * name - // * source_properties.a_property - // * security_marks.marks.marka - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - // - // The following field and operator combinations are supported: - // - // * name: `=` - // * parent: `=`, `:` - // * resource_name: `=`, `:` - // * state: `=`, `:` - // * category: `=`, `:` - // * external_uri: `=`, `:` - // * event_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `event_time = "2019-06-10T16:07:18-07:00"` - // `event_time = 1560208038000` - // - // * severity: `=`, `:` - // * workflow_state: `=`, `:` - // * security_marks.marks: `=`, `:` - // * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // - // For example, `source_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `source_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-source_properties.my_property : ""` - // - // * resource: - // * resource.name: `=`, `:` - // * resource.parent_name: `=`, `:` - // * resource.parent_display_name: `=`, `:` - // * resource.project_name: `=`, `:` - // * resource.project_display_name: `=`, `:` - // * resource.type: `=`, `:` - // * resource.folders.resource_folder: `=`, `:` - // * resource.display_name: `=`, `:` - string filter = 2; - - // Expression that defines what fields and order to use for sorting. The - // string value should follow SQL syntax: comma separated list of fields. For - // example: "name,resource_properties.a_property". The default sorting order - // is ascending. To specify descending order for a field, a suffix " desc" - // should be appended to the field name. For example: "name - // desc,source_properties.a_property". Redundant space characters in the - // syntax are insignificant. "name desc,source_properties.a_property" and " - // name desc , source_properties.a_property " are equivalent. - // - // The following fields are supported: - // name - // parent - // state - // category - // resource_name - // event_time - // source_properties - // security_marks.marks - string order_by = 3; - - // Time used as a reference point when filtering findings. The filter is - // limited to findings existing at the supplied time and their values are - // those at that specific time. Absence of this field will default to the - // API's version of NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the ListFindingsResult's "state_change" - // attribute is updated to indicate whether the finding had its state changed, - // the finding's state remained unchanged, or if the finding was added in any - // state during the compare_duration period of time that precedes the - // read_time. This is the time between (read_time - compare_duration) and - // read_time. - // - // The state_change value is derived based on the presence and state of the - // finding at the two points in time. Intermediate state changes between the - // two times don't affect the result. For example, the results aren't affected - // if the finding is made inactive and then active again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "CHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration, but changed its - // state at read_time. - // * "UNCHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration and did not change - // state at read_time. - // * "ADDED": indicates that the finding did not match the given filter or - // was not present at the start of compare_duration, but was - // present at read_time. - // * "REMOVED": indicates that the finding was present and matched the - // filter at the start of compare_duration, but did not match - // the filter at read_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all findings present at - // read_time. - google.protobuf.Duration compare_duration = 5; - - // A field mask to specify the Finding fields to be listed in the response. - // An empty field mask will list all fields. - google.protobuf.FieldMask field_mask = 7; - - // The value returned by the last `ListFindingsResponse`; indicates - // that this is a continuation of a prior `ListFindings` call, and - // that the system should return the next page of data. - string page_token = 8; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 9; -} - -// Response message for listing findings. -message ListFindingsResponse { - // Result containing the Finding and its StateChange. - message ListFindingsResult { - // Information related to the Google Cloud resource that is - // associated with this finding. - message Resource { - // The full resource name of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string name = 1; - - // The full resource name of project that the resource belongs to. - string project_name = 2; - - // The human readable name of project that the resource belongs to. - string project_display_name = 3; - - // The full resource name of resource's parent. - string parent_name = 4; - - // The human readable name of resource's parent. - string parent_display_name = 5; - - // The full resource type of the resource. - string type = 6; - - // Contains a Folder message for each folder in the assets ancestry. - // The first folder is the deepest nested folder, and the last folder is - // the folder directly under the Organization. - repeated Folder folders = 7; - - // The human readable name of the resource. - string display_name = 8; - } - - // The change in state of the finding. - // - // When querying across two points in time this describes - // the change in the finding between the two points: CHANGED, UNCHANGED, - // ADDED, or REMOVED. Findings can not be deleted, so REMOVED implies that - // the finding at timestamp does not match the filter specified, but it did - // at timestamp - compare_duration. If there was no compare_duration - // supplied in the request the state change will be: UNUSED - enum StateChange { - // State change is unused, this is the canonical default for this enum. - UNUSED = 0; - - // The finding has changed state in some way between the points in time - // and existed at both points. - CHANGED = 1; - - // The finding has not changed state between the points in time and - // existed at both points. - UNCHANGED = 2; - - // The finding was created between the points in time. - ADDED = 3; - - // The finding at timestamp does not match the filter specified, but it - // did at timestamp - compare_duration. - REMOVED = 4; - } - - // Finding matching the search request. - Finding finding = 1; - - // State change of the finding between the points in time. - StateChange state_change = 2; - - // Output only. Resource that is associated with this finding. - Resource resource = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Findings matching the list request. - repeated ListFindingsResult list_findings_results = 1; - - // Time used for executing the list request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of findings matching the query. - int32 total_size = 4; -} - -// Request message for updating a finding's state. -message SetFindingStateRequest { - // Required. The relative resource name of the finding. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Finding" - } - ]; - - // Required. The desired State of the finding. - Finding.State state = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The time at which the updated state takes effect. - google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for running asset discovery for an organization. -message RunAssetDiscoveryRequest { - // Required. Name of the organization to run asset discovery for. Its format is - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; -} - -// Request message for updating or creating a finding. -message UpdateFindingRequest { - // Required. The finding resource to update or create if it does not already exist. - // parent, security_marks, and update_time will be ignored. - // - // In the case of creation, the finding id portion of the name must be - // alphanumeric and less than or equal to 32 characters and greater than 0 - // characters in length. - Finding finding = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the finding resource. This field should - // not be specified when creating a finding. - // - // When updating a finding, an empty mask is treated as updating all mutable - // fields and replacing source_properties. Individual source_properties can - // be added/updated by using "source_properties." in the field - // mask. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a notification config. -message UpdateNotificationConfigRequest { - // Required. The notification config to update. - NotificationConfig notification_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the notification config. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating an organization's settings. -message UpdateOrganizationSettingsRequest { - // Required. The organization settings resource to update. - OrganizationSettings organization_settings = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the settings resource. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a source. -message UpdateSourceRequest { - // Required. The source resource to update. - Source source = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the source resource. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a SecurityMarks resource. -message UpdateSecurityMarksRequest { - // Required. The security marks resource to update. - SecurityMarks security_marks = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the security marks resource. - // - // The field mask must not contain duplicate fields. - // If empty or set to "marks", all marks will be replaced. Individual - // marks can be updated using "marks.". - google.protobuf.FieldMask update_mask = 2; - - // The time at which the updated SecurityMarks take effect. - // If not set uses current server time. Updates will be applied to the - // SecurityMarks that are active immediately preceding this time. - google.protobuf.Timestamp start_time = 3; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/source.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/source.proto deleted file mode 100644 index 0df844dd..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/source.proto +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/resource.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Security Command Center finding source. A finding source -// is an entity or a mechanism that can produce a finding. A source is like a -// container of findings that come from the same scanner, logger, monitor, and -// other tools. -message Source { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Source" - pattern: "organizations/{organization}/sources/{source}" - pattern: "folders/{folder}/sources/{source}" - pattern: "projects/{project}/sources/{source}" - }; - - // The relative resource name of this source. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}" - string name = 1; - - // The source's display name. - // A source's display name must be unique amongst its siblings, for example, - // two sources with the same parent can't share the same display name. - // The display name must have a length between 1 and 64 characters - // (inclusive). - string display_name = 2; - - // The description of the source (max of 1024 characters). - // Example: - // "Web Security Scanner is a web security scanner for common - // vulnerabilities in App Engine applications. It can automatically - // scan and detect four common vulnerabilities, including cross-site-scripting - // (XSS), Flash injection, mixed content (HTTP in HTTPS), and - // outdated or insecure libraries." - string description = 3; - - // The canonical name of the finding. It's either - // "organizations/{organization_id}/sources/{source_id}", - // "folders/{folder_id}/sources/{source_id}" or - // "projects/{project_number}/sources/{source_id}", - // depending on the closest CRM ancestor of the resource associated with the - // finding. - string canonical_name = 14; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto deleted file mode 100644 index 4649adf9..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; -option java_multiple_files = true; -option java_outer_classname = "VulnerabilityProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Refers to common vulnerability fields e.g. cve, cvss, cwe etc. -message Vulnerability { - // CVE stands for Common Vulnerabilities and Exposures - // (https://cve.mitre.org/about/) - Cve cve = 1; -} - -// CVE stands for Common Vulnerabilities and Exposures. -// More information: https://cve.mitre.org -message Cve { - // The unique identifier for the vulnerability. e.g. CVE-2021-34527 - string id = 1; - - // Additional information about the CVE. - // e.g. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34527 - repeated Reference references = 2; - - // Describe Common Vulnerability Scoring System specified at - // https://www.first.org/cvss/v3.1/specification-document - Cvssv3 cvssv3 = 3; -} - -// Additional Links -message Reference { - // Source of the reference e.g. NVD - string source = 1; - - // Uri for the mentioned source e.g. - // https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34527. - string uri = 2; -} - -// Common Vulnerability Scoring System version 3. -message Cvssv3 { - // This metric reflects the context by which vulnerability exploitation is - // possible. - enum AttackVector { - // Invalid value. - ATTACK_VECTOR_UNSPECIFIED = 0; - - // The vulnerable component is bound to the network stack and the set of - // possible attackers extends beyond the other options listed below, up to - // and including the entire Internet. - ATTACK_VECTOR_NETWORK = 1; - - // The vulnerable component is bound to the network stack, but the attack is - // limited at the protocol level to a logically adjacent topology. - ATTACK_VECTOR_ADJACENT = 2; - - // The vulnerable component is not bound to the network stack and the - // attacker's path is via read/write/execute capabilities. - ATTACK_VECTOR_LOCAL = 3; - - // The attack requires the attacker to physically touch or manipulate the - // vulnerable component. - ATTACK_VECTOR_PHYSICAL = 4; - } - - // This metric describes the conditions beyond the attacker's control that - // must exist in order to exploit the vulnerability. - enum AttackComplexity { - // Invalid value. - ATTACK_COMPLEXITY_UNSPECIFIED = 0; - - // Specialized access conditions or extenuating circumstances do not exist. - // An attacker can expect repeatable success when attacking the vulnerable - // component. - ATTACK_COMPLEXITY_LOW = 1; - - // A successful attack depends on conditions beyond the attacker's control. - // That is, a successful attack cannot be accomplished at will, but requires - // the attacker to invest in some measurable amount of effort in preparation - // or execution against the vulnerable component before a successful attack - // can be expected. - ATTACK_COMPLEXITY_HIGH = 2; - } - - // This metric describes the level of privileges an attacker must possess - // before successfully exploiting the vulnerability. - enum PrivilegesRequired { - // Invalid value. - PRIVILEGES_REQUIRED_UNSPECIFIED = 0; - - // The attacker is unauthorized prior to attack, and therefore does not - // require any access to settings or files of the vulnerable system to - // carry out an attack. - PRIVILEGES_REQUIRED_NONE = 1; - - // The attacker requires privileges that provide basic user capabilities - // that could normally affect only settings and files owned by a user. - // Alternatively, an attacker with Low privileges has the ability to access - // only non-sensitive resources. - PRIVILEGES_REQUIRED_LOW = 2; - - // The attacker requires privileges that provide significant (e.g., - // administrative) control over the vulnerable component allowing access to - // component-wide settings and files. - PRIVILEGES_REQUIRED_HIGH = 3; - } - - // This metric captures the requirement for a human user, other than the - // attacker, to participate in the successful compromise of the vulnerable - // component. - enum UserInteraction { - // Invalid value. - USER_INTERACTION_UNSPECIFIED = 0; - - // The vulnerable system can be exploited without interaction from any user. - USER_INTERACTION_NONE = 1; - - // Successful exploitation of this vulnerability requires a user to take - // some action before the vulnerability can be exploited. - USER_INTERACTION_REQUIRED = 2; - } - - // The Scope metric captures whether a vulnerability in one vulnerable - // component impacts resources in components beyond its security scope. - enum Scope { - // Invalid value. - SCOPE_UNSPECIFIED = 0; - - // An exploited vulnerability can only affect resources managed by the same - // security authority. - SCOPE_UNCHANGED = 1; - - // An exploited vulnerability can affect resources beyond the security scope - // managed by the security authority of the vulnerable component. - SCOPE_CHANGED = 2; - } - - // The Impact metrics capture the effects of a successfully exploited - // vulnerability on the component that suffers the worst outcome that is most - // directly and predictably associated with the attack. - enum Impact { - // Invalid value. - IMPACT_UNSPECIFIED = 0; - - // High impact. - IMPACT_HIGH = 1; - - // Low impact. - IMPACT_LOW = 2; - - // No impact. - IMPACT_NONE = 3; - } - - // The base score is a function of the base metric scores. - double base_score = 1; - - // Base Metrics - // Represents the intrinsic characteristics of a vulnerability that are - // constant over time and across user environments. - // This metric reflects the context by which vulnerability exploitation is - // possible. - AttackVector attack_vector = 5; - - // This metric describes the conditions beyond the attacker's control that - // must exist in order to exploit the vulnerability. - AttackComplexity attack_complexity = 6; - - // This metric describes the level of privileges an attacker must possess - // before successfully exploiting the vulnerability. - PrivilegesRequired privileges_required = 7; - - // This metric captures the requirement for a human user, other than the - // attacker, to participate in the successful compromise of the vulnerable - // component. - UserInteraction user_interaction = 8; - - // The Scope metric captures whether a vulnerability in one vulnerable - // component impacts resources in components beyond its security scope. - Scope scope = 9; - - // This metric measures the impact to the confidentiality of the information - // resources managed by a software component due to a successfully exploited - // vulnerability. - Impact confidentiality_impact = 10; - - // This metric measures the impact to integrity of a successfully exploited - // vulnerability. - Impact integrity_impact = 11; - - // This metric measures the impact to the availability of the impacted - // component resulting from a successfully exploited vulnerability. - Impact availability_impact = 12; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/security_center.create_finding.js b/owl-bot-staging/v1/samples/generated/v1/security_center.create_finding.js deleted file mode 100644 index 746920f6..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.create_finding.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, findingId, finding) { - // [START securitycenter_v1_generated_SecurityCenter_CreateFinding_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new finding's parent. Its format should be - * "organizations/[organization_id]/sources/[source_id]". - */ - // const parent = 'abc123' - /** - * Required. Unique identifier provided by the client within the parent scope. - * It must be alphanumeric and less than or equal to 32 characters and - * greater than 0 characters in length. - */ - // const findingId = 'abc123' - /** - * Required. The Finding being created. The name and security_marks will be ignored as - * they are both output only fields on this resource. - */ - // const finding = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateFinding() { - // Construct request - const request = { - parent, - findingId, - finding, - }; - - // Run request - const response = await securitycenterClient.createFinding(request); - console.log(response); - } - - callCreateFinding(); - // [END securitycenter_v1_generated_SecurityCenter_CreateFinding_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/security_center.create_notification_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.create_notification_config.js deleted file mode 100644 index 6394278d..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.create_notification_config.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, configId, notificationConfig) { - // [START securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new notification config's parent. Its format is - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * Required. - * Unique identifier provided by the client within the parent scope. - * It must be between 1 and 128 characters, and contains alphanumeric - * characters, underscores or hyphens only. - */ - // const configId = 'abc123' - /** - * Required. The notification config being created. The name and the service account - * will be ignored as they are both output only fields on this resource. - */ - // const notificationConfig = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateNotificationConfig() { - // Construct request - const request = { - parent, - configId, - notificationConfig, - }; - - // Run request - const response = await securitycenterClient.createNotificationConfig(request); - console.log(response); - } - - callCreateNotificationConfig(); - // [END securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_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/security_center.create_source.js b/owl-bot-staging/v1/samples/generated/v1/security_center.create_source.js deleted file mode 100644 index a0465fd2..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.create_source.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, source) { - // [START securitycenter_v1_generated_SecurityCenter_CreateSource_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new source's parent. Its format should be - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * Required. The Source being created, only the display_name and description will be - * used. All other fields will be ignored. - */ - // const source = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateSource() { - // Construct request - const request = { - parent, - source, - }; - - // Run request - const response = await securitycenterClient.createSource(request); - console.log(response); - } - - callCreateSource(); - // [END securitycenter_v1_generated_SecurityCenter_CreateSource_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/security_center.delete_notification_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.delete_notification_config.js deleted file mode 100644 index 12b4f019..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.delete_notification_config.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the notification config to delete. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callDeleteNotificationConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.deleteNotificationConfig(request); - console.log(response); - } - - callDeleteNotificationConfig(); - // [END securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_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/security_center.get_iam_policy.js b/owl-bot-staging/v1/samples/generated/v1/security_center.get_iam_policy.js deleted file mode 100644 index e8452cca..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.get_iam_policy.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(resource) { - // [START securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - */ - // const options = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await securitycenterClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END securitycenter_v1_generated_SecurityCenter_GetIamPolicy_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/security_center.get_notification_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.get_notification_config.js deleted file mode 100644 index d0eb23ca..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.get_notification_config.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the notification config to get. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetNotificationConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getNotificationConfig(request); - console.log(response); - } - - callGetNotificationConfig(); - // [END securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_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/security_center.get_organization_settings.js b/owl-bot-staging/v1/samples/generated/v1/security_center.get_organization_settings.js deleted file mode 100644 index f408324f..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.get_organization_settings.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to get organization settings for. Its format is - * "organizations/[organization_id]/organizationSettings". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetOrganizationSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getOrganizationSettings(request); - console.log(response); - } - - callGetOrganizationSettings(); - // [END securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_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/security_center.get_source.js b/owl-bot-staging/v1/samples/generated/v1/security_center.get_source.js deleted file mode 100644 index fa5796e6..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.get_source.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_GetSource_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Relative resource name of the source. Its format is - * "organizations/[organization_id]/source/[source_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetSource() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getSource(request); - console.log(response); - } - - callGetSource(); - // [END securitycenter_v1_generated_SecurityCenter_GetSource_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/security_center.group_assets.js b/owl-bot-staging/v1/samples/generated/v1/security_center.group_assets.js deleted file mode 100644 index 2b70cea8..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.group_assets.js +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, groupBy) { - // [START securitycenter_v1_generated_SecurityCenter_GroupAssets_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * The supported operators are: - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * The supported value types are: - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * The following field and operator combinations are supported: - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * For example, `resource_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - */ - // const filter = 'abc123' - /** - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * The following fields are supported when compare_duration is not set: - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * The following fields are supported when compare_duration is set: - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - */ - // const groupBy = 'abc123' - /** - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * Possible "state_change" values when compare_duration is specified: - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * If this field is set then `state_change` must be a specified field in - * `group_by`. - */ - // const compareDuration = {} - /** - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - */ - // const readTime = {} - /** - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGroupAssets() { - // Construct request - const request = { - parent, - groupBy, - }; - - // Run request - const iterable = await securitycenterClient.groupAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGroupAssets(); - // [END securitycenter_v1_generated_SecurityCenter_GroupAssets_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/security_center.group_findings.js b/owl-bot-staging/v1/samples/generated/v1/security_center.group_findings.js deleted file mode 100644 index faf3c30b..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.group_findings.js +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, groupBy) { - // [START securitycenter_v1_generated_SecurityCenter_GroupFindings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * The supported operators are: - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * The supported value types are: - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * The following field and operator combinations are supported: - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * For example, `source_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - */ - // const filter = 'abc123' - /** - * Required. Expression that defines what assets fields to use for grouping (including - * `state_change`). The string value should follow SQL syntax: comma separated - * list of fields. For example: "parent,resource_name". - * The following fields are supported: - * * resource_name - * * category - * * state - * * parent - * * severity - * The following fields are supported when compare_duration is set: - * * state_change - */ - // const groupBy = 'abc123' - /** - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * Possible "state_change" values when compare_duration is specified: - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * If this field is set then `state_change` must be a specified field in - * `group_by`. - */ - // const compareDuration = {} - /** - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGroupFindings() { - // Construct request - const request = { - parent, - groupBy, - }; - - // Run request - const iterable = await securitycenterClient.groupFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGroupFindings(); - // [END securitycenter_v1_generated_SecurityCenter_GroupFindings_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/security_center.list_assets.js b/owl-bot-staging/v1/samples/generated/v1/security_center.list_assets.js deleted file mode 100644 index 9ebf2a98..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.list_assets.js +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListAssets_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * The supported operators are: - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * The supported value types are: - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * The following are the allowed field and operator combinations: - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * For example, `resource_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - */ - // const filter = 'abc123' - /** - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - */ - // const orderBy = 'abc123' - /** - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * Possible "state_change" values when compare_duration is specified: - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - */ - // const compareDuration = {} - /** - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - */ - // const fieldMask = {} - /** - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListAssets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAssets(); - // [END securitycenter_v1_generated_SecurityCenter_ListAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/security_center.list_findings.js b/owl-bot-staging/v1/samples/generated/v1/security_center.list_findings.js deleted file mode 100644 index bf2a9563..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.list_findings.js +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListFindings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * The supported operators are: - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * The supported value types are: - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * The following field and operator combinations are supported: - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * For example, `source_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * * resource.folders.resource_folder: `=`, `:` - * * resource.display_name: `=`, `:` - */ - // const filter = 'abc123' - /** - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - */ - // const orderBy = 'abc123' - /** - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * Possible "state_change" values when compare_duration is specified: - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - */ - // const compareDuration = {} - /** - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - */ - // const fieldMask = {} - /** - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListFindings() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFindings(); - // [END securitycenter_v1_generated_SecurityCenter_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/security_center.list_notification_configs.js b/owl-bot-staging/v1/samples/generated/v1/security_center.list_notification_configs.js deleted file mode 100644 index 11aeada8..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.list_notification_configs.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to list notification configs. - * Its format is "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListNotificationConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listNotificationConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNotificationConfigs(); - // [END securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_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/security_center.list_sources.js b/owl-bot-staging/v1/samples/generated/v1/security_center.list_sources.js deleted file mode 100644 index 7fc4f557..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.list_sources.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListSources_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - */ - // const parent = 'abc123' - /** - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListSources() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listSourcesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSources(); - // [END securitycenter_v1_generated_SecurityCenter_ListSources_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/security_center.run_asset_discovery.js b/owl-bot-staging/v1/samples/generated/v1/security_center.run_asset_discovery.js deleted file mode 100644 index 4c1728e4..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.run_asset_discovery.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to run asset discovery for. Its format is - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callRunAssetDiscovery() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await securitycenterClient.runAssetDiscovery(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRunAssetDiscovery(); - // [END securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_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/security_center.set_finding_state.js b/owl-bot-staging/v1/samples/generated/v1/security_center.set_finding_state.js deleted file mode 100644 index 676cf8a5..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.set_finding_state.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name, state, startTime) { - // [START securitycenter_v1_generated_SecurityCenter_SetFindingState_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the finding. See: - * https://cloud.google.com/apis/design/resource_names#relative_resource_name - * Example: - * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - */ - // const name = 'abc123' - /** - * Required. The desired State of the finding. - */ - // const state = {} - /** - * Required. The time at which the updated state takes effect. - */ - // const startTime = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetFindingState() { - // Construct request - const request = { - name, - state, - startTime, - }; - - // Run request - const response = await securitycenterClient.setFindingState(request); - console.log(response); - } - - callSetFindingState(); - // [END securitycenter_v1_generated_SecurityCenter_SetFindingState_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/security_center.set_iam_policy.js b/owl-bot-staging/v1/samples/generated/v1/security_center.set_iam_policy.js deleted file mode 100644 index 91cd2d88..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.set_iam_policy.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(resource, policy) { - // [START securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - */ - // const policy = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await securitycenterClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END securitycenter_v1_generated_SecurityCenter_SetIamPolicy_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/security_center.test_iam_permissions.js b/owl-bot-staging/v1/samples/generated/v1/security_center.test_iam_permissions.js deleted file mode 100644 index b5017155..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.test_iam_permissions.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(resource, permissions) { - // [START securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). - */ - // const permissions = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await securitycenterClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END securitycenter_v1_generated_SecurityCenter_TestIamPermissions_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/security_center.update_finding.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_finding.js deleted file mode 100644 index 271872a4..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.update_finding.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(finding) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateFinding_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The finding resource to update or create if it does not already exist. - * parent, security_marks, and update_time will be ignored. - * In the case of creation, the finding id portion of the name must be - * alphanumeric and less than or equal to 32 characters and greater than 0 - * characters in length. - */ - // const finding = {} - /** - * The FieldMask to use when updating the finding resource. This field should - * not be specified when creating a finding. - * When updating a finding, an empty mask is treated as updating all mutable - * fields and replacing source_properties. Individual source_properties can - * be added/updated by using "source_properties." in the field - * mask. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateFinding() { - // Construct request - const request = { - finding, - }; - - // Run request - const response = await securitycenterClient.updateFinding(request); - console.log(response); - } - - callUpdateFinding(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateFinding_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/security_center.update_notification_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_notification_config.js deleted file mode 100644 index 74af35bc..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.update_notification_config.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(notificationConfig) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The notification config to update. - */ - // const notificationConfig = {} - /** - * The FieldMask to use when updating the notification config. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateNotificationConfig() { - // Construct request - const request = { - notificationConfig, - }; - - // Run request - const response = await securitycenterClient.updateNotificationConfig(request); - console.log(response); - } - - callUpdateNotificationConfig(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_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/security_center.update_organization_settings.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_organization_settings.js deleted file mode 100644 index ff5fc3c9..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.update_organization_settings.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(organizationSettings) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The organization settings resource to update. - */ - // const organizationSettings = {} - /** - * The FieldMask to use when updating the settings resource. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateOrganizationSettings() { - // Construct request - const request = { - organizationSettings, - }; - - // Run request - const response = await securitycenterClient.updateOrganizationSettings(request); - console.log(response); - } - - callUpdateOrganizationSettings(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_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/security_center.update_security_marks.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_security_marks.js deleted file mode 100644 index 14137cb7..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.update_security_marks.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(securityMarks) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The security marks resource to update. - */ - // const securityMarks = {} - /** - * The FieldMask to use when updating the security marks resource. - * The field mask must not contain duplicate fields. - * If empty or set to "marks", all marks will be replaced. Individual - * marks can be updated using "marks.". - */ - // const updateMask = {} - /** - * The time at which the updated SecurityMarks take effect. - * If not set uses current server time. Updates will be applied to the - * SecurityMarks that are active immediately preceding this time. - */ - // const startTime = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateSecurityMarks() { - // Construct request - const request = { - securityMarks, - }; - - // Run request - const response = await securitycenterClient.updateSecurityMarks(request); - console.log(response); - } - - callUpdateSecurityMarks(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_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/security_center.update_source.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_source.js deleted file mode 100644 index e99ad6fe..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.update_source.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(source) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateSource_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The source resource to update. - */ - // const source = {} - /** - * The FieldMask to use when updating the source resource. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateSource() { - // Construct request - const request = { - source, - }; - - // Run request - const response = await securitycenterClient.updateSource(request); - console.log(response); - } - - callUpdateSource(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateSource_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 78a13c59..00000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,25 +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. -// -// ** 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 SecurityCenterClient = v1.SecurityCenterClient; -type SecurityCenterClient = v1.SecurityCenterClient; -export {v1, SecurityCenterClient}; -export default {v1, SecurityCenterClient}; -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 3280f72a..00000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,277 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.securitycenter.v1", - "libraryPackage": "@google-cloud/security-center", - "services": { - "SecurityCenter": { - "clients": { - "grpc": { - "libraryClient": "SecurityCenterClient", - "rpcs": { - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "CreateFinding": { - "methods": [ - "createFinding" - ] - }, - "CreateNotificationConfig": { - "methods": [ - "createNotificationConfig" - ] - }, - "DeleteNotificationConfig": { - "methods": [ - "deleteNotificationConfig" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetNotificationConfig": { - "methods": [ - "getNotificationConfig" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateNotificationConfig": { - "methods": [ - "updateNotificationConfig" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListNotificationConfigs": { - "methods": [ - "listNotificationConfigs", - "listNotificationConfigsStream", - "listNotificationConfigsAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SecurityCenterClient", - "rpcs": { - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "CreateFinding": { - "methods": [ - "createFinding" - ] - }, - "CreateNotificationConfig": { - "methods": [ - "createNotificationConfig" - ] - }, - "DeleteNotificationConfig": { - "methods": [ - "deleteNotificationConfig" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetNotificationConfig": { - "methods": [ - "getNotificationConfig" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateNotificationConfig": { - "methods": [ - "updateNotificationConfig" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListNotificationConfigs": { - "methods": [ - "listNotificationConfigs", - "listNotificationConfigsStream", - "listNotificationConfigsAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - } - } - } - } - } - } -} 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 de26020d..00000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +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. -// -// ** 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 {SecurityCenterClient} from './security_center_client'; diff --git a/owl-bot-staging/v1/src/v1/security_center_client.ts b/owl-bot-staging/v1/src/v1/security_center_client.ts deleted file mode 100644 index 1b460d76..00000000 --- a/owl-bot-staging/v1/src/v1/security_center_client.ts +++ /dev/null @@ -1,4987 +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. -// -// ** 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, LROperation, 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/security_center_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './security_center_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * V1 APIs for Security Center service. - * @class - * @memberof v1 - */ -export class SecurityCenterClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - securityCenterStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SecurityCenterClient. - * - * @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). - * 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} [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. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SecurityCenterClient; - 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 = { - folderAssetPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/assets/{asset}' - ), - folderAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/assets/{asset}/securityMarks' - ), - folderSourcePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}' - ), - folderSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}/findings/{finding}' - ), - folderSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}/findings/{finding}/securityMarks' - ), - notificationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationConfigs/{notification_config}' - ), - organizationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}' - ), - organizationAssetPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/assets/{asset}' - ), - organizationAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/assets/{asset}/securityMarks' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/organizationSettings' - ), - organizationSourcePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}' - ), - organizationSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}' - ), - organizationSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' - ), - projectAssetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/assets/{asset}' - ), - projectAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/assets/{asset}/securityMarks' - ), - projectSourcePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}' - ), - projectSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}/findings/{finding}' - ), - projectSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}/findings/{finding}/securityMarks' - ), - }; - - // 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 = { - groupAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), - groupFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), - listAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listAssetsResults'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listFindingsResults'), - listNotificationConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notificationConfigs'), - listSources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const runAssetDiscoveryResponse = protoFilesRoot.lookup( - '.google.cloud.securitycenter.v1.RunAssetDiscoveryResponse') as gax.protobuf.Type; - const runAssetDiscoveryMetadata = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - - this.descriptors.longrunning = { - runAssetDiscovery: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), - runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.securitycenter.v1.SecurityCenter', 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.securityCenterStub) { - return this.securityCenterStub; - } - - // Put together the "service stub" for - // google.cloud.securitycenter.v1.SecurityCenter. - this.securityCenterStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.securitycenter.v1.SecurityCenter') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.securitycenter.v1.SecurityCenter, - 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 securityCenterStubMethods = - ['createSource', 'createFinding', 'createNotificationConfig', 'deleteNotificationConfig', 'getIamPolicy', 'getNotificationConfig', 'getOrganizationSettings', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listFindings', 'listNotificationConfigs', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setIamPolicy', 'testIamPermissions', 'updateFinding', 'updateNotificationConfig', 'updateOrganizationSettings', 'updateSource', 'updateSecurityMarks']; - for (const methodName of securityCenterStubMethods) { - const callPromise = this.securityCenterStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.securityCenterStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'securitycenter.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 'securitycenter.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 source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new source's parent. Its format should be - * "organizations/[organization_id]". - * @param {google.cloud.securitycenter.v1.Source} request.source - * Required. The Source being created, only the display_name and description will be - * used. All other fields will be ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Source]{@link google.cloud.securitycenter.v1.Source}. - * 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/security_center.create_source.js - * region_tag:securitycenter_v1_generated_SecurityCenter_CreateSource_async - */ - createSource( - request?: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.ICreateSourceRequest|undefined, {}|undefined - ]>; - createSource( - request: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): void; - createSource( - request: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): void; - createSource( - request?: protos.google.cloud.securitycenter.v1.ICreateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.ICreateSourceRequest|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.createSource(request, options, callback); - } -/** - * Creates a finding. The corresponding source must exist for finding creation - * to succeed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new finding's parent. Its format should be - * "organizations/[organization_id]/sources/[source_id]". - * @param {string} request.findingId - * Required. Unique identifier provided by the client within the parent scope. - * It must be alphanumeric and less than or equal to 32 characters and - * greater than 0 characters in length. - * @param {google.cloud.securitycenter.v1.Finding} request.finding - * Required. The Finding being created. The name and security_marks will be ignored as - * they are both output only fields on this resource. - * @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.securitycenter.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/security_center.create_finding.js - * region_tag:securitycenter_v1_generated_SecurityCenter_CreateFinding_async - */ - createFinding( - request?: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ICreateFindingRequest|undefined, {}|undefined - ]>; - createFinding( - request: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): void; - createFinding( - request: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): void; - createFinding( - request?: protos.google.cloud.securitycenter.v1.ICreateFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ICreateFindingRequest|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.createFinding(request, options, callback); - } -/** - * Creates a notification config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new notification config's parent. Its format is - * "organizations/[organization_id]". - * @param {string} request.configId - * Required. - * Unique identifier provided by the client within the parent scope. - * It must be between 1 and 128 characters, and contains alphanumeric - * characters, underscores or hyphens only. - * @param {google.cloud.securitycenter.v1.NotificationConfig} request.notificationConfig - * Required. The notification config being created. The name and the service account - * will be ignored as they are both output only fields on this resource. - * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1.NotificationConfig}. - * 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/security_center.create_notification_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async - */ - createNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|undefined, {}|undefined - ]>; - createNotificationConfig( - request: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - createNotificationConfig( - request: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - createNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.ICreateNotificationConfigRequest|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.createNotificationConfig(request, options, callback); - } -/** - * Deletes a notification config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the notification config to delete. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/security_center.delete_notification_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async - */ - deleteNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|undefined, {}|undefined - ]>; - deleteNotificationConfig( - request: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteNotificationConfig( - request: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteNotificationConfigRequest|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.deleteNotificationConfig(request, options, callback); - } -/** - * Gets the access control policy on the specified Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * @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 [Policy]{@link google.iam.v1.Policy}. - * 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/security_center.get_iam_policy.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|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({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.getIamPolicy(request, options, callback); - } -/** - * Gets a notification config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the notification config to get. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [NotificationConfig]{@link google.cloud.securitycenter.v1.NotificationConfig}. - * 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/security_center.get_notification_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async - */ - getNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|undefined, {}|undefined - ]>; - getNotificationConfig( - request: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - getNotificationConfig( - request: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - getNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IGetNotificationConfigRequest|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.getNotificationConfig(request, options, callback); - } -/** - * Gets the settings for an organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the organization to get organization settings for. Its format is - * "organizations/[organization_id]/organizationSettings". - * @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 [OrganizationSettings]{@link google.cloud.securitycenter.v1.OrganizationSettings}. - * 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/security_center.get_organization_settings.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async - */ - getOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|undefined, {}|undefined - ]>; - getOrganizationSettings( - request: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - getOrganizationSettings( - request: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - getOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IGetOrganizationSettingsRequest|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.getOrganizationSettings(request, options, callback); - } -/** - * Gets a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Relative resource name of the source. Its format is - * "organizations/[organization_id]/source/[source_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Source]{@link google.cloud.securitycenter.v1.Source}. - * 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/security_center.get_source.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetSource_async - */ - getSource( - request?: protos.google.cloud.securitycenter.v1.IGetSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IGetSourceRequest|undefined, {}|undefined - ]>; - getSource( - request: protos.google.cloud.securitycenter.v1.IGetSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request: protos.google.cloud.securitycenter.v1.IGetSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request?: protos.google.cloud.securitycenter.v1.IGetSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IGetSourceRequest|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.getSource(request, options, callback); - } -/** - * Updates the state of a finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the finding. See: - * https://cloud.google.com/apis/design/resource_names#relative_resource_name - * Example: - * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - * @param {google.cloud.securitycenter.v1.Finding.State} request.state - * Required. The desired State of the finding. - * @param {google.protobuf.Timestamp} request.startTime - * Required. The time at which the updated state takes effect. - * @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.securitycenter.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/security_center.set_finding_state.js - * region_tag:securitycenter_v1_generated_SecurityCenter_SetFindingState_async - */ - setFindingState( - request?: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|undefined, {}|undefined - ]>; - setFindingState( - request: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): void; - setFindingState( - request: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): void; - setFindingState( - request?: protos.google.cloud.securitycenter.v1.ISetFindingStateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetFindingStateRequest|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.setFindingState(request, options, callback); - } -/** - * Sets the access control policy on the specified Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @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 [Policy]{@link google.iam.v1.Policy}. - * 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/security_center.set_iam_policy.js - * region_tag:securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async - */ - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|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({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.setIamPolicy(request, options, callback); - } -/** - * Returns the permissions that a caller has on the specified source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * 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/security_center.test_iam_permissions.js - * region_tag:securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async - */ - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|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({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.testIamPermissions(request, options, callback); - } -/** - * Creates or updates a finding. The corresponding source must exist for a - * finding creation to succeed. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.Finding} request.finding - * Required. The finding resource to update or create if it does not already exist. - * parent, security_marks, and update_time will be ignored. - * - * In the case of creation, the finding id portion of the name must be - * alphanumeric and less than or equal to 32 characters and greater than 0 - * characters in length. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the finding resource. This field should - * not be specified when creating a finding. - * - * When updating a finding, an empty mask is treated as updating all mutable - * fields and replacing source_properties. Individual source_properties can - * be added/updated by using "source_properties." in the field - * mask. - * @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.securitycenter.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/security_center.update_finding.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateFinding_async - */ - updateFinding( - request?: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|undefined, {}|undefined - ]>; - updateFinding( - request: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): void; - updateFinding( - request: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): void; - updateFinding( - request?: protos.google.cloud.securitycenter.v1.IUpdateFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.IUpdateFindingRequest|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({ - 'finding.name': request.finding!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateFinding(request, options, callback); - } -/** - * - * Updates a notification config. The following update - * fields are allowed: description, pubsub_topic, streaming_config.filter - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.NotificationConfig} request.notificationConfig - * Required. The notification config to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the notification config. - * - * If empty all mutable fields will be updated. - * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1.NotificationConfig}. - * 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/security_center.update_notification_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async - */ - updateNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|undefined, {}|undefined - ]>; - updateNotificationConfig( - request: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - updateNotificationConfig( - request: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - updateNotificationConfig( - request?: protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig, - protos.google.cloud.securitycenter.v1.IUpdateNotificationConfigRequest|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({ - 'notification_config.name': request.notificationConfig!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateNotificationConfig(request, options, callback); - } -/** - * Updates an organization's settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.OrganizationSettings} request.organizationSettings - * Required. The organization settings resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the settings resource. - * - * If empty all mutable fields will be updated. - * @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 [OrganizationSettings]{@link google.cloud.securitycenter.v1.OrganizationSettings}. - * 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/security_center.update_organization_settings.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async - */ - updateOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined - ]>; - updateOrganizationSettings( - request: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateOrganizationSettings( - request: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1.IUpdateOrganizationSettingsRequest|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({ - 'organization_settings.name': request.organizationSettings!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateOrganizationSettings(request, options, callback); - } -/** - * Updates a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.Source} request.source - * Required. The source resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the source resource. - * - * If empty all mutable fields will be updated. - * @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 [Source]{@link google.cloud.securitycenter.v1.Source}. - * 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/security_center.update_source.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateSource_async - */ - updateSource( - request?: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|undefined, {}|undefined - ]>; - updateSource( - request: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): void; - updateSource( - request: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): void; - updateSource( - request?: protos.google.cloud.securitycenter.v1.IUpdateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource, - protos.google.cloud.securitycenter.v1.IUpdateSourceRequest|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({ - 'source.name': request.source!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateSource(request, options, callback); - } -/** - * Updates security marks. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.SecurityMarks} request.securityMarks - * Required. The security marks resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the security marks resource. - * - * The field mask must not contain duplicate fields. - * If empty or set to "marks", all marks will be replaced. Individual - * marks can be updated using "marks.". - * @param {google.protobuf.Timestamp} request.startTime - * The time at which the updated SecurityMarks take effect. - * If not set uses current server time. Updates will be applied to the - * SecurityMarks that are active immediately preceding this time. - * @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 [SecurityMarks]{@link google.cloud.securitycenter.v1.SecurityMarks}. - * 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/security_center.update_security_marks.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async - */ - updateSecurityMarks( - request?: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityMarks, - protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|undefined, {}|undefined - ]>; - updateSecurityMarks( - request: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISecurityMarks, - protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityMarks( - request: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.ISecurityMarks, - protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityMarks( - request?: protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.ISecurityMarks, - protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.ISecurityMarks, - protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISecurityMarks, - protos.google.cloud.securitycenter.v1.IUpdateSecurityMarksRequest|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({ - 'security_marks.name': request.securityMarks!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateSecurityMarks(request, options, callback); - } - -/** - * Runs asset discovery. The discovery is tracked with a long-running - * operation. - * - * This API can only be called with limited frequency for an organization. If - * it is called too frequently the caller will receive a TOO_MANY_REQUESTS - * error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to run asset discovery for. Its format is - * "organizations/[organization_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/security_center.run_asset_discovery.js - * region_tag:securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async - */ - runAssetDiscovery( - request?: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runAssetDiscovery( - request: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runAssetDiscovery( - request: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runAssetDiscovery( - request?: protos.google.cloud.securitycenter.v1.IRunAssetDiscoveryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.runAssetDiscovery(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runAssetDiscovery()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/security_center.run_asset_discovery.js - * region_tag:securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async - */ - async checkRunAssetDiscoveryProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.runAssetDiscovery, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Filters an organization's assets and groups them by their specified - * properties. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [GroupResult]{@link google.cloud.securitycenter.v1.GroupResult}. - * 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 `groupAssetsAsync()` - * 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. - */ - groupAssets( - request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IGroupResult[], - protos.google.cloud.securitycenter.v1.IGroupAssetsRequest|null, - protos.google.cloud.securitycenter.v1.IGroupAssetsResponse - ]>; - groupAssets( - request: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>): void; - groupAssets( - request: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>): void; - groupAssets( - request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>): - Promise<[ - protos.google.cloud.securitycenter.v1.IGroupResult[], - protos.google.cloud.securitycenter.v1.IGroupAssetsRequest|null, - protos.google.cloud.securitycenter.v1.IGroupAssetsResponse - ]>|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.groupAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [GroupResult]{@link google.cloud.securitycenter.v1.GroupResult} 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 `groupAssetsAsync()` - * 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. - */ - groupAssetsStream( - request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - 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['groupAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupAssets.createStream( - this.innerApiCalls.groupAssets as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `groupAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [GroupResult]{@link google.cloud.securitycenter.v1.GroupResult}. 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/security_center.group_assets.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GroupAssets_async - */ - groupAssetsAsync( - request?: protos.google.cloud.securitycenter.v1.IGroupAssetsRequest, - 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['groupAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupAssets.asyncIterate( - this.innerApiCalls['groupAssets'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Filters an organization or source's findings and groups them by their - * specified properties. - * - * To group across all sources provide a `-` as the source id. - * Example: /v1/organizations/{organization_id}/sources/-/findings, - * /v1/folders/{folder_id}/sources/-/findings, - * /v1/projects/{project_id}/sources/-/findings - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state_change`). The string value should follow SQL syntax: comma separated - * list of fields. For example: "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * * severity - * - * The following fields are supported when compare_duration is set: - * - * * state_change - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [GroupResult]{@link google.cloud.securitycenter.v1.GroupResult}. - * 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 `groupFindingsAsync()` - * 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. - */ - groupFindings( - request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IGroupResult[], - protos.google.cloud.securitycenter.v1.IGroupFindingsRequest|null, - protos.google.cloud.securitycenter.v1.IGroupFindingsResponse - ]>; - groupFindings( - request: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>): void; - groupFindings( - request: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>): void; - groupFindings( - request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IGroupResult>): - Promise<[ - protos.google.cloud.securitycenter.v1.IGroupResult[], - protos.google.cloud.securitycenter.v1.IGroupFindingsRequest|null, - protos.google.cloud.securitycenter.v1.IGroupFindingsResponse - ]>|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.groupFindings(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state_change`). The string value should follow SQL syntax: comma separated - * list of fields. For example: "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * * severity - * - * The following fields are supported when compare_duration is set: - * - * * state_change - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [GroupResult]{@link google.cloud.securitycenter.v1.GroupResult} 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 `groupFindingsAsync()` - * 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. - */ - groupFindingsStream( - request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - 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['groupFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupFindings.createStream( - this.innerApiCalls.groupFindings as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `groupFindings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state_change`). The string value should follow SQL syntax: comma separated - * list of fields. For example: "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * * severity - * - * The following fields are supported when compare_duration is set: - * - * * state_change - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [GroupResult]{@link google.cloud.securitycenter.v1.GroupResult}. 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/security_center.group_findings.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GroupFindings_async - */ - groupFindingsAsync( - request?: protos.google.cloud.securitycenter.v1.IGroupFindingsRequest, - 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['groupFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupFindings.asyncIterate( - this.innerApiCalls['groupFindings'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists an organization's assets. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following are the allowed field and operator combinations: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [ListAssetsResult]{@link google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssets( - request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[], - protos.google.cloud.securitycenter.v1.IListAssetsRequest|null, - protos.google.cloud.securitycenter.v1.IListAssetsResponse - ]>; - listAssets( - request: protos.google.cloud.securitycenter.v1.IListAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>): void; - listAssets( - request: protos.google.cloud.securitycenter.v1.IListAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>): void; - listAssets( - request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult>): - Promise<[ - protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[], - protos.google.cloud.securitycenter.v1.IListAssetsRequest|null, - protos.google.cloud.securitycenter.v1.IListAssetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following are the allowed field and operator combinations: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [ListAssetsResult]{@link google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssetsStream( - request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.createStream( - this.innerApiCalls.listAssets as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following are the allowed field and operator combinations: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [ListAssetsResult]{@link google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult}. 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/security_center.list_assets.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListAssets_async - */ - listAssetsAsync( - request?: protos.google.cloud.securitycenter.v1.IListAssetsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.asyncIterate( - this.innerApiCalls['listAssets'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists an organization or source's findings. - * - * To list across all sources provide a `-` as the source id. - * Example: /v1/organizations/{organization_id}/sources/-/findings - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * * resource.folders.resource_folder: `=`, `:` - * * resource.display_name: `=`, `:` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [ListFindingsResult]{@link google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult}. - * 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.securitycenter.v1.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[], - protos.google.cloud.securitycenter.v1.IListFindingsRequest|null, - protos.google.cloud.securitycenter.v1.IListFindingsResponse - ]>; - listFindings( - request: protos.google.cloud.securitycenter.v1.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>): void; - listFindings( - request: protos.google.cloud.securitycenter.v1.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>): void; - listFindings( - request?: protos.google.cloud.securitycenter.v1.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult>): - Promise<[ - protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[], - protos.google.cloud.securitycenter.v1.IListFindingsRequest|null, - protos.google.cloud.securitycenter.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. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * * resource.folders.resource_folder: `=`, `:` - * * resource.display_name: `=`, `:` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [ListFindingsResult]{@link google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult} 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.securitycenter.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. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * severity: `=`, `:` - * * workflow_state: `=`, `:` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * - * * resource: - * * resource.name: `=`, `:` - * * resource.parent_name: `=`, `:` - * * resource.parent_display_name: `=`, `:` - * * resource.project_name: `=`, `:` - * * resource.project_display_name: `=`, `:` - * * resource.type: `=`, `:` - * * resource.folders.resource_folder: `=`, `:` - * * resource.display_name: `=`, `:` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [ListFindingsResult]{@link google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult}. 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/security_center.list_findings.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListFindings_async - */ - listFindingsAsync( - request?: protos.google.cloud.securitycenter.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; - } - /** - * Lists notification configs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to list notification configs. - * Its format is "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1.NotificationConfig}. - * 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 `listNotificationConfigsAsync()` - * 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. - */ - listNotificationConfigs( - request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig[], - protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest|null, - protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse - ]>; - listNotificationConfigs( - request: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.INotificationConfig>): void; - listNotificationConfigs( - request: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.INotificationConfig>): void; - listNotificationConfigs( - request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.INotificationConfig>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.INotificationConfig>): - Promise<[ - protos.google.cloud.securitycenter.v1.INotificationConfig[], - protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest|null, - protos.google.cloud.securitycenter.v1.IListNotificationConfigsResponse - ]>|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.listNotificationConfigs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to list notification configs. - * Its format is "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1.NotificationConfig} 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 `listNotificationConfigsAsync()` - * 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. - */ - listNotificationConfigsStream( - request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - 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['listNotificationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNotificationConfigs.createStream( - this.innerApiCalls.listNotificationConfigs as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNotificationConfigs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to list notification configs. - * Its format is "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [NotificationConfig]{@link google.cloud.securitycenter.v1.NotificationConfig}. 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/security_center.list_notification_configs.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async - */ - listNotificationConfigsAsync( - request?: protos.google.cloud.securitycenter.v1.IListNotificationConfigsRequest, - 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['listNotificationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNotificationConfigs.asyncIterate( - this.innerApiCalls['listNotificationConfigs'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists all sources belonging to an organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [Source]{@link google.cloud.securitycenter.v1.Source}. - * 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 `listSourcesAsync()` - * 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. - */ - listSources( - request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource[], - protos.google.cloud.securitycenter.v1.IListSourcesRequest|null, - protos.google.cloud.securitycenter.v1.IListSourcesResponse - ]>; - listSources( - request: protos.google.cloud.securitycenter.v1.IListSourcesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISource>): void; - listSources( - request: protos.google.cloud.securitycenter.v1.IListSourcesRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISource>): void; - listSources( - request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISource>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1.ISource>): - Promise<[ - protos.google.cloud.securitycenter.v1.ISource[], - protos.google.cloud.securitycenter.v1.IListSourcesRequest|null, - protos.google.cloud.securitycenter.v1.IListSourcesResponse - ]>|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.listSources(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. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [Source]{@link google.cloud.securitycenter.v1.Source} 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 `listSourcesAsync()` - * 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. - */ - listSourcesStream( - request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, - 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['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.createStream( - this.innerApiCalls.listSources as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSources`, 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. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [Source]{@link google.cloud.securitycenter.v1.Source}. 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/security_center.list_sources.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListSources_async - */ - listSourcesAsync( - request?: protos.google.cloud.securitycenter.v1.IListSourcesRequest, - 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['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.asyncIterate( - this.innerApiCalls['listSources'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAsset resource name string. - * - * @param {string} folder - * @param {string} asset - * @returns {string} Resource name string. - */ - folderAssetPath(folder:string,asset:string) { - return this.pathTemplates.folderAssetPathTemplate.render({ - folder: folder, - asset: asset, - }); - } - - /** - * Parse the folder from FolderAsset resource. - * - * @param {string} folderAssetName - * A fully-qualified path representing folder_asset resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAssetName(folderAssetName: string) { - return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).folder; - } - - /** - * Parse the asset from FolderAsset resource. - * - * @param {string} folderAssetName - * A fully-qualified path representing folder_asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromFolderAssetName(folderAssetName: string) { - return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).asset; - } - - /** - * Return a fully-qualified folderAssetSecurityMarks resource name string. - * - * @param {string} folder - * @param {string} asset - * @returns {string} Resource name string. - */ - folderAssetSecurityMarksPath(folder:string,asset:string) { - return this.pathTemplates.folderAssetSecurityMarksPathTemplate.render({ - folder: folder, - asset: asset, - }); - } - - /** - * Parse the folder from FolderAssetSecurityMarks resource. - * - * @param {string} folderAssetSecurityMarksName - * A fully-qualified path representing folder_asset_securityMarks resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { - return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).folder; - } - - /** - * Parse the asset from FolderAssetSecurityMarks resource. - * - * @param {string} folderAssetSecurityMarksName - * A fully-qualified path representing folder_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { - return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified folderSource resource name string. - * - * @param {string} folder - * @param {string} source - * @returns {string} Resource name string. - */ - folderSourcePath(folder:string,source:string) { - return this.pathTemplates.folderSourcePathTemplate.render({ - folder: folder, - source: source, - }); - } - - /** - * Parse the folder from FolderSource resource. - * - * @param {string} folderSourceName - * A fully-qualified path representing folder_source resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceName(folderSourceName: string) { - return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).folder; - } - - /** - * Parse the source from FolderSource resource. - * - * @param {string} folderSourceName - * A fully-qualified path representing folder_source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceName(folderSourceName: string) { - return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).source; - } - - /** - * Return a fully-qualified folderSourceFinding resource name string. - * - * @param {string} folder - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - folderSourceFindingPath(folder:string,source:string,finding:string) { - return this.pathTemplates.folderSourceFindingPathTemplate.render({ - folder: folder, - source: source, - finding: finding, - }); - } - - /** - * Parse the folder from FolderSourceFinding resource. - * - * @param {string} folderSourceFindingName - * A fully-qualified path representing folder_source_finding resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceFindingName(folderSourceFindingName: string) { - return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).folder; - } - - /** - * Parse the source from FolderSourceFinding resource. - * - * @param {string} folderSourceFindingName - * A fully-qualified path representing folder_source_finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceFindingName(folderSourceFindingName: string) { - return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).source; - } - - /** - * Parse the finding from FolderSourceFinding resource. - * - * @param {string} folderSourceFindingName - * A fully-qualified path representing folder_source_finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFolderSourceFindingName(folderSourceFindingName: string) { - return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).finding; - } - - /** - * Return a fully-qualified folderSourceFindingSecurityMarks resource name string. - * - * @param {string} folder - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - folderSourceFindingSecurityMarksPath(folder:string,source:string,finding:string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render({ - folder: folder, - source: source, - finding: finding, - }); - } - - /** - * Parse the folder from FolderSourceFindingSecurityMarks resource. - * - * @param {string} folderSourceFindingSecurityMarksName - * A fully-qualified path representing folder_source_finding_securityMarks resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).folder; - } - - /** - * Parse the source from FolderSourceFindingSecurityMarks resource. - * - * @param {string} folderSourceFindingSecurityMarksName - * A fully-qualified path representing folder_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from FolderSourceFindingSecurityMarks resource. - * - * @param {string} folderSourceFindingSecurityMarksName - * A fully-qualified path representing folder_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).finding; - } - - /** - * Return a fully-qualified notificationConfig resource name string. - * - * @param {string} organization - * @param {string} notification_config - * @returns {string} Resource name string. - */ - notificationConfigPath(organization:string,notificationConfig:string) { - return this.pathTemplates.notificationConfigPathTemplate.render({ - organization: organization, - notification_config: notificationConfig, - }); - } - - /** - * Parse the organization from NotificationConfig resource. - * - * @param {string} notificationConfigName - * A fully-qualified path representing NotificationConfig resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromNotificationConfigName(notificationConfigName: string) { - return this.pathTemplates.notificationConfigPathTemplate.match(notificationConfigName).organization; - } - - /** - * Parse the notification_config from NotificationConfig resource. - * - * @param {string} notificationConfigName - * A fully-qualified path representing NotificationConfig resource. - * @returns {string} A string representing the notification_config. - */ - matchNotificationConfigFromNotificationConfigName(notificationConfigName: string) { - return this.pathTemplates.notificationConfigPathTemplate.match(notificationConfigName).notification_config; - } - - /** - * Return a fully-qualified organization resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationPath(organization:string) { - return this.pathTemplates.organizationPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from Organization resource. - * - * @param {string} organizationName - * A fully-qualified path representing Organization resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationName(organizationName: string) { - return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; - } - - /** - * Return a fully-qualified organizationAsset resource name string. - * - * @param {string} organization - * @param {string} asset - * @returns {string} Resource name string. - */ - organizationAssetPath(organization:string,asset:string) { - return this.pathTemplates.organizationAssetPathTemplate.render({ - organization: organization, - asset: asset, - }); - } - - /** - * Parse the organization from OrganizationAsset resource. - * - * @param {string} organizationAssetName - * A fully-qualified path representing organization_asset resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAssetName(organizationAssetName: string) { - return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).organization; - } - - /** - * Parse the asset from OrganizationAsset resource. - * - * @param {string} organizationAssetName - * A fully-qualified path representing organization_asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromOrganizationAssetName(organizationAssetName: string) { - return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).asset; - } - - /** - * Return a fully-qualified organizationAssetSecurityMarks resource name string. - * - * @param {string} organization - * @param {string} asset - * @returns {string} Resource name string. - */ - organizationAssetSecurityMarksPath(organization:string,asset:string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.render({ - organization: organization, - asset: asset, - }); - } - - /** - * Parse the organization from OrganizationAssetSecurityMarks resource. - * - * @param {string} organizationAssetSecurityMarksName - * A fully-qualified path representing organization_asset_securityMarks resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).organization; - } - - /** - * Parse the asset from OrganizationAssetSecurityMarks resource. - * - * @param {string} organizationAssetSecurityMarksName - * A fully-qualified path representing organization_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing OrganizationSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSource resource name string. - * - * @param {string} organization - * @param {string} source - * @returns {string} Resource name string. - */ - organizationSourcePath(organization:string,source:string) { - return this.pathTemplates.organizationSourcePathTemplate.render({ - organization: organization, - source: source, - }); - } - - /** - * Parse the organization from OrganizationSource resource. - * - * @param {string} organizationSourceName - * A fully-qualified path representing organization_source resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceName(organizationSourceName: string) { - return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).organization; - } - - /** - * Parse the source from OrganizationSource resource. - * - * @param {string} organizationSourceName - * A fully-qualified path representing organization_source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceName(organizationSourceName: string) { - return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).source; - } - - /** - * Return a fully-qualified organizationSourceFinding resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - organizationSourceFindingPath(organization:string,source:string,finding:string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - }); - } - - /** - * Parse the organization from OrganizationSourceFinding resource. - * - * @param {string} organizationSourceFindingName - * A fully-qualified path representing organization_source_finding resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceFindingName(organizationSourceFindingName: string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).organization; - } - - /** - * Parse the source from OrganizationSourceFinding resource. - * - * @param {string} organizationSourceFindingName - * A fully-qualified path representing organization_source_finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceFindingName(organizationSourceFindingName: string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).source; - } - - /** - * Parse the finding from OrganizationSourceFinding resource. - * - * @param {string} organizationSourceFindingName - * A fully-qualified path representing organization_source_finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromOrganizationSourceFindingName(organizationSourceFindingName: string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).finding; - } - - /** - * Return a fully-qualified organizationSourceFindingSecurityMarks resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - organizationSourceFindingSecurityMarksPath(organization:string,source:string,finding:string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - }); - } - - /** - * Parse the organization from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).organization; - } - - /** - * Parse the source from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).finding; - } - - /** - * Return a fully-qualified projectAsset resource name string. - * - * @param {string} project - * @param {string} asset - * @returns {string} Resource name string. - */ - projectAssetPath(project:string,asset:string) { - return this.pathTemplates.projectAssetPathTemplate.render({ - project: project, - asset: asset, - }); - } - - /** - * Parse the project from ProjectAsset resource. - * - * @param {string} projectAssetName - * A fully-qualified path representing project_asset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAssetName(projectAssetName: string) { - return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).project; - } - - /** - * Parse the asset from ProjectAsset resource. - * - * @param {string} projectAssetName - * A fully-qualified path representing project_asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromProjectAssetName(projectAssetName: string) { - return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).asset; - } - - /** - * Return a fully-qualified projectAssetSecurityMarks resource name string. - * - * @param {string} project - * @param {string} asset - * @returns {string} Resource name string. - */ - projectAssetSecurityMarksPath(project:string,asset:string) { - return this.pathTemplates.projectAssetSecurityMarksPathTemplate.render({ - project: project, - asset: asset, - }); - } - - /** - * Parse the project from ProjectAssetSecurityMarks resource. - * - * @param {string} projectAssetSecurityMarksName - * A fully-qualified path representing project_asset_securityMarks resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { - return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).project; - } - - /** - * Parse the asset from ProjectAssetSecurityMarks resource. - * - * @param {string} projectAssetSecurityMarksName - * A fully-qualified path representing project_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { - return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified projectSource resource name string. - * - * @param {string} project - * @param {string} source - * @returns {string} Resource name string. - */ - projectSourcePath(project:string,source:string) { - return this.pathTemplates.projectSourcePathTemplate.render({ - project: project, - source: source, - }); - } - - /** - * Parse the project from ProjectSource resource. - * - * @param {string} projectSourceName - * A fully-qualified path representing project_source resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceName(projectSourceName: string) { - return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).project; - } - - /** - * Parse the source from ProjectSource resource. - * - * @param {string} projectSourceName - * A fully-qualified path representing project_source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceName(projectSourceName: string) { - return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).source; - } - - /** - * Return a fully-qualified projectSourceFinding resource name string. - * - * @param {string} project - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - projectSourceFindingPath(project:string,source:string,finding:string) { - return this.pathTemplates.projectSourceFindingPathTemplate.render({ - project: project, - source: source, - finding: finding, - }); - } - - /** - * Parse the project from ProjectSourceFinding resource. - * - * @param {string} projectSourceFindingName - * A fully-qualified path representing project_source_finding resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceFindingName(projectSourceFindingName: string) { - return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).project; - } - - /** - * Parse the source from ProjectSourceFinding resource. - * - * @param {string} projectSourceFindingName - * A fully-qualified path representing project_source_finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceFindingName(projectSourceFindingName: string) { - return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).source; - } - - /** - * Parse the finding from ProjectSourceFinding resource. - * - * @param {string} projectSourceFindingName - * A fully-qualified path representing project_source_finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromProjectSourceFindingName(projectSourceFindingName: string) { - return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).finding; - } - - /** - * Return a fully-qualified projectSourceFindingSecurityMarks resource name string. - * - * @param {string} project - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - projectSourceFindingSecurityMarksPath(project:string,source:string,finding:string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render({ - project: project, - source: source, - finding: finding, - }); - } - - /** - * Parse the project from ProjectSourceFindingSecurityMarks resource. - * - * @param {string} projectSourceFindingSecurityMarksName - * A fully-qualified path representing project_source_finding_securityMarks resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).project; - } - - /** - * Parse the source from ProjectSourceFindingSecurityMarks resource. - * - * @param {string} projectSourceFindingSecurityMarksName - * A fully-qualified path representing project_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from ProjectSourceFindingSecurityMarks resource. - * - * @param {string} projectSourceFindingSecurityMarksName - * A fully-qualified path representing project_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).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 { - this.initialize(); - if (!this._terminated) { - return this.securityCenterStub!.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/security_center_client_config.json b/owl-bot-staging/v1/src/v1/security_center_client_config.json deleted file mode 100644 index dbb23072..00000000 --- a/owl-bot-staging/v1/src/v1/security_center_client_config.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "interfaces": { - "google.cloud.securitycenter.v1.SecurityCenter": { - "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": { - "CreateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetOrganizationSettings": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetSource": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GroupAssets": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GroupFindings": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListAssets": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindings": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListNotificationConfigs": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListSources": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "RunAssetDiscovery": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetFindingState": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateFinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateOrganizationSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSecurityMarks": { - "timeout_millis": 480000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/security_center_proto_list.json b/owl-bot-staging/v1/src/v1/security_center_proto_list.json deleted file mode 100644 index dbee8391..00000000 --- a/owl-bot-staging/v1/src/v1/security_center_proto_list.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - "../../protos/google/cloud/securitycenter/v1/asset.proto", - "../../protos/google/cloud/securitycenter/v1/finding.proto", - "../../protos/google/cloud/securitycenter/v1/folder.proto", - "../../protos/google/cloud/securitycenter/v1/indicator.proto", - "../../protos/google/cloud/securitycenter/v1/notification_config.proto", - "../../protos/google/cloud/securitycenter/v1/notification_message.proto", - "../../protos/google/cloud/securitycenter/v1/organization_settings.proto", - "../../protos/google/cloud/securitycenter/v1/resource.proto", - "../../protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto", - "../../protos/google/cloud/securitycenter/v1/security_marks.proto", - "../../protos/google/cloud/securitycenter/v1/securitycenter_service.proto", - "../../protos/google/cloud/securitycenter/v1/source.proto", - "../../protos/google/cloud/securitycenter/v1/vulnerability.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 37333715..00000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +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. -// -// ** 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 securitycenter = require('@google-cloud/security-center'); - -function main() { - const securityCenterClient = new securitycenter.SecurityCenterClient(); -} - -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 b4153c94..00000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +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. -// -// ** 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 {SecurityCenterClient} from '@google-cloud/security-center'; - -// check that the client class type name can be used -function doStuffWithSecurityCenterClient(client: SecurityCenterClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const securityCenterClient = new SecurityCenterClient(); - doStuffWithSecurityCenterClient(securityCenterClient); -} - -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 1f850b52..00000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +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. -// -// ** 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_security_center_v1.ts b/owl-bot-staging/v1/test/gapic_security_center_v1.ts deleted file mode 100644 index d64b2ce1..00000000 --- a/owl-bot-staging/v1/test/gapic_security_center_v1.ts +++ /dev/null @@ -1,3743 +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. -// -// ** 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 securitycenterModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SecurityCenterClient', () => { - it('has servicePath', () => { - const servicePath = securitycenterModule.v1.SecurityCenterClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = securitycenterModule.v1.SecurityCenterClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = securitycenterModule.v1.SecurityCenterClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new securitycenterModule.v1.SecurityCenterClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.securityCenterStub, undefined); - await client.initialize(); - assert(client.securityCenterStub); - }); - - it('has close method', () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new securitycenterModule.v1.SecurityCenterClient({ - 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 securitycenterModule.v1.SecurityCenterClient({ - 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('createSource', () => { - it('invokes createSource without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateSourceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()); - client.innerApiCalls.createSource = stubSimpleCall(expectedResponse); - const [response] = await client.createSource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createSource without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateSourceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()); - client.innerApiCalls.createSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createSource with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateSourceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSource(request), expectedError); - assert((client.innerApiCalls.createSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createFinding', () => { - it('invokes createFinding without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateFindingRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Finding()); - client.innerApiCalls.createFinding = stubSimpleCall(expectedResponse); - const [response] = await client.createFinding(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createFinding without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateFindingRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Finding()); - client.innerApiCalls.createFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFinding( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createFinding with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateFindingRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createFinding(request), expectedError); - assert((client.innerApiCalls.createFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createNotificationConfig', () => { - it('invokes createNotificationConfig without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()); - client.innerApiCalls.createNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()); - client.innerApiCalls.createNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNotificationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createNotificationConfig with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.CreateNotificationConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createNotificationConfig(request), expectedError); - assert((client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteNotificationConfig', () => { - it('invokes deleteNotificationConfig without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNotificationConfig( - 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.deleteNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteNotificationConfig with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.DeleteNotificationConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteNotificationConfig(request), expectedError); - assert((client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getNotificationConfig', () => { - it('invokes getNotificationConfig without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()); - client.innerApiCalls.getNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()); - client.innerApiCalls.getNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNotificationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getNotificationConfig with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetNotificationConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNotificationConfig(request), expectedError); - assert((client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getOrganizationSettings', () => { - it('invokes getOrganizationSettings without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.OrganizationSettings()); - client.innerApiCalls.getOrganizationSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getOrganizationSettings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getOrganizationSettings without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.OrganizationSettings()); - client.innerApiCalls.getOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getOrganizationSettings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IOrganizationSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getOrganizationSettings with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getOrganizationSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getOrganizationSettings(request), expectedError); - assert((client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getSource', () => { - it('invokes getSource without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetSourceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()); - client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); - const [response] = await client.getSource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSource without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetSourceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()); - client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getSource with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GetSourceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSource(request), expectedError); - assert((client.innerApiCalls.getSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('setFindingState', () => { - it('invokes setFindingState without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.SetFindingStateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Finding()); - client.innerApiCalls.setFindingState = stubSimpleCall(expectedResponse); - const [response] = await client.setFindingState(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setFindingState without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.SetFindingStateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Finding()); - client.innerApiCalls.setFindingState = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setFindingState( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes setFindingState with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.SetFindingStateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setFindingState = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setFindingState(request), expectedError); - assert((client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes testIamPermissions with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateFinding', () => { - it('invokes updateFinding without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateFindingRequest()); - request.finding = {}; - request.finding.name = ''; - const expectedHeaderRequestParams = "finding.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Finding()); - client.innerApiCalls.updateFinding = stubSimpleCall(expectedResponse); - const [response] = await client.updateFinding(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateFinding without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateFindingRequest()); - request.finding = {}; - request.finding.name = ''; - const expectedHeaderRequestParams = "finding.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Finding()); - client.innerApiCalls.updateFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFinding( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateFinding with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateFindingRequest()); - request.finding = {}; - request.finding.name = ''; - const expectedHeaderRequestParams = "finding.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFinding(request), expectedError); - assert((client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateNotificationConfig', () => { - it('invokes updateNotificationConfig without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest()); - request.notificationConfig = {}; - request.notificationConfig.name = ''; - const expectedHeaderRequestParams = "notification_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()); - client.innerApiCalls.updateNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest()); - request.notificationConfig = {}; - request.notificationConfig.name = ''; - const expectedHeaderRequestParams = "notification_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()); - client.innerApiCalls.updateNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNotificationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateNotificationConfig with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateNotificationConfigRequest()); - request.notificationConfig = {}; - request.notificationConfig.name = ''; - const expectedHeaderRequestParams = "notification_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateNotificationConfig(request), expectedError); - assert((client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateOrganizationSettings', () => { - it('invokes updateOrganizationSettings without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest()); - request.organizationSettings = {}; - request.organizationSettings.name = ''; - const expectedHeaderRequestParams = "organization_settings.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.OrganizationSettings()); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateOrganizationSettings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateOrganizationSettings without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest()); - request.organizationSettings = {}; - request.organizationSettings.name = ''; - const expectedHeaderRequestParams = "organization_settings.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.OrganizationSettings()); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateOrganizationSettings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IOrganizationSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateOrganizationSettings with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest()); - request.organizationSettings = {}; - request.organizationSettings.name = ''; - const expectedHeaderRequestParams = "organization_settings.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateOrganizationSettings(request), expectedError); - assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateSource', () => { - it('invokes updateSource without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateSourceRequest()); - request.source = {}; - request.source.name = ''; - const expectedHeaderRequestParams = "source.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()); - client.innerApiCalls.updateSource = stubSimpleCall(expectedResponse); - const [response] = await client.updateSource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSource without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateSourceRequest()); - request.source = {}; - request.source.name = ''; - const expectedHeaderRequestParams = "source.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()); - client.innerApiCalls.updateSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateSource with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateSourceRequest()); - request.source = {}; - request.source.name = ''; - const expectedHeaderRequestParams = "source.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSource(request), expectedError); - assert((client.innerApiCalls.updateSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateSecurityMarks', () => { - it('invokes updateSecurityMarks without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest()); - request.securityMarks = {}; - request.securityMarks.name = ''; - const expectedHeaderRequestParams = "security_marks.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityMarks()); - client.innerApiCalls.updateSecurityMarks = stubSimpleCall(expectedResponse); - const [response] = await client.updateSecurityMarks(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSecurityMarks without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest()); - request.securityMarks = {}; - request.securityMarks.name = ''; - const expectedHeaderRequestParams = "security_marks.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.SecurityMarks()); - client.innerApiCalls.updateSecurityMarks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSecurityMarks( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISecurityMarks|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateSecurityMarks with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest()); - request.securityMarks = {}; - request.securityMarks.name = ''; - const expectedHeaderRequestParams = "security_marks.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityMarks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSecurityMarks(request), expectedError); - assert((client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('runAssetDiscovery', () => { - it('invokes runAssetDiscovery without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(expectedResponse); - const [operation] = await client.runAssetDiscovery(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes runAssetDiscovery without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runAssetDiscovery( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes runAssetDiscovery with call error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runAssetDiscovery(request), expectedError); - assert((client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes runAssetDiscovery with LRO error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runAssetDiscovery(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkRunAssetDiscoveryProgress without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRunAssetDiscoveryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunAssetDiscoveryProgress with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRunAssetDiscoveryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('groupAssets', () => { - it('invokes groupAssets without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.innerApiCalls.groupAssets = stubSimpleCall(expectedResponse); - const [response] = await client.groupAssets(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes groupAssets without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.innerApiCalls.groupAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.groupAssets( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IGroupResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes groupAssets with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.groupAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.groupAssets(request), expectedError); - assert((client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes groupAssetsStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.groupAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { - 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.groupAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); - assert.strictEqual( - (client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes groupAssetsStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.groupAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); - assert.strictEqual( - (client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with groupAssets without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; - const iterable = client.groupAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with groupAssets with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.groupAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('groupFindings', () => { - it('invokes groupFindings without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.innerApiCalls.groupFindings = stubSimpleCall(expectedResponse); - const [response] = await client.groupFindings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes groupFindings without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.innerApiCalls.groupFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.groupFindings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IGroupResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes groupFindings with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.groupFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.groupFindings(request), expectedError); - assert((client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes groupFindingsStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.groupFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { - 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.groupFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); - assert.strictEqual( - (client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes groupFindingsStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.groupFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); - assert.strictEqual( - (client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with groupFindings without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupResult()), - ]; - client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; - const iterable = client.groupFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with groupFindings with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.groupFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.IGroupResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listAssets', () => { - it('invokes listAssets without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - ]; - client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); - const [response] = await client.listAssets(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAssets without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - ]; - client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAssets( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listAssets with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAssets(request), expectedError); - assert((client.innerApiCalls.listAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAssetsStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - ]; - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert.strictEqual( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listAssetsStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert.strictEqual( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAssets without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsResponse.ListAssetsResult()), - ]; - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[] = []; - const iterable = client.listAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAssets with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.ListAssetsResponse.IListAssetsResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAssets.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 securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - ]; - 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 securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[]|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 securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.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 securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult) => { - 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 securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.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.securitycenter.v1.ListFindingsResponse.ListFindingsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult) => { - 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 securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.ListFindingsResponse.IListFindingsResult[] = []; - 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 securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.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.securitycenter.v1.ListFindingsResponse.IListFindingsResult[] = []; - 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('listNotificationConfigs', () => { - it('invokes listNotificationConfigs without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - ]; - client.innerApiCalls.listNotificationConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listNotificationConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listNotificationConfigs without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - ]; - client.innerApiCalls.listNotificationConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNotificationConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.INotificationConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listNotificationConfigs with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listNotificationConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNotificationConfigs(request), expectedError); - assert((client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listNotificationConfigsStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - ]; - client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNotificationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.NotificationConfig[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.NotificationConfig) => { - 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.listNotificationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listNotificationConfigsStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNotificationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.NotificationConfig[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.NotificationConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listNotificationConfigs without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.NotificationConfig()), - ]; - client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.INotificationConfig[] = []; - const iterable = client.listNotificationConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listNotificationConfigs with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNotificationConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.INotificationConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listSources', () => { - it('invokes listSources without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); - const [response] = await client.listSources(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSources as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSources without error using callback', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSources( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.ISource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSources as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listSources with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSources(request), expectedError); - assert((client.innerApiCalls.listSources as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSourcesStream without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - ]; - client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.Source[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.Source) => { - 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.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert.strictEqual( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listSourcesStream with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.Source[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.Source) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert.strictEqual( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSources without error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.Source()), - ]; - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.ISource[] = []; - const iterable = client.listSourcesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSources with error', async () => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSourcesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.ISource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('folderAsset', () => { - const fakePath = "/rendered/path/folderAsset"; - const expectedParameters = { - folder: "folderValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderAssetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAssetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAssetPath', () => { - const result = client.folderAssetPath("folderValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAssetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAssetName', () => { - const result = client.matchFolderFromFolderAssetName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromFolderAssetName', () => { - const result = client.matchAssetFromFolderAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAssetSecurityMarks', () => { - const fakePath = "/rendered/path/folderAssetSecurityMarks"; - const expectedParameters = { - folder: "folderValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAssetSecurityMarksPath', () => { - const result = client.folderAssetSecurityMarksPath("folderValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAssetSecurityMarksName', () => { - const result = client.matchFolderFromFolderAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromFolderAssetSecurityMarksName', () => { - const result = client.matchAssetFromFolderAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSource', () => { - const fakePath = "/rendered/path/folderSource"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourcePath', () => { - const result = client.folderSourcePath("folderValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceName', () => { - const result = client.matchFolderFromFolderSourceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceName', () => { - const result = client.matchSourceFromFolderSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSourceFinding', () => { - const fakePath = "/rendered/path/folderSourceFinding"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourceFindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourceFindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourceFindingPath', () => { - const result = client.folderSourceFindingPath("folderValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourceFindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceFindingName', () => { - const result = client.matchFolderFromFolderSourceFindingName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceFindingName', () => { - const result = client.matchSourceFromFolderSourceFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFolderSourceFindingName', () => { - const result = client.matchFindingFromFolderSourceFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/folderSourceFindingSecurityMarks"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourceFindingSecurityMarksPath', () => { - const result = client.folderSourceFindingSecurityMarksPath("folderValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceFindingSecurityMarksName', () => { - const result = client.matchFolderFromFolderSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromFolderSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFolderSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromFolderSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('notificationConfig', () => { - const fakePath = "/rendered/path/notificationConfig"; - const expectedParameters = { - organization: "organizationValue", - notification_config: "notificationConfigValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.notificationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.notificationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('notificationConfigPath', () => { - const result = client.notificationConfigPath("organizationValue", "notificationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.notificationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromNotificationConfigName', () => { - const result = client.matchOrganizationFromNotificationConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.notificationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationConfigFromNotificationConfigName', () => { - const result = client.matchNotificationConfigFromNotificationConfigName(fakePath); - assert.strictEqual(result, "notificationConfigValue"); - assert((client.pathTemplates.notificationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organization', () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationPath', () => { - const result = client.organizationPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationName', () => { - const result = client.matchOrganizationFromOrganizationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAsset', () => { - const fakePath = "/rendered/path/organizationAsset"; - const expectedParameters = { - organization: "organizationValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationAssetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAssetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAssetPath', () => { - const result = client.organizationAssetPath("organizationValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAssetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAssetName', () => { - const result = client.matchOrganizationFromOrganizationAssetName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromOrganizationAssetName', () => { - const result = client.matchAssetFromOrganizationAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAssetSecurityMarks', () => { - const fakePath = "/rendered/path/organizationAssetSecurityMarks"; - const expectedParameters = { - organization: "organizationValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAssetSecurityMarksPath', () => { - const result = client.organizationAssetSecurityMarksPath("organizationValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAssetSecurityMarksName', () => { - const result = client.matchOrganizationFromOrganizationAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromOrganizationAssetSecurityMarksName', () => { - const result = client.matchAssetFromOrganizationAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSource', () => { - const fakePath = "/rendered/path/organizationSource"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourcePath', () => { - const result = client.organizationSourcePath("organizationValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceName', () => { - const result = client.matchOrganizationFromOrganizationSourceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceName', () => { - const result = client.matchSourceFromOrganizationSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSourceFinding', () => { - const fakePath = "/rendered/path/organizationSourceFinding"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourceFindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourceFindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourceFindingPath', () => { - const result = client.organizationSourceFindingPath("organizationValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceFindingName', () => { - const result = client.matchOrganizationFromOrganizationSourceFindingName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceFindingName', () => { - const result = client.matchSourceFromOrganizationSourceFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromOrganizationSourceFindingName', () => { - const result = client.matchFindingFromOrganizationSourceFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/organizationSourceFindingSecurityMarks"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourceFindingSecurityMarksPath', () => { - const result = client.organizationSourceFindingSecurityMarksPath("organizationValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchOrganizationFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAsset', () => { - const fakePath = "/rendered/path/projectAsset"; - const expectedParameters = { - project: "projectValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAssetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAssetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAssetPath', () => { - const result = client.projectAssetPath("projectValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAssetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAssetName', () => { - const result = client.matchProjectFromProjectAssetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromProjectAssetName', () => { - const result = client.matchAssetFromProjectAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAssetSecurityMarks', () => { - const fakePath = "/rendered/path/projectAssetSecurityMarks"; - const expectedParameters = { - project: "projectValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAssetSecurityMarksPath', () => { - const result = client.projectAssetSecurityMarksPath("projectValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAssetSecurityMarksName', () => { - const result = client.matchProjectFromProjectAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromProjectAssetSecurityMarksName', () => { - const result = client.matchAssetFromProjectAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSource', () => { - const fakePath = "/rendered/path/projectSource"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourcePath', () => { - const result = client.projectSourcePath("projectValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceName', () => { - const result = client.matchProjectFromProjectSourceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceName', () => { - const result = client.matchSourceFromProjectSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSourceFinding', () => { - const fakePath = "/rendered/path/projectSourceFinding"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourceFindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourceFindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourceFindingPath', () => { - const result = client.projectSourceFindingPath("projectValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourceFindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceFindingName', () => { - const result = client.matchProjectFromProjectSourceFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceFindingName', () => { - const result = client.matchSourceFromProjectSourceFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromProjectSourceFindingName', () => { - const result = client.matchFindingFromProjectSourceFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/projectSourceFindingSecurityMarks"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourceFindingSecurityMarksPath', () => { - const result = client.projectSourceFindingSecurityMarksPath("projectValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceFindingSecurityMarksName', () => { - const result = client.matchProjectFromProjectSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromProjectSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromProjectSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromProjectSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- a/owl-bot-staging/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index 4aeca8bf..00000000 --- a/owl-bot-staging/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'SecurityCenter', - filename: './security-center.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/v1beta1/.eslintignore b/owl-bot-staging/v1beta1/.eslintignore deleted file mode 100644 index cfc348ec..00000000 --- a/owl-bot-staging/v1beta1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1beta1/.eslintrc.json b/owl-bot-staging/v1beta1/.eslintrc.json deleted file mode 100644 index 78215349..00000000 --- a/owl-bot-staging/v1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1beta1/.gitignore b/owl-bot-staging/v1beta1/.gitignore deleted file mode 100644 index 5d32b237..00000000 --- a/owl-bot-staging/v1beta1/.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/v1beta1/.jsdoc.js b/owl-bot-staging/v1beta1/.jsdoc.js deleted file mode 100644 index e201160b..00000000 --- a/owl-bot-staging/v1beta1/.jsdoc.js +++ /dev/null @@ -1,55 +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. -// -// ** 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 2021 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/security-center', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1beta1/.mocharc.js b/owl-bot-staging/v1beta1/.mocharc.js deleted file mode 100644 index 50bc7f79..00000000 --- a/owl-bot-staging/v1beta1/.mocharc.js +++ /dev/null @@ -1,33 +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. -// -// ** 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/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js deleted file mode 100644 index 84f4713a..00000000 --- a/owl-bot-staging/v1beta1/.prettierrc.js +++ /dev/null @@ -1,22 +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. -// -// ** 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/v1beta1/README.md b/owl-bot-staging/v1beta1/README.md deleted file mode 100644 index 73f34764..00000000 --- a/owl-bot-staging/v1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Securitycenter: Nodejs Client diff --git a/owl-bot-staging/v1beta1/linkinator.config.json b/owl-bot-staging/v1beta1/linkinator.config.json deleted file mode 100644 index 0121dfa6..00000000 --- a/owl-bot-staging/v1beta1/linkinator.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io" - ], - "silent": true, - "concurrency": 5 -} diff --git a/owl-bot-staging/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json deleted file mode 100644 index b88a2160..00000000 --- a/owl-bot-staging/v1beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/security-center", - "version": "0.1.0", - "description": "Securitycenter client for Node.js", - "repository": "googleapis/nodejs-securitycenter", - "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 securitycenter", - "securitycenter", - "security center" - ], - "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": "^2.28.0" - }, - "devDependencies": { - "@types/mocha": "^9.0.0", - "@types/node": "^14.17.32", - "@types/sinon": "^10.0.6", - "c8": "^7.10.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^2.14.5", - "mocha": "^9.1.3", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.2", - "ts-loader": "^9.2.6", - "typescript": "^4.4.4", - "webpack": "^5.62.1", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto deleted file mode 100644 index b73f7d5b..00000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/asset.proto +++ /dev/null @@ -1,93 +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.securitycenter.v1beta1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1beta1/security_marks.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// Security Command Center representation of a Google Cloud -// resource. -// -// The Asset is a Security Command Center resource that captures information -// about a single Google Cloud resource. All modifications to an Asset are only -// within the context of Security Command Center and don't affect the referenced -// Google Cloud resource. -message Asset { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Asset" - pattern: "organizations/{organization}/assets/{asset}" - }; - - // Security Command Center managed properties. These properties are managed by - // Security Command Center and cannot be modified by the user. - message SecurityCenterProperties { - // Immutable. The full resource name of the Google Cloud resource this asset - // represents. This field is immutable after create time. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The type of the Google Cloud resource. Examples include: APPLICATION, - // PROJECT, and ORGANIZATION. This is a case insensitive field defined by - // Security Command Center and/or the producer of the resource and is - // immutable after create time. - string resource_type = 2; - - // The full resource name of the immediate parent of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_parent = 3; - - // The full resource name of the project the resource belongs to. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_project = 4; - - // Owners of the Google Cloud resource. - repeated string resource_owners = 5; - } - - // The relative resource name of this asset. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/assets/{asset_id}". - string name = 1; - - // Security Command Center managed properties. These properties are managed by - // Security Command Center and cannot be modified by the user. - SecurityCenterProperties security_center_properties = 2; - - // Resource managed properties. These properties are managed and defined by - // the Google Cloud resource and cannot be modified by the user. - map resource_properties = 7; - - // User specified security marks. These marks are entirely managed by the user - // and come from the SecurityMarks resource that belongs to the asset. - SecurityMarks security_marks = 8; - - // The time at which the asset was created in Security Command Center. - google.protobuf.Timestamp create_time = 9; - - // The time at which the asset was last updated, added, or deleted in Security - // Command Center. - google.protobuf.Timestamp update_time = 10; -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.proto deleted file mode 100644 index 647b3b43..00000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/finding.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.securitycenter.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1beta1/security_marks.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// Security Command Center finding. -// -// A finding is a record of assessment data (security, risk, health or privacy) -// ingested into Security Command Center for presentation, notification, -// analysis, policy testing, and enforcement. For example, an XSS vulnerability -// in an App Engine application is a finding. -message Finding { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Finding" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}" - }; - - // The state of the finding. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // The finding requires attention and has not been addressed yet. - ACTIVE = 1; - - // The finding has been fixed, triaged as a non-issue or otherwise addressed - // and is no longer active. - INACTIVE = 2; - } - - // The relative resource name of this finding. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}" - string name = 1; - - // Immutable. The relative resource name of the source the finding belongs to. - // See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // This field is immutable after creation time. - // For example: - // "organizations/{organization_id}/sources/{source_id}" - string parent = 2 [(google.api.field_behavior) = IMMUTABLE]; - - // For findings on Google Cloud resources, the full resource - // name of the Google Cloud resource this finding is for. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - // When the finding is for a non-Google Cloud resource, the resourceName can - // be a customer or partner defined string. This field is immutable after - // creation time. - string resource_name = 3; - - // The state of the finding. - State state = 4; - - // The additional taxonomy group within findings from a given source. - // This field is immutable after creation time. - // Example: "XSS_FLASH_INJECTION" - string category = 5; - - // The URI that, if available, points to a web page outside of Security - // Command Center where additional information about the finding can be found. - // This field is guaranteed to be either empty or a well formed URL. - string external_uri = 6; - - // Source specific properties. These properties are managed by the source - // that writes the finding. The key names in the source_properties map must be - // between 1 and 255 characters, and must start with a letter and contain - // alphanumeric characters or underscores only. - map source_properties = 7; - - // Output only. User specified security marks. These marks are entirely - // managed by the user and come from the SecurityMarks resource that belongs - // to the finding. - SecurityMarks security_marks = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The time at which the event took place, or when an update to the finding - // occurred. For example, if the finding represents an open firewall it would - // capture the time the detector believes the firewall became open. The - // accuracy is determined by the detector. If the finding were to be resolved - // afterward, this time would reflect when the finding was resolved. - google.protobuf.Timestamp event_time = 9; - - // The time at which the finding was created in Security Command Center. - google.protobuf.Timestamp create_time = 10; -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto deleted file mode 100644 index 88b2008a..00000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/organization_settings.proto +++ /dev/null @@ -1,79 +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.securitycenter.v1beta1; - -import "google/api/resource.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// User specified settings that are attached to the Security Command -// Center organization. -message OrganizationSettings { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/OrganizationSettings" - pattern: "organizations/{organization}/organizationSettings" - }; - - // The configuration used for Asset Discovery runs. - message AssetDiscoveryConfig { - // The mode of inclusion when running Asset Discovery. - // Asset discovery can be limited by explicitly identifying projects to be - // included or excluded. If INCLUDE_ONLY is set, then only those projects - // within the organization and their children are discovered during asset - // discovery. If EXCLUDE is set, then projects that don't match those - // projects are discovered during asset discovery. If neither are set, then - // all projects within the organization are discovered during asset - // discovery. - enum InclusionMode { - // Unspecified. Setting the mode with this value will disable - // inclusion/exclusion filtering for Asset Discovery. - INCLUSION_MODE_UNSPECIFIED = 0; - - // Asset Discovery will capture only the resources within the projects - // specified. All other resources will be ignored. - INCLUDE_ONLY = 1; - - // Asset Discovery will ignore all resources under the projects specified. - // All other resources will be retrieved. - EXCLUDE = 2; - } - - // The project ids to use for filtering asset discovery. - repeated string project_ids = 1; - - // The mode to use for filtering asset discovery. - InclusionMode inclusion_mode = 2; - } - - // The relative resource name of the settings. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/organizationSettings". - string name = 1; - - // A flag that indicates if Asset Discovery should be enabled. If the flag is - // set to `true`, then discovery of assets will occur. If it is set to `false, - // all historical assets will remain, but discovery of future assets will not - // occur. - bool enable_asset_discovery = 2; - - // The configuration used for Asset Discovery runs. - AssetDiscoveryConfig asset_discovery_config = 3; -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto deleted file mode 100644 index 20d3b25b..00000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto +++ /dev/null @@ -1,49 +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.securitycenter.v1beta1; - -import "google/protobuf/duration.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// Response of asset discovery run -message RunAssetDiscoveryResponse { - // The state of an asset discovery run. - enum State { - // Asset discovery run state was unspecified. - STATE_UNSPECIFIED = 0; - - // Asset discovery run completed successfully. - COMPLETED = 1; - - // Asset discovery run was cancelled with tasks still pending, as another - // run for the same organization was started with a higher priority. - SUPERSEDED = 2; - - // Asset discovery run was killed and terminated. - TERMINATED = 3; - } - - // The state of an asset discovery run. - State state = 1; - - // The duration between asset discovery run start and end - google.protobuf.Duration duration = 2; -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto deleted file mode 100644 index 2547c306..00000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/security_marks.proto +++ /dev/null @@ -1,53 +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.securitycenter.v1beta1; - -import "google/api/resource.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// User specified security marks that are attached to the parent Security -// Command Center resource. Security marks are scoped within a Security Command -// Center organization -- they can be modified and viewed by all users who have -// proper permissions on the organization. -message SecurityMarks { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/SecurityMarks" - pattern: "organizations/{organization}/assets/{asset}/securityMarks" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}/securityMarks" - }; - - // The relative resource name of the SecurityMarks. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Examples: - // "organizations/{organization_id}/assets/{asset_id}/securityMarks" - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks". - string name = 1; - - // Mutable user specified security marks belonging to the parent resource. - // Constraints are as follows: - // - // * Keys and values are treated as case insensitive - // * Keys must be between 1 - 256 characters (inclusive) - // * Keys must be letters, numbers, underscores, or dashes - // * Values have leading and trailing whitespace trimmed, remaining - // characters must be between 1 - 4096 characters (inclusive) - map marks = 2; -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto deleted file mode 100644 index 351c1f4a..00000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto +++ /dev/null @@ -1,824 +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.securitycenter.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1beta1/asset.proto"; -import "google/cloud/securitycenter/v1beta1/finding.proto"; -import "google/cloud/securitycenter/v1beta1/organization_settings.proto"; -import "google/cloud/securitycenter/v1beta1/security_marks.proto"; -import "google/cloud/securitycenter/v1beta1/source.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// V1 Beta APIs for Security Center service. -service SecurityCenter { - option (google.api.default_host) = "securitycenter.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a source. - rpc CreateSource(CreateSourceRequest) returns (Source) { - option (google.api.http) = { - post: "/v1beta1/{parent=organizations/*}/sources" - body: "source" - }; - option (google.api.method_signature) = "parent,source"; - } - - // Creates a finding. The corresponding source must exist for finding creation - // to succeed. - rpc CreateFinding(CreateFindingRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1beta1/{parent=organizations/*/sources/*}/findings" - body: "finding" - }; - option (google.api.method_signature) = "parent,finding_id,finding"; - } - - // Gets the access control policy on the specified Source. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1beta1/{resource=organizations/*/sources/*}:getIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource"; - } - - // Gets the settings for an organization. - rpc GetOrganizationSettings(GetOrganizationSettingsRequest) returns (OrganizationSettings) { - option (google.api.http) = { - get: "/v1beta1/{name=organizations/*/organizationSettings}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a source. - rpc GetSource(GetSourceRequest) returns (Source) { - option (google.api.http) = { - get: "/v1beta1/{name=organizations/*/sources/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Filters an organization's assets and groups them by their specified - // properties. - rpc GroupAssets(GroupAssetsRequest) returns (GroupAssetsResponse) { - option (google.api.http) = { - post: "/v1beta1/{parent=organizations/*}/assets:group" - body: "*" - }; - } - - // Filters an organization or source's findings and groups them by their - // specified properties. - // - // To group across all sources provide a `-` as the source id. - // Example: /v1beta1/organizations/{organization_id}/sources/-/findings - rpc GroupFindings(GroupFindingsRequest) returns (GroupFindingsResponse) { - option (google.api.http) = { - post: "/v1beta1/{parent=organizations/*/sources/*}/findings:group" - body: "*" - }; - option (google.api.method_signature) = "parent,group_by"; - } - - // Lists an organization's assets. - rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=organizations/*}/assets" - }; - } - - // Lists an organization or source's findings. - // - // To list across all sources provide a `-` as the source id. - // Example: /v1beta1/organizations/{organization_id}/sources/-/findings - rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=organizations/*/sources/*}/findings" - }; - } - - // Lists all sources belonging to an organization. - rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=organizations/*}/sources" - }; - option (google.api.method_signature) = "parent"; - } - - // Runs asset discovery. The discovery is tracked with a long-running - // operation. - // - // This API can only be called with limited frequency for an organization. If - // it is called too frequently the caller will receive a TOO_MANY_REQUESTS - // error. - rpc RunAssetDiscovery(RunAssetDiscoveryRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=organizations/*}/assets:runDiscovery" - body: "*" - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Empty" - }; - } - - // Updates the state of a finding. - rpc SetFindingState(SetFindingStateRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1beta1/{name=organizations/*/sources/*/findings/*}:setState" - body: "*" - }; - option (google.api.method_signature) = "name,state,start_time"; - } - - // Sets the access control policy on the specified Source. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1beta1/{resource=organizations/*/sources/*}:setIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Returns the permissions that a caller has on the specified source. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1beta1/{resource=organizations/*/sources/*}:testIamPermissions" - body: "*" - }; - option (google.api.method_signature) = "resource,permissions"; - } - - // Creates or updates a finding. The corresponding source must exist for a - // finding creation to succeed. - rpc UpdateFinding(UpdateFindingRequest) returns (Finding) { - option (google.api.http) = { - patch: "/v1beta1/{finding.name=organizations/*/sources/*/findings/*}" - body: "finding" - }; - option (google.api.method_signature) = "finding"; - } - - // Updates an organization's settings. - rpc UpdateOrganizationSettings(UpdateOrganizationSettingsRequest) returns (OrganizationSettings) { - option (google.api.http) = { - patch: "/v1beta1/{organization_settings.name=organizations/*/organizationSettings}" - body: "organization_settings" - }; - option (google.api.method_signature) = "organization_settings"; - } - - // Updates a source. - rpc UpdateSource(UpdateSourceRequest) returns (Source) { - option (google.api.http) = { - patch: "/v1beta1/{source.name=organizations/*/sources/*}" - body: "source" - }; - option (google.api.method_signature) = "source"; - } - - // Updates security marks. - rpc UpdateSecurityMarks(UpdateSecurityMarksRequest) returns (SecurityMarks) { - option (google.api.http) = { - patch: "/v1beta1/{security_marks.name=organizations/*/assets/*/securityMarks}" - body: "security_marks" - additional_bindings { - patch: "/v1beta1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - }; - option (google.api.method_signature) = "security_marks"; - } -} - -// Request message for creating a finding. -message CreateFindingRequest { - // Required. Resource name of the new finding's parent. Its format should be - // "organizations/[organization_id]/sources/[source_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Required. Unique identifier provided by the client within the parent scope. - // It must be alphanumeric and less than or equal to 32 characters and - // greater than 0 characters in length. - string finding_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Finding being created. The name and security_marks will be ignored as - // they are both output only fields on this resource. - Finding finding = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for creating a source. -message CreateSourceRequest { - // Required. Resource name of the new source's parent. Its format should be - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Required. The Source being created, only the display_name and description will be - // used. All other fields will be ignored. - Source source = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for getting organization settings. -message GetOrganizationSettingsRequest { - // Required. Name of the organization to get organization settings for. Its format is - // "organizations/[organization_id]/organizationSettings". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/OrganizationSettings" - } - ]; -} - -// Request message for getting a source. -message GetSourceRequest { - // Required. Relative resource name of the source. Its format is - // "organizations/[organization_id]/source/[source_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; -} - -// Request message for grouping by assets. -message GroupAssetsRequest { - // Required. Name of the organization to groupBy. Its format is - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Expression that defines the filter to apply across assets. - // The expression is a list of zero or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are not supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. The fields map to those - // defined in the Asset resource. Examples include: - // - // * name - // * security_center_properties.resource_name - // * resource_properties.a_property - // * security_marks.marks.marka - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - // - // For example, `resource_properties.size = 100` is a valid filter string. - string filter = 2; - - // Required. Expression that defines what assets fields to use for grouping. The string - // value should follow SQL syntax: comma separated list of fields. For - // example: - // "security_center_properties.resource_project,security_center_properties.project". - // - // The following fields are supported when compare_duration is not set: - // - // * security_center_properties.resource_project - // * security_center_properties.resource_type - // * security_center_properties.resource_parent - // - // The following fields are supported when compare_duration is set: - // - // * security_center_properties.resource_type - string group_by = 3 [(google.api.field_behavior) = REQUIRED]; - - // When compare_duration is set, the Asset's "state" property is updated to - // indicate whether the asset was added, removed, or remained present during - // the compare_duration period of time that precedes the read_time. This is - // the time between (read_time - compare_duration) and read_time. - // - // The state value is derived based on the presence of the asset at the two - // points in time. Intermediate state changes between the two times don't - // affect the result. For example, the results aren't affected if the asset is - // removed and re-created again. - // - // Possible "state" values when compare_duration is specified: - // - // * "ADDED": indicates that the asset was not present before - // compare_duration, but present at reference_time. - // * "REMOVED": indicates that the asset was present at the start of - // compare_duration, but not present at reference_time. - // * "ACTIVE": indicates that the asset was present at both the - // start and the end of the time period defined by - // compare_duration and reference_time. - // - // This field is ignored if `state` is not a field in `group_by`. - google.protobuf.Duration compare_duration = 4; - - // Time used as a reference point when filtering assets. The filter is limited - // to assets existing at the supplied time and their values are those at that - // specific time. Absence of this field will default to the API's version of - // NOW. - google.protobuf.Timestamp read_time = 5; - - // The value returned by the last `GroupAssetsResponse`; indicates - // that this is a continuation of a prior `GroupAssets` call, and that the - // system should return the next page of data. - string page_token = 7; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 8; -} - -// Response message for grouping by assets. -message GroupAssetsResponse { - // Group results. There exists an element for each existing unique - // combination of property/values. The element contains a count for the number - // of times those specific property/values appear. - repeated GroupResult group_by_results = 1; - - // Time used for executing the groupBy request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; -} - -// Request message for grouping by findings. -message GroupFindingsRequest { - // Required. Name of the source to groupBy. Its format is - // "organizations/[organization_id]/sources/[source_id]". To groupBy across - // all sources provide a source_id of `-`. For example: - // organizations/{organization_id}/sources/- - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Expression that defines the filter to apply across findings. - // The expression is a list of one or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are not supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. Examples include: - // - // * name - // * source_properties.a_property - // * security_marks.marks.marka - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - // - // For example, `source_properties.size = 100` is a valid filter string. - string filter = 2; - - // Required. Expression that defines what assets fields to use for grouping (including - // `state`). The string value should follow SQL syntax: comma separated list - // of fields. For example: - // "parent,resource_name". - // - // The following fields are supported: - // - // * resource_name - // * category - // * state - // * parent - string group_by = 3 [(google.api.field_behavior) = REQUIRED]; - - // Time used as a reference point when filtering findings. The filter is - // limited to findings existing at the supplied time and their values are - // those at that specific time. Absence of this field will default to the - // API's version of NOW. - google.protobuf.Timestamp read_time = 4; - - // The value returned by the last `GroupFindingsResponse`; indicates - // that this is a continuation of a prior `GroupFindings` call, and - // that the system should return the next page of data. - string page_token = 5; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 6; -} - -// Response message for group by findings. -message GroupFindingsResponse { - // Group results. There exists an element for each existing unique - // combination of property/values. The element contains a count for the number - // of times those specific property/values appear. - repeated GroupResult group_by_results = 1; - - // Time used for executing the groupBy request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; -} - -// Result containing the properties and count of a groupBy request. -message GroupResult { - // Properties matching the groupBy fields in the request. - map properties = 1; - - // Total count of resources for the given properties. - int64 count = 2; -} - -// Request message for listing sources. -message ListSourcesRequest { - // Required. Resource name of the parent of sources to list. Its format should be - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // The value returned by the last `ListSourcesResponse`; indicates - // that this is a continuation of a prior `ListSources` call, and - // that the system should return the next page of data. - string page_token = 2; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 7; -} - -// Response message for listing sources. -message ListSourcesResponse { - // Sources belonging to the requested parent. - repeated Source sources = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 2; -} - -// Request message for listing assets. -message ListAssetsRequest { - // Required. Name of the organization assets should belong to. Its format is - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Expression that defines the filter to apply across assets. - // The expression is a list of zero or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are not supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. The fields map to those - // defined in the Asset resource. Examples include: - // - // * name - // * security_center_properties.resource_name - // * resource_properties.a_property - // * security_marks.marks.marka - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - // - // For example, `resource_properties.size = 100` is a valid filter string. - string filter = 2; - - // Expression that defines what fields and order to use for sorting. The - // string value should follow SQL syntax: comma separated list of fields. For - // example: "name,resource_properties.a_property". The default sorting order - // is ascending. To specify descending order for a field, a suffix " desc" - // should be appended to the field name. For example: "name - // desc,resource_properties.a_property". Redundant space characters in the - // syntax are insignificant. "name desc,resource_properties.a_property" and " - // name desc , resource_properties.a_property " are equivalent. - string order_by = 3; - - // Time used as a reference point when filtering assets. The filter is limited - // to assets existing at the supplied time and their values are those at that - // specific time. Absence of this field will default to the API's version of - // NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the ListAssetResult's "state" attribute is - // updated to indicate whether the asset was added, removed, or remained - // present during the compare_duration period of time that precedes the - // read_time. This is the time between (read_time - - // compare_duration) and read_time. - // - // The state value is derived based on the presence of the asset at the two - // points in time. Intermediate state changes between the two times don't - // affect the result. For example, the results aren't affected if the asset is - // removed and re-created again. - // - // Possible "state" values when compare_duration is specified: - // - // * "ADDED": indicates that the asset was not present before - // compare_duration, but present at read_time. - // * "REMOVED": indicates that the asset was present at the start of - // compare_duration, but not present at read_time. - // * "ACTIVE": indicates that the asset was present at both the - // start and the end of the time period defined by - // compare_duration and read_time. - // - // If compare_duration is not specified, then the only possible state is - // "UNUSED", which indicates that the asset is present at read_time. - google.protobuf.Duration compare_duration = 5; - - // Optional. A field mask to specify the ListAssetsResult fields to be listed in the - // response. - // An empty field mask will list all fields. - google.protobuf.FieldMask field_mask = 7 [(google.api.field_behavior) = OPTIONAL]; - - // The value returned by the last `ListAssetsResponse`; indicates - // that this is a continuation of a prior `ListAssets` call, and - // that the system should return the next page of data. - string page_token = 8; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 9; -} - -// Response message for listing assets. -message ListAssetsResponse { - // Result containing the Asset and its State. - message ListAssetsResult { - // State of the asset. - // - // When querying across two points in time this describes - // the change between the two points: ADDED, REMOVED, or ACTIVE. - // If there was no compare_duration supplied in the request the state should - // be: UNUSED - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // Request did not specify use of this field in the result. - UNUSED = 1; - - // Asset was added between the points in time. - ADDED = 2; - - // Asset was removed between the points in time. - REMOVED = 3; - - // Asset was active at both point(s) in time. - ACTIVE = 4; - } - - // Asset matching the search request. - Asset asset = 1; - - // State of the asset. - State state = 2; - } - - // Assets matching the list request. - repeated ListAssetsResult list_assets_results = 1; - - // Time used for executing the list request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of assets matching the query. - int32 total_size = 4; -} - -// Request message for listing findings. -message ListFindingsRequest { - // Required. Name of the source the findings belong to. Its format is - // "organizations/[organization_id]/sources/[source_id]". To list across all - // sources provide a source_id of `-`. For example: - // organizations/{organization_id}/sources/- - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Expression that defines the filter to apply across findings. - // The expression is a list of one or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are not supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. Examples include: - // - // * name - // * source_properties.a_property - // * security_marks.marks.marka - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - // - // For example, `source_properties.size = 100` is a valid filter string. - string filter = 2; - - // Expression that defines what fields and order to use for sorting. The - // string value should follow SQL syntax: comma separated list of fields. For - // example: "name,resource_properties.a_property". The default sorting order - // is ascending. To specify descending order for a field, a suffix " desc" - // should be appended to the field name. For example: "name - // desc,source_properties.a_property". Redundant space characters in the - // syntax are insignificant. "name desc,source_properties.a_property" and " - // name desc , source_properties.a_property " are equivalent. - string order_by = 3; - - // Time used as a reference point when filtering findings. The filter is - // limited to findings existing at the supplied time and their values are - // those at that specific time. Absence of this field will default to the - // API's version of NOW. - google.protobuf.Timestamp read_time = 4; - - // Optional. A field mask to specify the Finding fields to be listed in the response. - // An empty field mask will list all fields. - google.protobuf.FieldMask field_mask = 5 [(google.api.field_behavior) = OPTIONAL]; - - // The value returned by the last `ListFindingsResponse`; indicates - // that this is a continuation of a prior `ListFindings` call, and - // that the system should return the next page of data. - string page_token = 6; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 7; -} - -// Response message for listing findings. -message ListFindingsResponse { - // Findings matching the list request. - repeated Finding findings = 1; - - // Time used for executing the list request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of findings matching the query. - int32 total_size = 4; -} - -// Request message for updating a finding's state. -message SetFindingStateRequest { - // Required. The relative resource name of the finding. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Finding" - } - ]; - - // Required. The desired State of the finding. - Finding.State state = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The time at which the updated state takes effect. - google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for running asset discovery for an organization. -message RunAssetDiscoveryRequest { - // Required. Name of the organization to run asset discovery for. Its format is - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; -} - -// Request message for updating or creating a finding. -message UpdateFindingRequest { - // Required. The finding resource to update or create if it does not already exist. - // parent, security_marks, and update_time will be ignored. - // - // In the case of creation, the finding id portion of the name must - // alphanumeric and less than or equal to 32 characters and greater than 0 - // characters in length. - Finding finding = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the finding resource. This field should - // not be specified when creating a finding. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating an organization's settings. -message UpdateOrganizationSettingsRequest { - // Required. The organization settings resource to update. - OrganizationSettings organization_settings = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the settings resource. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a source. -message UpdateSourceRequest { - // Required. The source resource to update. - Source source = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the source resource. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a SecurityMarks resource. -message UpdateSecurityMarksRequest { - // Required. The security marks resource to update. - SecurityMarks security_marks = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the security marks resource. - google.protobuf.FieldMask update_mask = 2; - - // The time at which the updated SecurityMarks take effect. - google.protobuf.Timestamp start_time = 3; -} diff --git a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto b/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto deleted file mode 100644 index fb1e6c6a..00000000 --- a/owl-bot-staging/v1beta1/protos/google/cloud/securitycenter/v1beta1/source.proto +++ /dev/null @@ -1,56 +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.securitycenter.v1beta1; - -import "google/api/resource.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1beta1"; - -// Security Command Center finding source. A finding source -// is an entity or a mechanism that can produce a finding. A source is like a -// container of findings that come from the same scanner, logger, monitor, etc. -message Source { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Source" - pattern: "organizations/{organization}/sources/{source}" - }; - - // The relative resource name of this source. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}" - string name = 1; - - // The source's display name. - // A source's display name must be unique amongst its siblings, for example, - // two sources with the same parent can't share the same display name. - // The display name must have a length between 1 and 64 characters - // (inclusive). - string display_name = 2; - - // The description of the source (max of 1024 characters). - // Example: - // "Web Security Scanner is a web security scanner for common - // vulnerabilities in App Engine applications. It can automatically - // scan and detect four common vulnerabilities, including cross-site-scripting - // (XSS), Flash injection, mixed content (HTTP in HTTPS), and - // outdated/insecure libraries." - string description = 3; -} diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_finding.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_finding.js deleted file mode 100644 index 90289ca8..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_finding.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, findingId, finding) { - // [START securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new finding's parent. Its format should be - * "organizations/[organization_id]/sources/[source_id]". - */ - // const parent = 'abc123' - /** - * Required. Unique identifier provided by the client within the parent scope. - * It must be alphanumeric and less than or equal to 32 characters and - * greater than 0 characters in length. - */ - // const findingId = 'abc123' - /** - * Required. The Finding being created. The name and security_marks will be ignored as - * they are both output only fields on this resource. - */ - // const finding = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateFinding() { - // Construct request - const request = { - parent, - findingId, - finding, - }; - - // Run request - const response = await securitycenterClient.createFinding(request); - console.log(response); - } - - callCreateFinding(); - // [END securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_source.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_source.js deleted file mode 100644 index 9342a0f9..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_source.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, source) { - // [START securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new source's parent. Its format should be - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * Required. The Source being created, only the display_name and description will be - * used. All other fields will be ignored. - */ - // const source = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateSource() { - // Construct request - const request = { - parent, - source, - }; - - // Run request - const response = await securitycenterClient.createSource(request); - console.log(response); - } - - callCreateSource(); - // [END securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js deleted file mode 100644 index 9bdfa2c4..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(resource) { - // [START securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - */ - // const options = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await securitycenterClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js deleted file mode 100644 index 7862db8d..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to get organization settings for. Its format is - * "organizations/[organization_id]/organizationSettings". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetOrganizationSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getOrganizationSettings(request); - console.log(response); - } - - callGetOrganizationSettings(); - // [END securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_source.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_source.js deleted file mode 100644 index 47f895c3..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_source.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START securitycenter_v1beta1_generated_SecurityCenter_GetSource_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Relative resource name of the source. Its format is - * "organizations/[organization_id]/source/[source_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetSource() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getSource(request); - console.log(response); - } - - callGetSource(); - // [END securitycenter_v1beta1_generated_SecurityCenter_GetSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_assets.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_assets.js deleted file mode 100644 index 59edb045..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_assets.js +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, groupBy) { - // [START securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * The supported operators are: - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * The supported value types are: - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * For example, `resource_properties.size = 100` is a valid filter string. - */ - // const filter = 'abc123' - /** - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * The following fields are supported when compare_duration is not set: - * * security_center_properties.resource_project - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * The following fields are supported when compare_duration is set: - * * security_center_properties.resource_type - */ - // const groupBy = 'abc123' - /** - * When compare_duration is set, the Asset's "state" property is updated to - * indicate whether the asset was added, removed, or remained present during - * the compare_duration period of time that precedes the read_time. This is - * the time between (read_time - compare_duration) and read_time. - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * Possible "state" values when compare_duration is specified: - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * This field is ignored if `state` is not a field in `group_by`. - */ - // const compareDuration = {} - /** - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - */ - // const readTime = {} - /** - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGroupAssets() { - // Construct request - const request = { - parent, - groupBy, - }; - - // Run request - const iterable = await securitycenterClient.groupAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGroupAssets(); - // [END securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_findings.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_findings.js deleted file mode 100644 index 4818c6cd..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_findings.js +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, groupBy) { - // [START securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]". To groupBy across - * all sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * The supported operators are: - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * The supported value types are: - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * For example, `source_properties.size = 100` is a valid filter string. - */ - // const filter = 'abc123' - /** - * Required. Expression that defines what assets fields to use for grouping (including - * `state`). The string value should follow SQL syntax: comma separated list - * of fields. For example: - * "parent,resource_name". - * The following fields are supported: - * * resource_name - * * category - * * state - * * parent - */ - // const groupBy = 'abc123' - /** - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - */ - // const readTime = {} - /** - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGroupFindings() { - // Construct request - const request = { - parent, - groupBy, - }; - - // Run request - const iterable = await securitycenterClient.groupFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGroupFindings(); - // [END securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_assets.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_assets.js deleted file mode 100644 index dcfd98b9..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_assets.js +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * The supported operators are: - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * The supported value types are: - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * For example, `resource_properties.size = 100` is a valid filter string. - */ - // const filter = 'abc123' - /** - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - */ - // const orderBy = 'abc123' - /** - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the ListAssetResult's "state" attribute is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - - * compare_duration) and read_time. - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * Possible "state" values when compare_duration is specified: - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * If compare_duration is not specified, then the only possible state is - * "UNUSED", which indicates that the asset is present at read_time. - */ - // const compareDuration = {} - /** - * Optional. A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - */ - // const fieldMask = {} - /** - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListAssets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAssets(); - // [END securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_findings.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_findings.js deleted file mode 100644 index b1212693..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_findings.js +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id]". To list across all - * sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * The supported operators are: - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * The supported value types are: - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * For example, `source_properties.size = 100` is a valid filter string. - */ - // const filter = 'abc123' - /** - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - */ - // const orderBy = 'abc123' - /** - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - */ - // const readTime = {} - /** - * Optional. A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - */ - // const fieldMask = {} - /** - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListFindings() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFindings(); - // [END securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_sources.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_sources.js deleted file mode 100644 index e3722e67..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_sources.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1beta1_generated_SecurityCenter_ListSources_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListSources() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listSourcesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSources(); - // [END securitycenter_v1beta1_generated_SecurityCenter_ListSources_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js deleted file mode 100644 index beed664c..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to run asset discovery for. Its format is - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callRunAssetDiscovery() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await securitycenterClient.runAssetDiscovery(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRunAssetDiscovery(); - // [END securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js deleted file mode 100644 index db0cea43..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name, state, startTime) { - // [START securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the finding. See: - * https://cloud.google.com/apis/design/resource_names#relative_resource_name - * Example: - * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - */ - // const name = 'abc123' - /** - * Required. The desired State of the finding. - */ - // const state = {} - /** - * Required. The time at which the updated state takes effect. - */ - // const startTime = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetFindingState() { - // Construct request - const request = { - name, - state, - startTime, - }; - - // Run request - const response = await securitycenterClient.setFindingState(request); - console.log(response); - } - - callSetFindingState(); - // [END securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js deleted file mode 100644 index 458ee483..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(resource, policy) { - // [START securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - */ - // const policy = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await securitycenterClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js deleted file mode 100644 index fbb5ee1f..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(resource, permissions) { - // [START securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). - */ - // const permissions = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await securitycenterClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_finding.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_finding.js deleted file mode 100644 index 5f0e87ad..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_finding.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(finding) { - // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The finding resource to update or create if it does not already exist. - * parent, security_marks, and update_time will be ignored. - * In the case of creation, the finding id portion of the name must - * alphanumeric and less than or equal to 32 characters and greater than 0 - * characters in length. - */ - // const finding = {} - /** - * The FieldMask to use when updating the finding resource. This field should - * not be specified when creating a finding. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateFinding() { - // Construct request - const request = { - finding, - }; - - // Run request - const response = await securitycenterClient.updateFinding(request); - console.log(response); - } - - callUpdateFinding(); - // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js deleted file mode 100644 index 6519c222..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(organizationSettings) { - // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The organization settings resource to update. - */ - // const organizationSettings = {} - /** - * The FieldMask to use when updating the settings resource. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateOrganizationSettings() { - // Construct request - const request = { - organizationSettings, - }; - - // Run request - const response = await securitycenterClient.updateOrganizationSettings(request); - console.log(response); - } - - callUpdateOrganizationSettings(); - // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js deleted file mode 100644 index 366bfa38..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(securityMarks) { - // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The security marks resource to update. - */ - // const securityMarks = {} - /** - * The FieldMask to use when updating the security marks resource. - */ - // const updateMask = {} - /** - * The time at which the updated SecurityMarks take effect. - */ - // const startTime = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateSecurityMarks() { - // Construct request - const request = { - securityMarks, - }; - - // Run request - const response = await securitycenterClient.updateSecurityMarks(request); - console.log(response); - } - - callUpdateSecurityMarks(); - // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_source.js b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_source.js deleted file mode 100644 index cba6870c..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_source.js +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(source) { - // [START securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The source resource to update. - */ - // const source = {} - /** - * The FieldMask to use when updating the source resource. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateSource() { - // Construct request - const request = { - source, - }; - - // Run request - const response = await securitycenterClient.updateSource(request); - console.log(response); - } - - callUpdateSource(); - // [END securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts deleted file mode 100644 index 0cb6dc5e..00000000 --- a/owl-bot-staging/v1beta1/src/index.ts +++ /dev/null @@ -1,25 +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. -// -// ** 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 v1beta1 from './v1beta1'; -const SecurityCenterClient = v1beta1.SecurityCenterClient; -type SecurityCenterClient = v1beta1.SecurityCenterClient; -export {v1beta1, SecurityCenterClient}; -export default {v1beta1, SecurityCenterClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json deleted file mode 100644 index 02da4303..00000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,223 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.securitycenter.v1beta1", - "libraryPackage": "@google-cloud/security-center", - "services": { - "SecurityCenter": { - "clients": { - "grpc": { - "libraryClient": "SecurityCenterClient", - "rpcs": { - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "CreateFinding": { - "methods": [ - "createFinding" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SecurityCenterClient", - "rpcs": { - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "CreateFinding": { - "methods": [ - "createFinding" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/index.ts b/owl-bot-staging/v1beta1/src/v1beta1/index.ts deleted file mode 100644 index de26020d..00000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/index.ts +++ /dev/null @@ -1,19 +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. -// -// ** 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 {SecurityCenterClient} from './security_center_client'; diff --git a/owl-bot-staging/v1beta1/src/v1beta1/security_center_client.ts b/owl-bot-staging/v1beta1/src/v1beta1/security_center_client.ts deleted file mode 100644 index f6bfb08c..00000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/security_center_client.ts +++ /dev/null @@ -1,3248 +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. -// -// ** 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, LROperation, 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/v1beta1/security_center_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './security_center_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * V1 Beta APIs for Security Center service. - * @class - * @memberof v1beta1 - */ -export class SecurityCenterClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - securityCenterStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SecurityCenterClient. - * - * @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). - * 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} [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. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SecurityCenterClient; - 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 = { - assetPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/assets/{asset}' - ), - findingPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}' - ), - organizationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}' - ), - organizationAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/assets/{asset}/securityMarks' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/organizationSettings' - ), - organizationSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' - ), - sourcePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}' - ), - }; - - // 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 = { - groupAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), - groupFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), - listAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listAssetsResults'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings'), - listSources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const runAssetDiscoveryResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const runAssetDiscoveryMetadata = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - - this.descriptors.longrunning = { - runAssetDiscovery: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), - runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.securitycenter.v1beta1.SecurityCenter', 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.securityCenterStub) { - return this.securityCenterStub; - } - - // Put together the "service stub" for - // google.cloud.securitycenter.v1beta1.SecurityCenter. - this.securityCenterStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.securitycenter.v1beta1.SecurityCenter') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.securitycenter.v1beta1.SecurityCenter, - 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 securityCenterStubMethods = - ['createSource', 'createFinding', 'getIamPolicy', 'getOrganizationSettings', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listFindings', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setIamPolicy', 'testIamPermissions', 'updateFinding', 'updateOrganizationSettings', 'updateSource', 'updateSecurityMarks']; - for (const methodName of securityCenterStubMethods) { - const callPromise = this.securityCenterStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.securityCenterStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'securitycenter.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 'securitycenter.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 source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new source's parent. Its format should be - * "organizations/[organization_id]". - * @param {google.cloud.securitycenter.v1beta1.Source} request.source - * Required. The Source being created, only the display_name and description will be - * used. All other fields will be ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Source]{@link google.cloud.securitycenter.v1beta1.Source}. - * 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/v1beta1/security_center.create_source.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async - */ - createSource( - request?: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|undefined, {}|undefined - ]>; - createSource( - request: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): void; - createSource( - request: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): void; - createSource( - request?: protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.ICreateSourceRequest|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.createSource(request, options, callback); - } -/** - * Creates a finding. The corresponding source must exist for finding creation - * to succeed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new finding's parent. Its format should be - * "organizations/[organization_id]/sources/[source_id]". - * @param {string} request.findingId - * Required. Unique identifier provided by the client within the parent scope. - * It must be alphanumeric and less than or equal to 32 characters and - * greater than 0 characters in length. - * @param {google.cloud.securitycenter.v1beta1.Finding} request.finding - * Required. The Finding being created. The name and security_marks will be ignored as - * they are both output only fields on this resource. - * @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.securitycenter.v1beta1.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/v1beta1/security_center.create_finding.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async - */ - createFinding( - request?: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|undefined, {}|undefined - ]>; - createFinding( - request: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): void; - createFinding( - request: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): void; - createFinding( - request?: protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ICreateFindingRequest|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.createFinding(request, options, callback); - } -/** - * Gets the access control policy on the specified Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * @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 [Policy]{@link google.iam.v1.Policy}. - * 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/v1beta1/security_center.get_iam_policy.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|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({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.getIamPolicy(request, options, callback); - } -/** - * Gets the settings for an organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the organization to get organization settings for. Its format is - * "organizations/[organization_id]/organizationSettings". - * @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 [OrganizationSettings]{@link google.cloud.securitycenter.v1beta1.OrganizationSettings}. - * 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/v1beta1/security_center.get_organization_settings.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async - */ - getOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|undefined, {}|undefined - ]>; - getOrganizationSettings( - request: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - getOrganizationSettings( - request: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - getOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IGetOrganizationSettingsRequest|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.getOrganizationSettings(request, options, callback); - } -/** - * Gets a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Relative resource name of the source. Its format is - * "organizations/[organization_id]/source/[source_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Source]{@link google.cloud.securitycenter.v1beta1.Source}. - * 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/v1beta1/security_center.get_source.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GetSource_async - */ - getSource( - request?: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|undefined, {}|undefined - ]>; - getSource( - request: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request?: protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IGetSourceRequest|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.getSource(request, options, callback); - } -/** - * Updates the state of a finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the finding. See: - * https://cloud.google.com/apis/design/resource_names#relative_resource_name - * Example: - * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - * @param {google.cloud.securitycenter.v1beta1.Finding.State} request.state - * Required. The desired State of the finding. - * @param {google.protobuf.Timestamp} request.startTime - * Required. The time at which the updated state takes effect. - * @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.securitycenter.v1beta1.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/v1beta1/security_center.set_finding_state.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async - */ - setFindingState( - request?: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|undefined, {}|undefined - ]>; - setFindingState( - request: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): void; - setFindingState( - request: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): void; - setFindingState( - request?: protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.ISetFindingStateRequest|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.setFindingState(request, options, callback); - } -/** - * Sets the access control policy on the specified Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @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 [Policy]{@link google.iam.v1.Policy}. - * 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/v1beta1/security_center.set_iam_policy.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async - */ - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|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({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.setIamPolicy(request, options, callback); - } -/** - * Returns the permissions that a caller has on the specified source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * 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/v1beta1/security_center.test_iam_permissions.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async - */ - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|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({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.testIamPermissions(request, options, callback); - } -/** - * Creates or updates a finding. The corresponding source must exist for a - * finding creation to succeed. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1beta1.Finding} request.finding - * Required. The finding resource to update or create if it does not already exist. - * parent, security_marks, and update_time will be ignored. - * - * In the case of creation, the finding id portion of the name must - * alphanumeric and less than or equal to 32 characters and greater than 0 - * characters in length. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the finding resource. This field should - * not be specified when creating a finding. - * @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.securitycenter.v1beta1.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/v1beta1/security_center.update_finding.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async - */ - updateFinding( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|undefined, {}|undefined - ]>; - updateFinding( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): void; - updateFinding( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): void; - updateFinding( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding, - protos.google.cloud.securitycenter.v1beta1.IUpdateFindingRequest|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({ - 'finding.name': request.finding!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateFinding(request, options, callback); - } -/** - * Updates an organization's settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1beta1.OrganizationSettings} request.organizationSettings - * Required. The organization settings resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the settings resource. - * @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 [OrganizationSettings]{@link google.cloud.securitycenter.v1beta1.OrganizationSettings}. - * 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/v1beta1/security_center.update_organization_settings.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async - */ - updateOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined - ]>; - updateOrganizationSettings( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateOrganizationSettings( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1beta1.IUpdateOrganizationSettingsRequest|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({ - 'organization_settings.name': request.organizationSettings!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateOrganizationSettings(request, options, callback); - } -/** - * Updates a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1beta1.Source} request.source - * Required. The source resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the source resource. - * @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 [Source]{@link google.cloud.securitycenter.v1beta1.Source}. - * 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/v1beta1/security_center.update_source.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async - */ - updateSource( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|undefined, {}|undefined - ]>; - updateSource( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): void; - updateSource( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): void; - updateSource( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource, - protos.google.cloud.securitycenter.v1beta1.IUpdateSourceRequest|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({ - 'source.name': request.source!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateSource(request, options, callback); - } -/** - * Updates security marks. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1beta1.SecurityMarks} request.securityMarks - * Required. The security marks resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the security marks resource. - * @param {google.protobuf.Timestamp} request.startTime - * The time at which the updated SecurityMarks take effect. - * @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 [SecurityMarks]{@link google.cloud.securitycenter.v1beta1.SecurityMarks}. - * 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/v1beta1/security_center.update_security_marks.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async - */ - updateSecurityMarks( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|undefined, {}|undefined - ]>; - updateSecurityMarks( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityMarks( - request: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityMarks( - request?: protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1beta1.IUpdateSecurityMarksRequest|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({ - 'security_marks.name': request.securityMarks!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateSecurityMarks(request, options, callback); - } - -/** - * Runs asset discovery. The discovery is tracked with a long-running - * operation. - * - * This API can only be called with limited frequency for an organization. If - * it is called too frequently the caller will receive a TOO_MANY_REQUESTS - * error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to run asset discovery for. Its format is - * "organizations/[organization_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.run_asset_discovery.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async - */ - runAssetDiscovery( - request?: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runAssetDiscovery( - request: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runAssetDiscovery( - request: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runAssetDiscovery( - request?: protos.google.cloud.securitycenter.v1beta1.IRunAssetDiscoveryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.runAssetDiscovery(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runAssetDiscovery()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1beta1/security_center.run_asset_discovery.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async - */ - async checkRunAssetDiscoveryProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.runAssetDiscovery, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Filters an organization's assets and groups them by their specified - * properties. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * For example, `resource_properties.size = 100` is a valid filter string. - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the Asset's "state" property is updated to - * indicate whether the asset was added, removed, or remained present during - * the compare_duration period of time that precedes the read_time. This is - * the time between (read_time - compare_duration) and read_time. - * - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * This field is ignored if `state` is not a field in `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [GroupResult]{@link google.cloud.securitycenter.v1beta1.GroupResult}. - * 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 `groupAssetsAsync()` - * 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. - */ - groupAssets( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse - ]>; - groupAssets( - request: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; - groupAssets( - request: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; - groupAssets( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IGroupAssetsResponse - ]>|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.groupAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * For example, `resource_properties.size = 100` is a valid filter string. - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the Asset's "state" property is updated to - * indicate whether the asset was added, removed, or remained present during - * the compare_duration period of time that precedes the read_time. This is - * the time between (read_time - compare_duration) and read_time. - * - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * This field is ignored if `state` is not a field in `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [GroupResult]{@link google.cloud.securitycenter.v1beta1.GroupResult} 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 `groupAssetsAsync()` - * 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. - */ - groupAssetsStream( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - 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['groupAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupAssets.createStream( - this.innerApiCalls.groupAssets as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `groupAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * For example, `resource_properties.size = 100` is a valid filter string. - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the Asset's "state" property is updated to - * indicate whether the asset was added, removed, or remained present during - * the compare_duration period of time that precedes the read_time. This is - * the time between (read_time - compare_duration) and read_time. - * - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * This field is ignored if `state` is not a field in `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [GroupResult]{@link google.cloud.securitycenter.v1beta1.GroupResult}. 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/v1beta1/security_center.group_assets.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async - */ - groupAssetsAsync( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupAssetsRequest, - 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['groupAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupAssets.asyncIterate( - this.innerApiCalls['groupAssets'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Filters an organization or source's findings and groups them by their - * specified properties. - * - * To group across all sources provide a `-` as the source id. - * Example: /v1beta1/organizations/{organization_id}/sources/-/findings - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]". To groupBy across - * all sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * For example, `source_properties.size = 100` is a valid filter string. - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state`). The string value should follow SQL syntax: comma separated list - * of fields. For example: - * "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [GroupResult]{@link google.cloud.securitycenter.v1beta1.GroupResult}. - * 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 `groupFindingsAsync()` - * 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. - */ - groupFindings( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse - ]>; - groupFindings( - request: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; - groupFindings( - request: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>): void; - groupFindings( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IGroupResult>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IGroupFindingsResponse - ]>|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.groupFindings(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]". To groupBy across - * all sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * For example, `source_properties.size = 100` is a valid filter string. - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state`). The string value should follow SQL syntax: comma separated list - * of fields. For example: - * "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [GroupResult]{@link google.cloud.securitycenter.v1beta1.GroupResult} 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 `groupFindingsAsync()` - * 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. - */ - groupFindingsStream( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - 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['groupFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupFindings.createStream( - this.innerApiCalls.groupFindings as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `groupFindings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]". To groupBy across - * all sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * For example, `source_properties.size = 100` is a valid filter string. - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state`). The string value should follow SQL syntax: comma separated list - * of fields. For example: - * "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [GroupResult]{@link google.cloud.securitycenter.v1beta1.GroupResult}. 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/v1beta1/security_center.group_findings.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async - */ - groupFindingsAsync( - request?: protos.google.cloud.securitycenter.v1beta1.IGroupFindingsRequest, - 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['groupFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupFindings.asyncIterate( - this.innerApiCalls['groupFindings'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists an organization's assets. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * For example, `resource_properties.size = 100` is a valid filter string. - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetResult's "state" attribute is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - - * compare_duration) and read_time. - * - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state is - * "UNUSED", which indicates that the asset is present at read_time. - * @param {google.protobuf.FieldMask} [request.fieldMask] - * Optional. A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [ListAssetsResult]{@link google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssets( - request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[], - protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse - ]>; - listAssets( - request: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>): void; - listAssets( - request: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>): void; - listAssets( - request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[], - protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IListAssetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * For example, `resource_properties.size = 100` is a valid filter string. - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetResult's "state" attribute is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - - * compare_duration) and read_time. - * - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state is - * "UNUSED", which indicates that the asset is present at read_time. - * @param {google.protobuf.FieldMask} [request.fieldMask] - * Optional. A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [ListAssetsResult]{@link google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssetsStream( - request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.createStream( - this.innerApiCalls.listAssets as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * For example, `resource_properties.size = 100` is a valid filter string. - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetResult's "state" attribute is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - - * compare_duration) and read_time. - * - * The state value is derived based on the presence of the asset at the two - * points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present before - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state is - * "UNUSED", which indicates that the asset is present at read_time. - * @param {google.protobuf.FieldMask} [request.fieldMask] - * Optional. A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [ListAssetsResult]{@link google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult}. 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/v1beta1/security_center.list_assets.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async - */ - listAssetsAsync( - request?: protos.google.cloud.securitycenter.v1beta1.IListAssetsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.asyncIterate( - this.innerApiCalls['listAssets'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists an organization or source's findings. - * - * To list across all sources provide a `-` as the source id. - * Example: /v1beta1/organizations/{organization_id}/sources/-/findings - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id]". To list across all - * sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * For example, `source_properties.size = 100` is a valid filter string. - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.FieldMask} [request.fieldMask] - * Optional. A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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.securitycenter.v1beta1.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.securitycenter.v1beta1.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding[], - protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest|null, - protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse - ]>; - listFindings( - request: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IFinding>): void; - listFindings( - request: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IFinding>): void; - listFindings( - request?: protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IFinding>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.IFinding>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.IFinding[], - protos.google.cloud.securitycenter.v1beta1.IListFindingsRequest|null, - protos.google.cloud.securitycenter.v1beta1.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. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id]". To list across all - * sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * For example, `source_properties.size = 100` is a valid filter string. - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.FieldMask} [request.fieldMask] - * Optional. A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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.securitycenter.v1beta1.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.securitycenter.v1beta1.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. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id]". To list across all - * sources provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are not supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * For example, `source_properties.size = 100` is a valid filter string. - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.FieldMask} [request.fieldMask] - * Optional. A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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.securitycenter.v1beta1.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/v1beta1/security_center.list_findings.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async - */ - listFindingsAsync( - request?: protos.google.cloud.securitycenter.v1beta1.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; - } - /** - * Lists all sources belonging to an organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [Source]{@link google.cloud.securitycenter.v1beta1.Source}. - * 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 `listSourcesAsync()` - * 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. - */ - listSources( - request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource[], - protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest|null, - protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse - ]>; - listSources( - request: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ISource>): void; - listSources( - request: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ISource>): void; - listSources( - request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ISource>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1beta1.ISource>): - Promise<[ - protos.google.cloud.securitycenter.v1beta1.ISource[], - protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest|null, - protos.google.cloud.securitycenter.v1beta1.IListSourcesResponse - ]>|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.listSources(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. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [Source]{@link google.cloud.securitycenter.v1beta1.Source} 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 `listSourcesAsync()` - * 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. - */ - listSourcesStream( - request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - 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['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.createStream( - this.innerApiCalls.listSources as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSources`, 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. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [Source]{@link google.cloud.securitycenter.v1beta1.Source}. 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/v1beta1/security_center.list_sources.js - * region_tag:securitycenter_v1beta1_generated_SecurityCenter_ListSources_async - */ - listSourcesAsync( - request?: protos.google.cloud.securitycenter.v1beta1.IListSourcesRequest, - 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['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.asyncIterate( - this.innerApiCalls['listSources'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified asset resource name string. - * - * @param {string} organization - * @param {string} asset - * @returns {string} Resource name string. - */ - assetPath(organization:string,asset:string) { - return this.pathTemplates.assetPathTemplate.render({ - organization: organization, - asset: asset, - }); - } - - /** - * Parse the organization from Asset resource. - * - * @param {string} assetName - * A fully-qualified path representing Asset resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromAssetName(assetName: string) { - return this.pathTemplates.assetPathTemplate.match(assetName).organization; - } - - /** - * Parse the asset from Asset resource. - * - * @param {string} assetName - * A fully-qualified path representing Asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromAssetName(assetName: string) { - return this.pathTemplates.assetPathTemplate.match(assetName).asset; - } - - /** - * Return a fully-qualified finding resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - findingPath(organization:string,source:string,finding:string) { - return this.pathTemplates.findingPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - }); - } - - /** - * Parse the organization from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).organization; - } - - /** - * Parse the source from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).source; - } - - /** - * 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 organization resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationPath(organization:string) { - return this.pathTemplates.organizationPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from Organization resource. - * - * @param {string} organizationName - * A fully-qualified path representing Organization resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationName(organizationName: string) { - return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; - } - - /** - * Return a fully-qualified organizationAssetSecurityMarks resource name string. - * - * @param {string} organization - * @param {string} asset - * @returns {string} Resource name string. - */ - organizationAssetSecurityMarksPath(organization:string,asset:string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.render({ - organization: organization, - asset: asset, - }); - } - - /** - * Parse the organization from OrganizationAssetSecurityMarks resource. - * - * @param {string} organizationAssetSecurityMarksName - * A fully-qualified path representing organization_asset_securityMarks resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).organization; - } - - /** - * Parse the asset from OrganizationAssetSecurityMarks resource. - * - * @param {string} organizationAssetSecurityMarksName - * A fully-qualified path representing organization_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing OrganizationSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSourceFindingSecurityMarks resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - organizationSourceFindingSecurityMarksPath(organization:string,source:string,finding:string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - }); - } - - /** - * Parse the organization from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).organization; - } - - /** - * Parse the source from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).finding; - } - - /** - * Return a fully-qualified source resource name string. - * - * @param {string} organization - * @param {string} source - * @returns {string} Resource name string. - */ - sourcePath(organization:string,source:string) { - return this.pathTemplates.sourcePathTemplate.render({ - organization: organization, - source: source, - }); - } - - /** - * Parse the organization from Source resource. - * - * @param {string} sourceName - * A fully-qualified path representing Source resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromSourceName(sourceName: string) { - return this.pathTemplates.sourcePathTemplate.match(sourceName).organization; - } - - /** - * Parse the source from Source resource. - * - * @param {string} sourceName - * A fully-qualified path representing Source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromSourceName(sourceName: string) { - return this.pathTemplates.sourcePathTemplate.match(sourceName).source; - } - - /** - * 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 { - this.initialize(); - if (!this._terminated) { - return this.securityCenterStub!.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/security_center_client_config.json b/owl-bot-staging/v1beta1/src/v1beta1/security_center_client_config.json deleted file mode 100644 index a1a7e2d9..00000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/security_center_client_config.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "interfaces": { - "google.cloud.securitycenter.v1beta1.SecurityCenter": { - "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": { - "CreateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetOrganizationSettings": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetSource": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GroupAssets": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GroupFindings": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListAssets": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindings": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListSources": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "RunAssetDiscovery": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetFindingState": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateFinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateOrganizationSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSecurityMarks": { - "timeout_millis": 480000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1beta1/src/v1beta1/security_center_proto_list.json b/owl-bot-staging/v1beta1/src/v1beta1/security_center_proto_list.json deleted file mode 100644 index d10dce6c..00000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/security_center_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/cloud/securitycenter/v1beta1/asset.proto", - "../../protos/google/cloud/securitycenter/v1beta1/finding.proto", - "../../protos/google/cloud/securitycenter/v1beta1/organization_settings.proto", - "../../protos/google/cloud/securitycenter/v1beta1/run_asset_discovery_response.proto", - "../../protos/google/cloud/securitycenter/v1beta1/security_marks.proto", - "../../protos/google/cloud/securitycenter/v1beta1/securitycenter_service.proto", - "../../protos/google/cloud/securitycenter/v1beta1/source.proto" -] diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 37333715..00000000 --- a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +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. -// -// ** 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 securitycenter = require('@google-cloud/security-center'); - -function main() { - const securityCenterClient = new securitycenter.SecurityCenterClient(); -} - -main(); diff --git a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index b4153c94..00000000 --- a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +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. -// -// ** 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 {SecurityCenterClient} from '@google-cloud/security-center'; - -// check that the client class type name can be used -function doStuffWithSecurityCenterClient(client: SecurityCenterClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const securityCenterClient = new SecurityCenterClient(); - doStuffWithSecurityCenterClient(securityCenterClient); -} - -main(); diff --git a/owl-bot-staging/v1beta1/system-test/install.ts b/owl-bot-staging/v1beta1/system-test/install.ts deleted file mode 100644 index 1f850b52..00000000 --- a/owl-bot-staging/v1beta1/system-test/install.ts +++ /dev/null @@ -1,49 +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. -// -// ** 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/v1beta1/test/gapic_security_center_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_security_center_v1beta1.ts deleted file mode 100644 index 539e3123..00000000 --- a/owl-bot-staging/v1beta1/test/gapic_security_center_v1beta1.ts +++ /dev/null @@ -1,2731 +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. -// -// ** 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 securitycenterModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.SecurityCenterClient', () => { - it('has servicePath', () => { - const servicePath = securitycenterModule.v1beta1.SecurityCenterClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = securitycenterModule.v1beta1.SecurityCenterClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = securitycenterModule.v1beta1.SecurityCenterClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.securityCenterStub, undefined); - await client.initialize(); - assert(client.securityCenterStub); - }); - - it('has close method', () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - 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 securitycenterModule.v1beta1.SecurityCenterClient({ - 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('createSource', () => { - it('invokes createSource without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()); - client.innerApiCalls.createSource = stubSimpleCall(expectedResponse); - const [response] = await client.createSource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createSource without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()); - client.innerApiCalls.createSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createSource with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.CreateSourceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSource(request), expectedError); - assert((client.innerApiCalls.createSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createFinding', () => { - it('invokes createFinding without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()); - client.innerApiCalls.createFinding = stubSimpleCall(expectedResponse); - const [response] = await client.createFinding(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createFinding without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()); - client.innerApiCalls.createFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFinding( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createFinding with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.CreateFindingRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createFinding(request), expectedError); - assert((client.innerApiCalls.createFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getOrganizationSettings', () => { - it('invokes getOrganizationSettings without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings()); - client.innerApiCalls.getOrganizationSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getOrganizationSettings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getOrganizationSettings without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings()); - client.innerApiCalls.getOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getOrganizationSettings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getOrganizationSettings with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GetOrganizationSettingsRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getOrganizationSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getOrganizationSettings(request), expectedError); - assert((client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getSource', () => { - it('invokes getSource without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()); - client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); - const [response] = await client.getSource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSource without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()); - client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getSource with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GetSourceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSource(request), expectedError); - assert((client.innerApiCalls.getSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('setFindingState', () => { - it('invokes setFindingState without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()); - client.innerApiCalls.setFindingState = stubSimpleCall(expectedResponse); - const [response] = await client.setFindingState(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setFindingState without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()); - client.innerApiCalls.setFindingState = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setFindingState( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes setFindingState with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.SetFindingStateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setFindingState = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setFindingState(request), expectedError); - assert((client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes testIamPermissions with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateFinding', () => { - it('invokes updateFinding without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest()); - request.finding = {}; - request.finding.name = ''; - const expectedHeaderRequestParams = "finding.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()); - client.innerApiCalls.updateFinding = stubSimpleCall(expectedResponse); - const [response] = await client.updateFinding(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateFinding without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest()); - request.finding = {}; - request.finding.name = ''; - const expectedHeaderRequestParams = "finding.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()); - client.innerApiCalls.updateFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFinding( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateFinding with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateFindingRequest()); - request.finding = {}; - request.finding.name = ''; - const expectedHeaderRequestParams = "finding.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFinding(request), expectedError); - assert((client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateOrganizationSettings', () => { - it('invokes updateOrganizationSettings without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest()); - request.organizationSettings = {}; - request.organizationSettings.name = ''; - const expectedHeaderRequestParams = "organization_settings.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings()); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateOrganizationSettings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateOrganizationSettings without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest()); - request.organizationSettings = {}; - request.organizationSettings.name = ''; - const expectedHeaderRequestParams = "organization_settings.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.OrganizationSettings()); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateOrganizationSettings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IOrganizationSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateOrganizationSettings with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateOrganizationSettingsRequest()); - request.organizationSettings = {}; - request.organizationSettings.name = ''; - const expectedHeaderRequestParams = "organization_settings.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateOrganizationSettings(request), expectedError); - assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateSource', () => { - it('invokes updateSource without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest()); - request.source = {}; - request.source.name = ''; - const expectedHeaderRequestParams = "source.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()); - client.innerApiCalls.updateSource = stubSimpleCall(expectedResponse); - const [response] = await client.updateSource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSource without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest()); - request.source = {}; - request.source.name = ''; - const expectedHeaderRequestParams = "source.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()); - client.innerApiCalls.updateSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateSource with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateSourceRequest()); - request.source = {}; - request.source.name = ''; - const expectedHeaderRequestParams = "source.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSource(request), expectedError); - assert((client.innerApiCalls.updateSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateSecurityMarks', () => { - it('invokes updateSecurityMarks without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest()); - request.securityMarks = {}; - request.securityMarks.name = ''; - const expectedHeaderRequestParams = "security_marks.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.SecurityMarks()); - client.innerApiCalls.updateSecurityMarks = stubSimpleCall(expectedResponse); - const [response] = await client.updateSecurityMarks(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSecurityMarks without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest()); - request.securityMarks = {}; - request.securityMarks.name = ''; - const expectedHeaderRequestParams = "security_marks.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.SecurityMarks()); - client.innerApiCalls.updateSecurityMarks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSecurityMarks( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISecurityMarks|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateSecurityMarks with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.UpdateSecurityMarksRequest()); - request.securityMarks = {}; - request.securityMarks.name = ''; - const expectedHeaderRequestParams = "security_marks.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityMarks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSecurityMarks(request), expectedError); - assert((client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('runAssetDiscovery', () => { - it('invokes runAssetDiscovery without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(expectedResponse); - const [operation] = await client.runAssetDiscovery(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes runAssetDiscovery without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runAssetDiscovery( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes runAssetDiscovery with call error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runAssetDiscovery(request), expectedError); - assert((client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes runAssetDiscovery with LRO error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.RunAssetDiscoveryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runAssetDiscovery(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkRunAssetDiscoveryProgress without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRunAssetDiscoveryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunAssetDiscoveryProgress with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRunAssetDiscoveryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('groupAssets', () => { - it('invokes groupAssets without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.innerApiCalls.groupAssets = stubSimpleCall(expectedResponse); - const [response] = await client.groupAssets(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes groupAssets without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.innerApiCalls.groupAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.groupAssets( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IGroupResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes groupAssets with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.groupAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.groupAssets(request), expectedError); - assert((client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes groupAssetsStream without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.groupAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { - 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.groupAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); - assert.strictEqual( - (client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes groupAssetsStream with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.groupAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); - assert.strictEqual( - (client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with groupAssets without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; - const iterable = client.groupAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with groupAssets with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.groupAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('groupFindings', () => { - it('invokes groupFindings without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.innerApiCalls.groupFindings = stubSimpleCall(expectedResponse); - const [response] = await client.groupFindings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes groupFindings without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.innerApiCalls.groupFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.groupFindings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.IGroupResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes groupFindings with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.groupFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.groupFindings(request), expectedError); - assert((client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes groupFindingsStream without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.groupFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { - 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.groupFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); - assert.strictEqual( - (client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes groupFindingsStream with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.groupFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); - assert.strictEqual( - (client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with groupFindings without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupResult()), - ]; - client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; - const iterable = client.groupFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with groupFindings with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.groupFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1beta1.IGroupResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listAssets', () => { - it('invokes listAssets without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); - const [response] = await client.listAssets(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAssets without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAssets( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listAssets with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAssets(request), expectedError); - assert((client.innerApiCalls.listAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAssetsStream without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert.strictEqual( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listAssetsStream with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert.strictEqual( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAssets without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[] = []; - const iterable = client.listAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAssets with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1beta1.ListAssetsResponse.IListAssetsResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAssets.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 securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.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 securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.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 securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.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 securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.Finding[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.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 securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.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.securitycenter.v1beta1.Finding[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.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 securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Finding()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1beta1.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 securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.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.securitycenter.v1beta1.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('listSources', () => { - it('invokes listSources without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); - const [response] = await client.listSources(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSources as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSources without error using callback', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSources( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1beta1.ISource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSources as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listSources with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSources(request), expectedError); - assert((client.innerApiCalls.listSources as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSourcesStream without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - ]; - client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.Source[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.Source) => { - 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.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert.strictEqual( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listSourcesStream with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1beta1.Source[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1beta1.Source) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert.strictEqual( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSources without error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.Source()), - ]; - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1beta1.ISource[] = []; - const iterable = client.listSourcesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSources with error', async () => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSourcesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1beta1.ISource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('asset', () => { - const fakePath = "/rendered/path/asset"; - const expectedParameters = { - organization: "organizationValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.assetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.assetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('assetPath', () => { - const result = client.assetPath("organizationValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.assetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromAssetName', () => { - const result = client.matchOrganizationFromAssetName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAssetName', () => { - const result = client.matchAssetFromAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('finding', () => { - const fakePath = "/rendered/path/finding"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - 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("organizationValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.findingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromFindingName', () => { - const result = client.matchOrganizationFromFindingName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFindingName', () => { - const result = client.matchSourceFromFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - 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('organization', () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationPath', () => { - const result = client.organizationPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationName', () => { - const result = client.matchOrganizationFromOrganizationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAssetSecurityMarks', () => { - const fakePath = "/rendered/path/organizationAssetSecurityMarks"; - const expectedParameters = { - organization: "organizationValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAssetSecurityMarksPath', () => { - const result = client.organizationAssetSecurityMarksPath("organizationValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAssetSecurityMarksName', () => { - const result = client.matchOrganizationFromOrganizationAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromOrganizationAssetSecurityMarksName', () => { - const result = client.matchAssetFromOrganizationAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/organizationSourceFindingSecurityMarks"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourceFindingSecurityMarksPath', () => { - const result = client.organizationSourceFindingSecurityMarksPath("organizationValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchOrganizationFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('source', () => { - const fakePath = "/rendered/path/source"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.sourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sourcePath', () => { - const result = client.sourcePath("organizationValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromSourceName', () => { - const result = client.matchOrganizationFromSourceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromSourceName', () => { - const result = client.matchSourceFromSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1beta1/tsconfig.json b/owl-bot-staging/v1beta1/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- a/owl-bot-staging/v1beta1/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/v1beta1/webpack.config.js b/owl-bot-staging/v1beta1/webpack.config.js deleted file mode 100644 index 4aeca8bf..00000000 --- a/owl-bot-staging/v1beta1/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: 'SecurityCenter', - filename: './security-center.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/v1p1beta1/.eslintignore b/owl-bot-staging/v1p1beta1/.eslintignore deleted file mode 100644 index cfc348ec..00000000 --- a/owl-bot-staging/v1p1beta1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1p1beta1/.eslintrc.json b/owl-bot-staging/v1p1beta1/.eslintrc.json deleted file mode 100644 index 78215349..00000000 --- a/owl-bot-staging/v1p1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1p1beta1/.gitignore b/owl-bot-staging/v1p1beta1/.gitignore deleted file mode 100644 index 5d32b237..00000000 --- a/owl-bot-staging/v1p1beta1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1p1beta1/.jsdoc.js b/owl-bot-staging/v1p1beta1/.jsdoc.js deleted file mode 100644 index e201160b..00000000 --- a/owl-bot-staging/v1p1beta1/.jsdoc.js +++ /dev/null @@ -1,55 +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. -// -// ** 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 2021 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/security-center', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1p1beta1/.mocharc.js b/owl-bot-staging/v1p1beta1/.mocharc.js deleted file mode 100644 index 50bc7f79..00000000 --- a/owl-bot-staging/v1p1beta1/.mocharc.js +++ /dev/null @@ -1,33 +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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1p1beta1/.prettierrc.js b/owl-bot-staging/v1p1beta1/.prettierrc.js deleted file mode 100644 index 84f4713a..00000000 --- a/owl-bot-staging/v1p1beta1/.prettierrc.js +++ /dev/null @@ -1,22 +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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1p1beta1/README.md b/owl-bot-staging/v1p1beta1/README.md deleted file mode 100644 index 73f34764..00000000 --- a/owl-bot-staging/v1p1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Securitycenter: Nodejs Client diff --git a/owl-bot-staging/v1p1beta1/linkinator.config.json b/owl-bot-staging/v1p1beta1/linkinator.config.json deleted file mode 100644 index 0121dfa6..00000000 --- a/owl-bot-staging/v1p1beta1/linkinator.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io" - ], - "silent": true, - "concurrency": 5 -} diff --git a/owl-bot-staging/v1p1beta1/package.json b/owl-bot-staging/v1p1beta1/package.json deleted file mode 100644 index b88a2160..00000000 --- a/owl-bot-staging/v1p1beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/security-center", - "version": "0.1.0", - "description": "Securitycenter client for Node.js", - "repository": "googleapis/nodejs-securitycenter", - "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 securitycenter", - "securitycenter", - "security center" - ], - "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": "^2.28.0" - }, - "devDependencies": { - "@types/mocha": "^9.0.0", - "@types/node": "^14.17.32", - "@types/sinon": "^10.0.6", - "c8": "^7.10.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^2.14.5", - "mocha": "^9.1.3", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.2", - "ts-loader": "^9.2.6", - "typescript": "^4.4.4", - "webpack": "^5.62.1", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto deleted file mode 100644 index 9ee30783..00000000 --- a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/asset.proto +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1p1beta1/folder.proto"; -import "google/cloud/securitycenter/v1p1beta1/security_marks.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// Security Command Center representation of a Google Cloud -// resource. -// -// The Asset is a Security Command Center resource that captures information -// about a single Google Cloud resource. All modifications to an Asset are only -// within the context of Security Command Center and don't affect the referenced -// Google Cloud resource. -message Asset { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Asset" - pattern: "organizations/{organization}/assets/{asset}" - pattern: "folders/{folder}/assets/{asset}" - pattern: "projects/{project}/assets/{asset}" - }; - - // Security Command Center managed properties. These properties are managed by - // Security Command Center and cannot be modified by the user. - message SecurityCenterProperties { - // The full resource name of the Google Cloud resource this asset - // represents. This field is immutable after create time. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_name = 1; - - // The type of the Google Cloud resource. Examples include: APPLICATION, - // PROJECT, and ORGANIZATION. This is a case insensitive field defined by - // Security Command Center and/or the producer of the resource and is - // immutable after create time. - string resource_type = 2; - - // The full resource name of the immediate parent of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_parent = 3; - - // The full resource name of the project the resource belongs to. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_project = 4; - - // Owners of the Google Cloud resource. - repeated string resource_owners = 5; - - // The user defined display name for this resource. - string resource_display_name = 6; - - // The user defined display name for the parent of this resource. - string resource_parent_display_name = 7; - - // The user defined display name for the project of this resource. - string resource_project_display_name = 8; - - // Contains a Folder message for each folder in the assets ancestry. - // The first folder is the deepest nested folder, and the last folder is the - // folder directly under the Organization. - repeated Folder folders = 10; - } - - // Cloud IAM Policy information associated with the Google Cloud resource - // described by the Security Command Center asset. This information is managed - // and defined by the Google Cloud resource and cannot be modified by the - // user. - message IamPolicy { - // The JSON representation of the Policy associated with the asset. - // See https://cloud.google.com/iam/docs/reference/rest/v1/Policy for - // format details. - string policy_blob = 1; - } - - // The relative resource name of this asset. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/assets/{asset_id}". - string name = 1; - - // Security Command Center managed properties. These properties are managed by - // Security Command Center and cannot be modified by the user. - SecurityCenterProperties security_center_properties = 2; - - // Resource managed properties. These properties are managed and defined by - // the Google Cloud resource and cannot be modified by the user. - map resource_properties = 7; - - // User specified security marks. These marks are entirely managed by the user - // and come from the SecurityMarks resource that belongs to the asset. - SecurityMarks security_marks = 8; - - // The time at which the asset was created in Security Command Center. - google.protobuf.Timestamp create_time = 9; - - // The time at which the asset was last updated or added in Cloud SCC. - google.protobuf.Timestamp update_time = 10; - - // Cloud IAM Policy information associated with the Google Cloud resource - // described by the Security Command Center asset. This information is managed - // and defined by the Google Cloud resource and cannot be modified by the - // user. - IamPolicy iam_policy = 11; - - // The canonical name of the resource. It's either - // "organizations/{organization_id}/assets/{asset_id}", - // "folders/{folder_id}/assets/{asset_id}" or - // "projects/{project_number}/assets/{asset_id}", depending on the closest CRM - // ancestor of the resource. - string canonical_name = 13; -} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto deleted file mode 100644 index 572a368f..00000000 --- a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/finding.proto +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1p1beta1/security_marks.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// Security Command Center finding. -// -// A finding is a record of assessment data (security, risk, health or privacy) -// ingested into Security Command Center for presentation, notification, -// analysis, policy testing, and enforcement. For example, an XSS vulnerability -// in an App Engine application is a finding. -message Finding { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Finding" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}" - pattern: "folders/{folder}/sources/{source}/findings/{finding}" - pattern: "projects/{project}/sources/{source}/findings/{finding}" - }; - - // The state of the finding. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // The finding requires attention and has not been addressed yet. - ACTIVE = 1; - - // The finding has been fixed, triaged as a non-issue or otherwise addressed - // and is no longer active. - INACTIVE = 2; - } - - // The severity of the finding. This field is managed by the source that - // writes the finding. - 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; - } - - // The relative resource name of this finding. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}" - string name = 1; - - // The relative resource name of the source the finding belongs to. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // This field is immutable after creation time. - // For example: - // "organizations/{organization_id}/sources/{source_id}" - string parent = 2; - - // For findings on Google Cloud resources, the full resource - // name of the Google Cloud resource this finding is for. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - // When the finding is for a non-Google Cloud resource, the resourceName can - // be a customer or partner defined string. This field is immutable after - // creation time. - string resource_name = 3; - - // The state of the finding. - State state = 4; - - // The additional taxonomy group within findings from a given source. - // This field is immutable after creation time. - // Example: "XSS_FLASH_INJECTION" - string category = 5; - - // The URI that, if available, points to a web page outside of Security - // Command Center where additional information about the finding can be found. - // This field is guaranteed to be either empty or a well formed URL. - string external_uri = 6; - - // Source specific properties. These properties are managed by the source - // that writes the finding. The key names in the source_properties map must be - // between 1 and 255 characters, and must start with a letter and contain - // alphanumeric characters or underscores only. - map source_properties = 7; - - // Output only. User specified security marks. These marks are entirely - // managed by the user and come from the SecurityMarks resource that belongs - // to the finding. - SecurityMarks security_marks = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The time at which the event took place, or when an update to the finding - // occurred. For example, if the finding represents an open firewall it would - // capture the time the detector believes the firewall became open. The - // accuracy is determined by the detector. If the finding were to be resolved - // afterward, this time would reflect when the finding was resolved. Must not - // be set to a value greater than the current timestamp. - google.protobuf.Timestamp event_time = 9; - - // The time at which the finding was created in Security Command Center. - google.protobuf.Timestamp create_time = 10; - - // The severity of the finding. This field is managed by the source that - // writes the finding. - Severity severity = 13; - - // The canonical name of the finding. It's either - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}", - // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}" or - // "projects/{project_number}/sources/{source_id}/findings/{finding_id}", - // depending on the closest CRM ancestor of the resource associated with the - // finding. - string canonical_name = 14; -} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto deleted file mode 100644 index ec6df5ed..00000000 --- a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/folder.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; -option java_multiple_files = true; -option java_outer_classname = "FolderProto"; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1Beta1"; - -// Message that contains the resource name and display name of a folder -// resource. -message Folder { - // Full resource name of this folder. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string resource_folder = 1; - - // The user defined display name for this folder. - string resource_folder_display_name = 2; -} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto deleted file mode 100644 index be5f6e0f..00000000 --- a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; -option (google.api.resource_definition) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" -}; - -// Security Command Center notification configs. -// -// A notification config is a Security Command Center resource that contains the -// configuration to send notifications for create/update events of findings, -// assets and etc. -message NotificationConfig { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/NotificationConfig" - pattern: "organizations/{organization}/notificationConfigs/{notification_config}" - }; - - // The config for streaming-based notifications, which send each event as soon - // as it is detected. - message StreamingConfig { - // Expression that defines the filter to apply across create/update events - // of assets or findings as specified by the event type. The expression is a - // list of zero or more restrictions combined via logical operators `AND` - // and `OR`. Parentheses are supported, and `OR` has higher precedence than - // `AND`. - // - // Restrictions have the form ` ` and may have a - // `-` character in front of them to indicate negation. The fields map to - // those defined in the corresponding resource. - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - string filter = 1; - } - - // The type of events. - enum EventType { - // Unspecified event type. - EVENT_TYPE_UNSPECIFIED = 0; - - // Events for findings. - FINDING = 1; - } - - // The relative resource name of this notification config. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/notificationConfigs/notify_public_bucket". - string name = 1; - - // The description of the notification config (max of 1024 characters). - string description = 2; - - // The type of events the config is for, e.g. FINDING. - EventType event_type = 3; - - // The Pub/Sub topic to send notifications to. Its format is - // "projects/[project_id]/topics/[topic]". - string pubsub_topic = 4 [(google.api.resource_reference) = { - type: "pubsub.googleapis.com/Topic" - }]; - - // Output only. The service account that needs "pubsub.topics.publish" - // permission to publish to the Pub/Sub topic. - string service_account = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The config for triggering notifications. - oneof notify_config { - // The config for triggering streaming-based notifications. - StreamingConfig streaming_config = 6; - } -} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto deleted file mode 100644 index 5e671dd0..00000000 --- a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/cloud/securitycenter/v1p1beta1/finding.proto"; -import "google/cloud/securitycenter/v1p1beta1/resource.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// Security Command Center's Notification -message NotificationMessage { - // Name of the notification config that generated current notification. - string notification_config_name = 1; - - // Notification Event. - oneof event { - // If it's a Finding based notification config, this field will be - // populated. - Finding finding = 2; - } - - // The Cloud resource tied to the notification. - Resource resource = 3; -} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto deleted file mode 100644 index ad36d58a..00000000 --- a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/resource.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// User specified settings that are attached to the Security Command -// Center organization. -message OrganizationSettings { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/OrganizationSettings" - pattern: "organizations/{organization}/organizationSettings" - }; - - // The configuration used for Asset Discovery runs. - message AssetDiscoveryConfig { - // The mode of inclusion when running Asset Discovery. - // Asset discovery can be limited by explicitly identifying projects to be - // included or excluded. If INCLUDE_ONLY is set, then only those projects - // within the organization and their children are discovered during asset - // discovery. If EXCLUDE is set, then projects that don't match those - // projects are discovered during asset discovery. If neither are set, then - // all projects within the organization are discovered during asset - // discovery. - enum InclusionMode { - // Unspecified. Setting the mode with this value will disable - // inclusion/exclusion filtering for Asset Discovery. - INCLUSION_MODE_UNSPECIFIED = 0; - - // Asset Discovery will capture only the resources within the projects - // specified. All other resources will be ignored. - INCLUDE_ONLY = 1; - - // Asset Discovery will ignore all resources under the projects specified. - // All other resources will be retrieved. - EXCLUDE = 2; - } - - // The project ids to use for filtering asset discovery. - repeated string project_ids = 1; - - // The mode to use for filtering asset discovery. - InclusionMode inclusion_mode = 2; - - // The folder ids to use for filtering asset discovery. - // It consists of only digits, e.g., 756619654966. - repeated string folder_ids = 3; - } - - // The relative resource name of the settings. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/organizationSettings". - string name = 1; - - // A flag that indicates if Asset Discovery should be enabled. If the flag is - // set to `true`, then discovery of assets will occur. If it is set to `false, - // all historical assets will remain, but discovery of future assets will not - // occur. - bool enable_asset_discovery = 2; - - // The configuration used for Asset Discovery runs. - AssetDiscoveryConfig asset_discovery_config = 3; -} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto deleted file mode 100644 index 0fe2d362..00000000 --- a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/resource.proto +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/field_behavior.proto"; -import "google/cloud/securitycenter/v1p1beta1/folder.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; -option java_multiple_files = true; -option java_outer_classname = "ResourceProto"; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// Information related to the Google Cloud resource. -message Resource { - // The full resource name of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string name = 1; - - // The full resource name of project that the resource belongs to. - string project = 2; - - // The human readable name of project that the resource belongs to. - string project_display_name = 3; - - // The full resource name of resource's parent. - string parent = 4; - - // The human readable name of resource's parent. - string parent_display_name = 5; - - // Output only. Contains a Folder message for each folder in the assets ancestry. - // The first folder is the deepest nested folder, and the last folder is the - // folder directly under the Organization. - repeated Folder folders = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto deleted file mode 100644 index d867d201..00000000 --- a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/protobuf/duration.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// Response of asset discovery run -message RunAssetDiscoveryResponse { - // The state of an asset discovery run. - enum State { - // Asset discovery run state was unspecified. - STATE_UNSPECIFIED = 0; - - // Asset discovery run completed successfully. - COMPLETED = 1; - - // Asset discovery run was cancelled with tasks still pending, as another - // run for the same organization was started with a higher priority. - SUPERSEDED = 2; - - // Asset discovery run was killed and terminated. - TERMINATED = 3; - } - - // The state of an asset discovery run. - State state = 1; - - // The duration between asset discovery run start and end - google.protobuf.Duration duration = 2; -} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto deleted file mode 100644 index 22db26cb..00000000 --- a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/resource.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// User specified security marks that are attached to the parent Security -// Command Center resource. Security marks are scoped within a Security Command -// Center organization -- they can be modified and viewed by all users who have -// proper permissions on the organization. -message SecurityMarks { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/SecurityMarks" - pattern: "organizations/{organization}/assets/{asset}/securityMarks" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}/securityMarks" - pattern: "folders/{folder}/assets/{asset}/securityMarks" - pattern: "projects/{project}/assets/{asset}/securityMarks" - pattern: "folders/{folder}/sources/{source}/findings/{finding}/securityMarks" - pattern: "projects/{project}/sources/{source}/findings/{finding}/securityMarks" - }; - - // The relative resource name of the SecurityMarks. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Examples: - // "organizations/{organization_id}/assets/{asset_id}/securityMarks" - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks". - string name = 1; - - // Mutable user specified security marks belonging to the parent resource. - // Constraints are as follows: - // - // * Keys and values are treated as case insensitive - // * Keys must be between 1 - 256 characters (inclusive) - // * Keys must be letters, numbers, underscores, or dashes - // * Values have leading and trailing whitespace trimmed, remaining - // characters must be between 1 - 4096 characters (inclusive) - map marks = 2; - - // The canonical name of the marks. - // Examples: - // "organizations/{organization_id}/assets/{asset_id}/securityMarks" - // "folders/{folder_id}/assets/{asset_id}/securityMarks" - // "projects/{project_number}/assets/{asset_id}/securityMarks" - // "organizations/{organization_id}/sources/{source_id}/findings/{finding_id}/securityMarks" - // "folders/{folder_id}/sources/{source_id}/findings/{finding_id}/securityMarks" - // "projects/{project_number}/sources/{source_id}/findings/{finding_id}/securityMarks" - string canonical_name = 3; -} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto deleted file mode 100644 index 958e6971..00000000 --- a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto +++ /dev/null @@ -1,1351 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import public "google/cloud/securitycenter/v1p1beta1/notification_message.proto"; -import public "google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto"; -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1p1beta1/asset.proto"; -import "google/cloud/securitycenter/v1p1beta1/finding.proto"; -import "google/cloud/securitycenter/v1p1beta1/folder.proto"; -import "google/cloud/securitycenter/v1p1beta1/notification_config.proto"; -import "google/cloud/securitycenter/v1p1beta1/organization_settings.proto"; -import "google/cloud/securitycenter/v1p1beta1/security_marks.proto"; -import "google/cloud/securitycenter/v1p1beta1/source.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// V1p1Beta1 APIs for Security Center service. -service SecurityCenter { - option (google.api.default_host) = "securitycenter.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a source. - rpc CreateSource(CreateSourceRequest) returns (Source) { - option (google.api.http) = { - post: "/v1p1beta1/{parent=organizations/*}/sources" - body: "source" - }; - option (google.api.method_signature) = "parent,source"; - } - - // Creates a finding. The corresponding source must exist for finding - // creation to succeed. - rpc CreateFinding(CreateFindingRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1p1beta1/{parent=organizations/*/sources/*}/findings" - body: "finding" - }; - option (google.api.method_signature) = "parent,finding_id,finding"; - option (google.api.method_signature) = "parent,finding,finding_id"; - } - - // Creates a notification config. - rpc CreateNotificationConfig(CreateNotificationConfigRequest) returns (NotificationConfig) { - option (google.api.http) = { - post: "/v1p1beta1/{parent=organizations/*}/notificationConfigs" - body: "notification_config" - }; - option (google.api.method_signature) = "parent,config_id,notification_config"; - option (google.api.method_signature) = "parent,notification_config"; - } - - // Deletes a notification config. - rpc DeleteNotificationConfig(DeleteNotificationConfigRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1p1beta1/{name=organizations/*/notificationConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets the access control policy on the specified Source. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1p1beta1/{resource=organizations/*/sources/*}:getIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource"; - } - - // Gets a notification config. - rpc GetNotificationConfig(GetNotificationConfigRequest) returns (NotificationConfig) { - option (google.api.http) = { - get: "/v1p1beta1/{name=organizations/*/notificationConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets the settings for an organization. - rpc GetOrganizationSettings(GetOrganizationSettingsRequest) returns (OrganizationSettings) { - option (google.api.http) = { - get: "/v1p1beta1/{name=organizations/*/organizationSettings}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a source. - rpc GetSource(GetSourceRequest) returns (Source) { - option (google.api.http) = { - get: "/v1p1beta1/{name=organizations/*/sources/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Filters an organization's assets and groups them by their specified - // properties. - rpc GroupAssets(GroupAssetsRequest) returns (GroupAssetsResponse) { - option (google.api.http) = { - post: "/v1p1beta1/{parent=organizations/*}/assets:group" - body: "*" - additional_bindings { - post: "/v1p1beta1/{parent=folders/*}/assets:group" - body: "*" - } - additional_bindings { - post: "/v1p1beta1/{parent=projects/*}/assets:group" - body: "*" - } - }; - } - - // Filters an organization or source's findings and groups them by their - // specified properties. - // - // To group across all sources provide a `-` as the source id. - // Example: /v1/organizations/{organization_id}/sources/-/findings, - // /v1/folders/{folder_id}/sources/-/findings, - // /v1/projects/{project_id}/sources/-/findings - rpc GroupFindings(GroupFindingsRequest) returns (GroupFindingsResponse) { - option (google.api.http) = { - post: "/v1p1beta1/{parent=organizations/*/sources/*}/findings:group" - body: "*" - additional_bindings { - post: "/v1p1beta1/{parent=folders/*/sources/*}/findings:group" - body: "*" - } - additional_bindings { - post: "/v1p1beta1/{parent=projects/*/sources/*}/findings:group" - body: "*" - } - }; - option (google.api.method_signature) = "parent,group_by"; - } - - // Lists an organization's assets. - rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { - option (google.api.http) = { - get: "/v1p1beta1/{parent=organizations/*}/assets" - additional_bindings { - get: "/v1p1beta1/{parent=folders/*}/assets" - } - additional_bindings { - get: "/v1p1beta1/{parent=projects/*}/assets" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Lists an organization or source's findings. - // - // To list across all sources provide a `-` as the source id. - // Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings - rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { - option (google.api.http) = { - get: "/v1p1beta1/{parent=organizations/*/sources/*}/findings" - additional_bindings { - get: "/v1p1beta1/{parent=folders/*/sources/*}/findings" - } - additional_bindings { - get: "/v1p1beta1/{parent=projects/*/sources/*}/findings" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Lists notification configs. - rpc ListNotificationConfigs(ListNotificationConfigsRequest) returns (ListNotificationConfigsResponse) { - option (google.api.http) = { - get: "/v1p1beta1/{parent=organizations/*}/notificationConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Lists all sources belonging to an organization. - rpc ListSources(ListSourcesRequest) returns (ListSourcesResponse) { - option (google.api.http) = { - get: "/v1p1beta1/{parent=organizations/*}/sources" - additional_bindings { - get: "/v1p1beta1/{parent=folders/*}/sources" - } - additional_bindings { - get: "/v1p1beta1/{parent=projects/*}/sources" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Runs asset discovery. The discovery is tracked with a long-running - // operation. - // - // This API can only be called with limited frequency for an organization. If - // it is called too frequently the caller will receive a TOO_MANY_REQUESTS - // error. - rpc RunAssetDiscovery(RunAssetDiscoveryRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1p1beta1/{parent=organizations/*}/assets:runDiscovery" - body: "*" - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryResponse" - metadata_type: "google.protobuf.Empty" - }; - } - - // Updates the state of a finding. - rpc SetFindingState(SetFindingStateRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1p1beta1/{name=organizations/*/sources/*/findings/*}:setState" - body: "*" - additional_bindings { - post: "/v1p1beta1/{name=folders/*/sources/*/findings/*}:setState" - body: "*" - } - additional_bindings { - post: "/v1p1beta1/{name=projects/*/sources/*/findings/*}:setState" - body: "*" - } - }; - option (google.api.method_signature) = "name,state,start_time"; - } - - // Sets the access control policy on the specified Source. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1p1beta1/{resource=organizations/*/sources/*}:setIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Returns the permissions that a caller has on the specified source. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1p1beta1/{resource=organizations/*/sources/*}:testIamPermissions" - body: "*" - }; - option (google.api.method_signature) = "resource,permissions"; - } - - // Creates or updates a finding. The corresponding source must exist for a - // finding creation to succeed. - rpc UpdateFinding(UpdateFindingRequest) returns (Finding) { - option (google.api.http) = { - patch: "/v1p1beta1/{finding.name=organizations/*/sources/*/findings/*}" - body: "finding" - additional_bindings { - patch: "/v1p1beta1/{finding.name=folders/*/sources/*/findings/*}" - body: "finding" - } - additional_bindings { - patch: "/v1p1beta1/{finding.name=projects/*/sources/*/findings/*}" - body: "finding" - } - }; - option (google.api.method_signature) = "finding"; - option (google.api.method_signature) = "finding,update_mask"; - } - - // Updates a notification config. The following update - // fields are allowed: description, pubsub_topic, streaming_config.filter - rpc UpdateNotificationConfig(UpdateNotificationConfigRequest) returns (NotificationConfig) { - option (google.api.http) = { - patch: "/v1p1beta1/{notification_config.name=organizations/*/notificationConfigs/*}" - body: "notification_config" - }; - option (google.api.method_signature) = "notification_config"; - option (google.api.method_signature) = "notification_config,update_mask"; - } - - // Updates an organization's settings. - rpc UpdateOrganizationSettings(UpdateOrganizationSettingsRequest) returns (OrganizationSettings) { - option (google.api.http) = { - patch: "/v1p1beta1/{organization_settings.name=organizations/*/organizationSettings}" - body: "organization_settings" - }; - option (google.api.method_signature) = "organization_settings"; - } - - // Updates a source. - rpc UpdateSource(UpdateSourceRequest) returns (Source) { - option (google.api.http) = { - patch: "/v1p1beta1/{source.name=organizations/*/sources/*}" - body: "source" - }; - option (google.api.method_signature) = "source"; - option (google.api.method_signature) = "source,update_mask"; - } - - // Updates security marks. - rpc UpdateSecurityMarks(UpdateSecurityMarksRequest) returns (SecurityMarks) { - option (google.api.http) = { - patch: "/v1p1beta1/{security_marks.name=organizations/*/assets/*/securityMarks}" - body: "security_marks" - additional_bindings { - patch: "/v1p1beta1/{security_marks.name=folders/*/assets/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1p1beta1/{security_marks.name=projects/*/assets/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1p1beta1/{security_marks.name=organizations/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1p1beta1/{security_marks.name=folders/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - additional_bindings { - patch: "/v1p1beta1/{security_marks.name=projects/*/sources/*/findings/*/securityMarks}" - body: "security_marks" - } - }; - option (google.api.method_signature) = "security_marks"; - option (google.api.method_signature) = "security_marks,update_mask"; - } -} - -// Request message for creating a finding. -message CreateFindingRequest { - // Required. Resource name of the new finding's parent. Its format should be - // "organizations/[organization_id]/sources/[source_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Required. Unique identifier provided by the client within the parent scope. - string finding_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Finding being created. The name and security_marks will be ignored as - // they are both output only fields on this resource. - Finding finding = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for creating a notification config. -message CreateNotificationConfigRequest { - // Required. Resource name of the new notification config's parent. Its format is - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Required. Unique identifier provided by the client within the parent scope. - // It must be between 1 and 128 characters, and contains alphanumeric - // characters, underscores or hyphens only. - string config_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The notification config being created. The name and the service account - // will be ignored as they are both output only fields on this resource. - NotificationConfig notification_config = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for creating a source. -message CreateSourceRequest { - // Required. Resource name of the new source's parent. Its format should be - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // Required. The Source being created, only the display_name and description will be - // used. All other fields will be ignored. - Source source = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for deleting a notification config. -message DeleteNotificationConfigRequest { - // Required. Name of the notification config to delete. Its format is - // "organizations/[organization_id]/notificationConfigs/[config_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/NotificationConfig" - } - ]; -} - -// Request message for getting a notification config. -message GetNotificationConfigRequest { - // Required. Name of the notification config to get. Its format is - // "organizations/[organization_id]/notificationConfigs/[config_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/NotificationConfig" - } - ]; -} - -// Request message for getting organization settings. -message GetOrganizationSettingsRequest { - // Required. Name of the organization to get organization settings for. Its format is - // "organizations/[organization_id]/organizationSettings". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/OrganizationSettings" - } - ]; -} - -// Request message for getting a source. -message GetSourceRequest { - // Required. Relative resource name of the source. Its format is - // "organizations/[organization_id]/source/[source_id]". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; -} - -// Request message for grouping by assets. -message GroupAssetsRequest { - // Required. Name of the organization to groupBy. Its format is - // "organizations/[organization_id], folders/[folder_id], or - // projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/Asset" - } - ]; - - // Expression that defines the filter to apply across assets. - // The expression is a list of zero or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. The fields map to those - // defined in the Asset resource. Examples include: - // - // * name - // * security_center_properties.resource_name - // * resource_properties.a_property - // * security_marks.marks.marka - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - // - // The following field and operator combinations are supported: - // - // * name: `=` - // * update_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `update_time = "2019-06-10T16:07:18-07:00"` - // `update_time = 1560208038000` - // - // * create_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `create_time = "2019-06-10T16:07:18-07:00"` - // `create_time = 1560208038000` - // - // * iam_policy.policy_blob: `=`, `:` - // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // * security_marks.marks: `=`, `:` - // * security_center_properties.resource_name: `=`, `:` - // * security_center_properties.resource_name_display_name: `=`, `:` - // * security_center_properties.resource_type: `=`, `:` - // * security_center_properties.resource_parent: `=`, `:` - // * security_center_properties.resource_parent_display_name: `=`, `:` - // * security_center_properties.resource_project: `=`, `:` - // * security_center_properties.resource_project_display_name: `=`, `:` - // * security_center_properties.resource_owners: `=`, `:` - // - // For example, `resource_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `resource_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-resource_properties.my_property : ""` - string filter = 2; - - // Required. Expression that defines what assets fields to use for grouping. The string - // value should follow SQL syntax: comma separated list of fields. For - // example: - // "security_center_properties.resource_project,security_center_properties.project". - // - // The following fields are supported when compare_duration is not set: - // - // * security_center_properties.resource_project - // * security_center_properties.resource_project_display_name - // * security_center_properties.resource_type - // * security_center_properties.resource_parent - // * security_center_properties.resource_parent_display_name - // - // The following fields are supported when compare_duration is set: - // - // * security_center_properties.resource_type - // * security_center_properties.resource_project_display_name - // * security_center_properties.resource_parent_display_name - string group_by = 3 [(google.api.field_behavior) = REQUIRED]; - - // When compare_duration is set, the GroupResult's "state_change" property is - // updated to indicate whether the asset was added, removed, or remained - // present during the compare_duration period of time that precedes the - // read_time. This is the time between (read_time - compare_duration) and - // read_time. - // - // The state change value is derived based on the presence of the asset at the - // two points in time. Intermediate state changes between the two times don't - // affect the result. For example, the results aren't affected if the asset is - // removed and re-created again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "ADDED": indicates that the asset was not present at the start of - // compare_duration, but present at reference_time. - // * "REMOVED": indicates that the asset was present at the start of - // compare_duration, but not present at reference_time. - // * "ACTIVE": indicates that the asset was present at both the - // start and the end of the time period defined by - // compare_duration and reference_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all assets present at - // read_time. - // - // If this field is set then `state_change` must be a specified field in - // `group_by`. - google.protobuf.Duration compare_duration = 4; - - // Time used as a reference point when filtering assets. The filter is limited - // to assets existing at the supplied time and their values are those at that - // specific time. Absence of this field will default to the API's version of - // NOW. - google.protobuf.Timestamp read_time = 5; - - // The value returned by the last `GroupAssetsResponse`; indicates - // that this is a continuation of a prior `GroupAssets` call, and that the - // system should return the next page of data. - string page_token = 7; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 8; -} - -// Response message for grouping by assets. -message GroupAssetsResponse { - // Group results. There exists an element for each existing unique - // combination of property/values. The element contains a count for the number - // of times those specific property/values appear. - repeated GroupResult group_by_results = 1; - - // Time used for executing the groupBy request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of results matching the query. - int32 total_size = 4; -} - -// Request message for grouping by findings. -message GroupFindingsRequest { - // Required. Name of the source to groupBy. Its format is - // "organizations/[organization_id]/sources/[source_id]", - // folders/[folder_id]/sources/[source_id], or - // projects/[project_id]/sources/[source_id]. To groupBy across all sources - // provide a source_id of `-`. For example: - // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - // or projects/{project_id}/sources/- - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Expression that defines the filter to apply across findings. - // The expression is a list of one or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. Examples include: - // - // * name - // * source_properties.a_property - // * security_marks.marks.marka - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - // - // The following field and operator combinations are supported: - // - // * name: `=` - // * parent: `=`, `:` - // * resource_name: `=`, `:` - // * state: `=`, `:` - // * category: `=`, `:` - // * external_uri: `=`, `:` - // * event_time: `=`, `>`, `<`, `>=`, `<=` - // * severity: `=`, `:` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `event_time = "2019-06-10T16:07:18-07:00"` - // `event_time = 1560208038000` - // - // * security_marks.marks: `=`, `:` - // * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // - // For example, `source_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `source_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-source_properties.my_property : ""` - string filter = 2; - - // Required. Expression that defines what assets fields to use for grouping (including - // `state_change`). The string value should follow SQL syntax: comma separated - // list of fields. For example: "parent,resource_name". - // - // The following fields are supported: - // - // * resource_name - // * category - // * state - // * parent - // * severity - // - // The following fields are supported when compare_duration is set: - // - // * state_change - string group_by = 3 [(google.api.field_behavior) = REQUIRED]; - - // Time used as a reference point when filtering findings. The filter is - // limited to findings existing at the supplied time and their values are - // those at that specific time. Absence of this field will default to the - // API's version of NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the GroupResult's "state_change" attribute is - // updated to indicate whether the finding had its state changed, the - // finding's state remained unchanged, or if the finding was added during the - // compare_duration period of time that precedes the read_time. This is the - // time between (read_time - compare_duration) and read_time. - // - // The state_change value is derived based on the presence and state of the - // finding at the two points in time. Intermediate state changes between the - // two times don't affect the result. For example, the results aren't affected - // if the finding is made inactive and then active again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "CHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration, but changed its - // state at read_time. - // * "UNCHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration and did not change - // state at read_time. - // * "ADDED": indicates that the finding did not match the given filter or - // was not present at the start of compare_duration, but was - // present at read_time. - // * "REMOVED": indicates that the finding was present and matched the - // filter at the start of compare_duration, but did not match - // the filter at read_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all findings present - // at read_time. - // - // If this field is set then `state_change` must be a specified field in - // `group_by`. - google.protobuf.Duration compare_duration = 5; - - // The value returned by the last `GroupFindingsResponse`; indicates - // that this is a continuation of a prior `GroupFindings` call, and - // that the system should return the next page of data. - string page_token = 7; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 8; -} - -// Response message for group by findings. -message GroupFindingsResponse { - // Group results. There exists an element for each existing unique - // combination of property/values. The element contains a count for the number - // of times those specific property/values appear. - repeated GroupResult group_by_results = 1; - - // Time used for executing the groupBy request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of results matching the query. - int32 total_size = 4; -} - -// Result containing the properties and count of a groupBy request. -message GroupResult { - // Properties matching the groupBy fields in the request. - map properties = 1; - - // Total count of resources for the given properties. - int64 count = 2; -} - -// Request message for listing notification configs. -message ListNotificationConfigsRequest { - // Required. Name of the organization to list notification configs. - // Its format is "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; - - // The value returned by the last `ListNotificationConfigsResponse`; indicates - // that this is a continuation of a prior `ListNotificationConfigs` call, and - // that the system should return the next page of data. - string page_token = 2; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 3; -} - -// Response message for listing notification configs. -message ListNotificationConfigsResponse { - // Notification configs belonging to the requested parent. - repeated NotificationConfig notification_configs = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 2; -} - -// Request message for listing sources. -message ListSourcesRequest { - // Required. Resource name of the parent of sources to list. Its format should be - // "organizations/[organization_id], folders/[folder_id], or - // projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/Source" - } - ]; - - // The value returned by the last `ListSourcesResponse`; indicates - // that this is a continuation of a prior `ListSources` call, and - // that the system should return the next page of data. - string page_token = 2; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 7; -} - -// Response message for listing sources. -message ListSourcesResponse { - // Sources belonging to the requested parent. - repeated Source sources = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 2; -} - -// Request message for listing assets. -message ListAssetsRequest { - // Required. Name of the organization assets should belong to. Its format is - // "organizations/[organization_id], folders/[folder_id], or - // projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/Asset" - } - ]; - - // Expression that defines the filter to apply across assets. - // The expression is a list of zero or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. The fields map to those - // defined in the Asset resource. Examples include: - // - // * name - // * security_center_properties.resource_name - // * resource_properties.a_property - // * security_marks.marks.marka - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - // - // The following are the allowed field and operator combinations: - // - // * name: `=` - // * update_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `update_time = "2019-06-10T16:07:18-07:00"` - // `update_time = 1560208038000` - // - // * create_time: `=`, `>`, `<`, `>=`, `<=` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `create_time = "2019-06-10T16:07:18-07:00"` - // `create_time = 1560208038000` - // - // * iam_policy.policy_blob: `=`, `:` - // * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // * security_marks.marks: `=`, `:` - // * security_center_properties.resource_name: `=`, `:` - // * security_center_properties.resource_display_name: `=`, `:` - // * security_center_properties.resource_type: `=`, `:` - // * security_center_properties.resource_parent: `=`, `:` - // * security_center_properties.resource_parent_display_name: `=`, `:` - // * security_center_properties.resource_project: `=`, `:` - // * security_center_properties.resource_project_display_name: `=`, `:` - // * security_center_properties.resource_owners: `=`, `:` - // - // For example, `resource_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `resource_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-resource_properties.my_property : ""` - string filter = 2; - - // Expression that defines what fields and order to use for sorting. The - // string value should follow SQL syntax: comma separated list of fields. For - // example: "name,resource_properties.a_property". The default sorting order - // is ascending. To specify descending order for a field, a suffix " desc" - // should be appended to the field name. For example: "name - // desc,resource_properties.a_property". Redundant space characters in the - // syntax are insignificant. "name desc,resource_properties.a_property" and " - // name desc , resource_properties.a_property " are equivalent. - // - // The following fields are supported: - // name - // update_time - // resource_properties - // security_marks.marks - // security_center_properties.resource_name - // security_center_properties.resource_display_name - // security_center_properties.resource_parent - // security_center_properties.resource_parent_display_name - // security_center_properties.resource_project - // security_center_properties.resource_project_display_name - // security_center_properties.resource_type - string order_by = 3; - - // Time used as a reference point when filtering assets. The filter is limited - // to assets existing at the supplied time and their values are those at that - // specific time. Absence of this field will default to the API's version of - // NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the ListAssetsResult's "state_change" - // attribute is updated to indicate whether the asset was added, removed, or - // remained present during the compare_duration period of time that precedes - // the read_time. This is the time between (read_time - compare_duration) and - // read_time. - // - // The state_change value is derived based on the presence of the asset at the - // two points in time. Intermediate state changes between the two times don't - // affect the result. For example, the results aren't affected if the asset is - // removed and re-created again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "ADDED": indicates that the asset was not present at the start of - // compare_duration, but present at read_time. - // * "REMOVED": indicates that the asset was present at the start of - // compare_duration, but not present at read_time. - // * "ACTIVE": indicates that the asset was present at both the - // start and the end of the time period defined by - // compare_duration and read_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all assets present at - // read_time. - google.protobuf.Duration compare_duration = 5; - - // A field mask to specify the ListAssetsResult fields to be listed in the - // response. - // An empty field mask will list all fields. - google.protobuf.FieldMask field_mask = 7; - - // The value returned by the last `ListAssetsResponse`; indicates - // that this is a continuation of a prior `ListAssets` call, and - // that the system should return the next page of data. - string page_token = 8; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 9; -} - -// Response message for listing assets. -message ListAssetsResponse { - // Result containing the Asset and its State. - message ListAssetsResult { - // The change in state of the asset. - // - // When querying across two points in time this describes - // the change between the two points: ADDED, REMOVED, or ACTIVE. - // If there was no compare_duration supplied in the request the state change - // will be: UNUSED - enum StateChange { - // State change is unused, this is the canonical default for this enum. - UNUSED = 0; - - // Asset was added between the points in time. - ADDED = 1; - - // Asset was removed between the points in time. - REMOVED = 2; - - // Asset was present at both point(s) in time. - ACTIVE = 3; - } - - // Asset matching the search request. - Asset asset = 1; - - // State change of the asset between the points in time. - StateChange state_change = 2; - } - - // Assets matching the list request. - repeated ListAssetsResult list_assets_results = 1; - - // Time used for executing the list request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of assets matching the query. - int32 total_size = 4; -} - -// Request message for listing findings. -message ListFindingsRequest { - // Required. Name of the source the findings belong to. Its format is - // "organizations/[organization_id]/sources/[source_id], - // folders/[folder_id]/sources/[source_id], or - // projects/[project_id]/sources/[source_id]". To list across all sources - // provide a source_id of `-`. For example: - // organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - // projects/{projects_id}/sources/- - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Source" - } - ]; - - // Expression that defines the filter to apply across findings. - // The expression is a list of one or more restrictions combined via logical - // operators `AND` and `OR`. - // Parentheses are supported, and `OR` has higher precedence than `AND`. - // - // Restrictions have the form ` ` and may have a `-` - // character in front of them to indicate negation. Examples include: - // - // * name - // * source_properties.a_property - // * security_marks.marks.marka - // - // The supported operators are: - // - // * `=` for all value types. - // * `>`, `<`, `>=`, `<=` for integer values. - // * `:`, meaning substring matching, for strings. - // - // The supported value types are: - // - // * string literals in quotes. - // * integer literals without quotes. - // * boolean literals `true` and `false` without quotes. - // - // The following field and operator combinations are supported: - // - // * name: `=` - // * parent: `=`, `:` - // * resource_name: `=`, `:` - // * state: `=`, `:` - // * category: `=`, `:` - // * external_uri: `=`, `:` - // * event_time: `=`, `>`, `<`, `>=`, `<=` - // * severity: `=`, `:` - // - // Usage: This should be milliseconds since epoch or an RFC3339 string. - // Examples: - // `event_time = "2019-06-10T16:07:18-07:00"` - // `event_time = 1560208038000` - // - // security_marks.marks: `=`, `:` - // source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - // - // For example, `source_properties.size = 100` is a valid filter string. - // - // Use a partial match on the empty string to filter based on a property - // existing: `source_properties.my_property : ""` - // - // Use a negated partial match on the empty string to filter based on a - // property not existing: `-source_properties.my_property : ""` - string filter = 2; - - // Expression that defines what fields and order to use for sorting. The - // string value should follow SQL syntax: comma separated list of fields. For - // example: "name,resource_properties.a_property". The default sorting order - // is ascending. To specify descending order for a field, a suffix " desc" - // should be appended to the field name. For example: "name - // desc,source_properties.a_property". Redundant space characters in the - // syntax are insignificant. "name desc,source_properties.a_property" and " - // name desc , source_properties.a_property " are equivalent. - // - // The following fields are supported: - // name - // parent - // state - // category - // resource_name - // event_time - // source_properties - // security_marks.marks - string order_by = 3; - - // Time used as a reference point when filtering findings. The filter is - // limited to findings existing at the supplied time and their values are - // those at that specific time. Absence of this field will default to the - // API's version of NOW. - google.protobuf.Timestamp read_time = 4; - - // When compare_duration is set, the ListFindingsResult's "state_change" - // attribute is updated to indicate whether the finding had its state changed, - // the finding's state remained unchanged, or if the finding was added in any - // state during the compare_duration period of time that precedes the - // read_time. This is the time between (read_time - compare_duration) and - // read_time. - // - // The state_change value is derived based on the presence and state of the - // finding at the two points in time. Intermediate state changes between the - // two times don't affect the result. For example, the results aren't affected - // if the finding is made inactive and then active again. - // - // Possible "state_change" values when compare_duration is specified: - // - // * "CHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration, but changed its - // state at read_time. - // * "UNCHANGED": indicates that the finding was present and matched the given - // filter at the start of compare_duration and did not change - // state at read_time. - // * "ADDED": indicates that the finding did not match the given filter or - // was not present at the start of compare_duration, but was - // present at read_time. - // * "REMOVED": indicates that the finding was present and matched the - // filter at the start of compare_duration, but did not match - // the filter at read_time. - // - // If compare_duration is not specified, then the only possible state_change - // is "UNUSED", which will be the state_change set for all findings present at - // read_time. - google.protobuf.Duration compare_duration = 5; - - // A field mask to specify the Finding fields to be listed in the response. - // An empty field mask will list all fields. - google.protobuf.FieldMask field_mask = 7; - - // The value returned by the last `ListFindingsResponse`; indicates - // that this is a continuation of a prior `ListFindings` call, and - // that the system should return the next page of data. - string page_token = 8; - - // The maximum number of results to return in a single response. Default is - // 10, minimum is 1, maximum is 1000. - int32 page_size = 9; -} - -// Response message for listing findings. -message ListFindingsResponse { - // Result containing the Finding and its StateChange. - message ListFindingsResult { - // Information related to the Google Cloud resource that is - // associated with this finding. - message Resource { - // The full resource name of the resource. See: - // https://cloud.google.com/apis/design/resource_names#full_resource_name - string name = 1; - - // The full resource name of project that the resource belongs to. - string project_name = 2; - - // The human readable name of project that the resource belongs to. - string project_display_name = 3; - - // The full resource name of resource's parent. - string parent_name = 4; - - // The human readable name of resource's parent. - string parent_display_name = 5; - - // Contains a Folder message for each folder in the assets ancestry. - // The first folder is the deepest nested folder, and the last folder is - // the folder directly under the Organization. - repeated Folder folders = 10; - } - - // The change in state of the finding. - // - // When querying across two points in time this describes - // the change in the finding between the two points: CHANGED, UNCHANGED, - // ADDED, or REMOVED. Findings can not be deleted, so REMOVED implies that - // the finding at timestamp does not match the filter specified, but it did - // at timestamp - compare_duration. If there was no compare_duration - // supplied in the request the state change will be: UNUSED - enum StateChange { - // State change is unused, this is the canonical default for this enum. - UNUSED = 0; - - // The finding has changed state in some way between the points in time - // and existed at both points. - CHANGED = 1; - - // The finding has not changed state between the points in time and - // existed at both points. - UNCHANGED = 2; - - // The finding was created between the points in time. - ADDED = 3; - - // The finding at timestamp does not match the filter specified, but it - // did at timestamp - compare_duration. - REMOVED = 4; - } - - // Finding matching the search request. - Finding finding = 1; - - // State change of the finding between the points in time. - StateChange state_change = 2; - - // Output only. Resource that is associated with this finding. - Resource resource = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Findings matching the list request. - repeated ListFindingsResult list_findings_results = 1; - - // Time used for executing the list request. - google.protobuf.Timestamp read_time = 2; - - // Token to retrieve the next page of results, or empty if there are no more - // results. - string next_page_token = 3; - - // The total number of findings matching the query. - int32 total_size = 4; -} - -// Request message for updating a finding's state. -message SetFindingStateRequest { - // Required. The relative resource name of the finding. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/Finding" - } - ]; - - // Required. The desired State of the finding. - Finding.State state = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The time at which the updated state takes effect. - google.protobuf.Timestamp start_time = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for running asset discovery for an organization. -message RunAssetDiscoveryRequest { - // Required. Name of the organization to run asset discovery for. Its format is - // "organizations/[organization_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Organization" - } - ]; -} - -// Request message for updating or creating a finding. -message UpdateFindingRequest { - // Required. The finding resource to update or create if it does not already exist. - // parent, security_marks, and update_time will be ignored. - // - // In the case of creation, the finding id portion of the name must be - // alphanumeric and less than or equal to 32 characters and greater than 0 - // characters in length. - Finding finding = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the finding resource. This field should - // not be specified when creating a finding. - // - // When updating a finding, an empty mask is treated as updating all mutable - // fields and replacing source_properties. Individual source_properties can - // be added/updated by using "source_properties." in the field - // mask. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a notification config. -message UpdateNotificationConfigRequest { - // Required. The notification config to update. - NotificationConfig notification_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the notification config. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating an organization's settings. -message UpdateOrganizationSettingsRequest { - // Required. The organization settings resource to update. - OrganizationSettings organization_settings = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the settings resource. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a source. -message UpdateSourceRequest { - // Required. The source resource to update. - Source source = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the source resource. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for updating a SecurityMarks resource. -message UpdateSecurityMarksRequest { - // Required. The security marks resource to update. - SecurityMarks security_marks = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the security marks resource. - // - // The field mask must not contain duplicate fields. - // If empty or set to "marks", all marks will be replaced. Individual - // marks can be updated using "marks.". - google.protobuf.FieldMask update_mask = 2; - - // The time at which the updated SecurityMarks take effect. - // If not set uses current server time. Updates will be applied to the - // SecurityMarks that are active immediately preceding this time. - google.protobuf.Timestamp start_time = 3; -} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto deleted file mode 100644 index 5f36167a..00000000 --- a/owl-bot-staging/v1p1beta1/protos/google/cloud/securitycenter/v1p1beta1/source.proto +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1p1beta1; - -import "google/api/resource.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.SecurityCenter.V1P1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1;securitycenter"; -option java_multiple_files = true; -option java_package = "com.google.cloud.securitycenter.v1p1beta1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1p1beta1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1p1beta1"; - -// Security Command Center finding source. A finding source -// is an entity or a mechanism that can produce a finding. A source is like a -// container of findings that come from the same scanner, logger, monitor, etc. -message Source { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/Source" - pattern: "organizations/{organization}/sources/{source}" - pattern: "folders/{folder}/sources/{source}" - pattern: "projects/{project}/sources/{source}" - }; - - // The relative resource name of this source. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name - // Example: - // "organizations/{organization_id}/sources/{source_id}" - string name = 1; - - // The source's display name. - // A source's display name must be unique amongst its siblings, for example, - // two sources with the same parent can't share the same display name. - // The display name must have a length between 1 and 64 characters - // (inclusive). - string display_name = 2; - - // The description of the source (max of 1024 characters). - // Example: - // "Web Security Scanner is a web security scanner for common - // vulnerabilities in App Engine applications. It can automatically - // scan and detect four common vulnerabilities, including cross-site-scripting - // (XSS), Flash injection, mixed content (HTTP in HTTPS), and - // outdated/insecure libraries." - string description = 3; - - // The canonical name of the finding. It's either - // "organizations/{organization_id}/sources/{source_id}", - // "folders/{folder_id}/sources/{source_id}" or - // "projects/{project_number}/sources/{source_id}", - // depending on the closest CRM ancestor of the resource associated with the - // finding. - string canonical_name = 14; -} diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js deleted file mode 100644 index 9eb96389..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, findingId, finding) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new finding's parent. Its format should be - * "organizations/[organization_id]/sources/[source_id]". - */ - // const parent = 'abc123' - /** - * Required. Unique identifier provided by the client within the parent scope. - */ - // const findingId = 'abc123' - /** - * Required. The Finding being created. The name and security_marks will be ignored as - * they are both output only fields on this resource. - */ - // const finding = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateFinding() { - // Construct request - const request = { - parent, - findingId, - finding, - }; - - // Run request - const response = await securitycenterClient.createFinding(request); - console.log(response); - } - - callCreateFinding(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js deleted file mode 100644 index 290b2f86..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, configId, notificationConfig) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new notification config's parent. Its format is - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * Required. Unique identifier provided by the client within the parent scope. - * It must be between 1 and 128 characters, and contains alphanumeric - * characters, underscores or hyphens only. - */ - // const configId = 'abc123' - /** - * Required. The notification config being created. The name and the service account - * will be ignored as they are both output only fields on this resource. - */ - // const notificationConfig = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateNotificationConfig() { - // Construct request - const request = { - parent, - configId, - notificationConfig, - }; - - // Run request - const response = await securitycenterClient.createNotificationConfig(request); - console.log(response); - } - - callCreateNotificationConfig(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js deleted file mode 100644 index fba03b1b..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, source) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new source's parent. Its format should be - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * Required. The Source being created, only the display_name and description will be - * used. All other fields will be ignored. - */ - // const source = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateSource() { - // Construct request - const request = { - parent, - source, - }; - - // Run request - const response = await securitycenterClient.createSource(request); - console.log(response); - } - - callCreateSource(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js deleted file mode 100644 index 77462b2f..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the notification config to delete. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callDeleteNotificationConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.deleteNotificationConfig(request); - console.log(response); - } - - callDeleteNotificationConfig(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js deleted file mode 100644 index 90c348ab..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(resource) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - */ - // const options = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await securitycenterClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js deleted file mode 100644 index 120dba67..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the notification config to get. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetNotificationConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getNotificationConfig(request); - console.log(response); - } - - callGetNotificationConfig(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js deleted file mode 100644 index d09f46d4..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to get organization settings for. Its format is - * "organizations/[organization_id]/organizationSettings". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetOrganizationSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getOrganizationSettings(request); - console.log(response); - } - - callGetOrganizationSettings(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js deleted file mode 100644 index 968bb024..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Relative resource name of the source. Its format is - * "organizations/[organization_id]/source/[source_id]". - */ - // const name = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGetSource() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getSource(request); - console.log(response); - } - - callGetSource(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js deleted file mode 100644 index 2615ed82..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, groupBy) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * The supported operators are: - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * The supported value types are: - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * The following field and operator combinations are supported: - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_name_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * For example, `resource_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - */ - // const filter = 'abc123' - /** - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * The following fields are supported when compare_duration is not set: - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * The following fields are supported when compare_duration is set: - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - */ - // const groupBy = 'abc123' - /** - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * Possible "state_change" values when compare_duration is specified: - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * If this field is set then `state_change` must be a specified field in - * `group_by`. - */ - // const compareDuration = {} - /** - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - */ - // const readTime = {} - /** - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGroupAssets() { - // Construct request - const request = { - parent, - groupBy, - }; - - // Run request - const iterable = await securitycenterClient.groupAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGroupAssets(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js deleted file mode 100644 index 87f7ec5a..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, groupBy) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * The supported operators are: - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * The supported value types are: - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * The following field and operator combinations are supported: - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * For example, `source_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - */ - // const filter = 'abc123' - /** - * Required. Expression that defines what assets fields to use for grouping (including - * `state_change`). The string value should follow SQL syntax: comma separated - * list of fields. For example: "parent,resource_name". - * The following fields are supported: - * * resource_name - * * category - * * state - * * parent - * * severity - * The following fields are supported when compare_duration is set: - * * state_change - */ - // const groupBy = 'abc123' - /** - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * Possible "state_change" values when compare_duration is specified: - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * If this field is set then `state_change` must be a specified field in - * `group_by`. - */ - // const compareDuration = {} - /** - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callGroupFindings() { - // Construct request - const request = { - parent, - groupBy, - }; - - // Run request - const iterable = await securitycenterClient.groupFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callGroupFindings(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js deleted file mode 100644 index edb3f4ae..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * The supported operators are: - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * The supported value types are: - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * The following are the allowed field and operator combinations: - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * For example, `resource_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - */ - // const filter = 'abc123' - /** - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - */ - // const orderBy = 'abc123' - /** - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * Possible "state_change" values when compare_duration is specified: - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - */ - // const compareDuration = {} - /** - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - */ - // const fieldMask = {} - /** - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListAssets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAssets(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js deleted file mode 100644 index 58d5fd5f..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - */ - // const parent = 'abc123' - /** - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * The supported operators are: - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * The supported value types are: - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * The following field and operator combinations are supported: - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * security_marks.marks: `=`, `:` - * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * For example, `source_properties.size = 100` is a valid filter string. - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - */ - // const filter = 'abc123' - /** - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - */ - // const orderBy = 'abc123' - /** - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - */ - // const readTime = {} - /** - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * Possible "state_change" values when compare_duration is specified: - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - */ - // const compareDuration = {} - /** - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - */ - // const fieldMask = {} - /** - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListFindings() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFindings(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js deleted file mode 100644 index d00b3a8f..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to list notification configs. - * Its format is "organizations/[organization_id]". - */ - // const parent = 'abc123' - /** - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListNotificationConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listNotificationConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNotificationConfigs(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js deleted file mode 100644 index d3e5613c..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - */ - // const parent = 'abc123' - /** - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - */ - // const pageSize = 1234 - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListSources() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listSourcesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSources(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js deleted file mode 100644 index 0563f160..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the organization to run asset discovery for. Its format is - * "organizations/[organization_id]". - */ - // const parent = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callRunAssetDiscovery() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await securitycenterClient.runAssetDiscovery(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRunAssetDiscovery(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js deleted file mode 100644 index 99d97f27..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name, state, startTime) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative resource name of the finding. See: - * https://cloud.google.com/apis/design/resource_names#relative_resource_name - * Example: - * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - */ - // const name = 'abc123' - /** - * Required. The desired State of the finding. - */ - // const state = {} - /** - * Required. The time at which the updated state takes effect. - */ - // const startTime = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetFindingState() { - // Construct request - const request = { - name, - state, - startTime, - }; - - // Run request - const response = await securitycenterClient.setFindingState(request); - console.log(response); - } - - callSetFindingState(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js deleted file mode 100644 index 8fdb23eb..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(resource, policy) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - */ - // const policy = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await securitycenterClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js deleted file mode 100644 index e69d5caf..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(resource, permissions) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). - */ - // const permissions = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await securitycenterClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js deleted file mode 100644 index 9dcc69b5..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(finding) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The finding resource to update or create if it does not already exist. - * parent, security_marks, and update_time will be ignored. - * In the case of creation, the finding id portion of the name must be - * alphanumeric and less than or equal to 32 characters and greater than 0 - * characters in length. - */ - // const finding = {} - /** - * The FieldMask to use when updating the finding resource. This field should - * not be specified when creating a finding. - * When updating a finding, an empty mask is treated as updating all mutable - * fields and replacing source_properties. Individual source_properties can - * be added/updated by using "source_properties." in the field - * mask. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateFinding() { - // Construct request - const request = { - finding, - }; - - // Run request - const response = await securitycenterClient.updateFinding(request); - console.log(response); - } - - callUpdateFinding(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js deleted file mode 100644 index 54718b4b..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(notificationConfig) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The notification config to update. - */ - // const notificationConfig = {} - /** - * The FieldMask to use when updating the notification config. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateNotificationConfig() { - // Construct request - const request = { - notificationConfig, - }; - - // Run request - const response = await securitycenterClient.updateNotificationConfig(request); - console.log(response); - } - - callUpdateNotificationConfig(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js deleted file mode 100644 index 0786b122..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(organizationSettings) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The organization settings resource to update. - */ - // const organizationSettings = {} - /** - * The FieldMask to use when updating the settings resource. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateOrganizationSettings() { - // Construct request - const request = { - organizationSettings, - }; - - // Run request - const response = await securitycenterClient.updateOrganizationSettings(request); - console.log(response); - } - - callUpdateOrganizationSettings(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js deleted file mode 100644 index 33cfe18d..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(securityMarks) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The security marks resource to update. - */ - // const securityMarks = {} - /** - * The FieldMask to use when updating the security marks resource. - * The field mask must not contain duplicate fields. - * If empty or set to "marks", all marks will be replaced. Individual - * marks can be updated using "marks.". - */ - // const updateMask = {} - /** - * The time at which the updated SecurityMarks take effect. - * If not set uses current server time. Updates will be applied to the - * SecurityMarks that are active immediately preceding this time. - */ - // const startTime = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateSecurityMarks() { - // Construct request - const request = { - securityMarks, - }; - - // Run request - const response = await securitycenterClient.updateSecurityMarks(request); - console.log(response); - } - - callUpdateSecurityMarks(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js deleted file mode 100644 index 9078baab..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(source) { - // [START securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The source resource to update. - */ - // const source = {} - /** - * The FieldMask to use when updating the source resource. - * If empty all mutable fields will be updated. - */ - // const updateMask = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1p1beta1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callUpdateSource() { - // Construct request - const request = { - source, - }; - - // Run request - const response = await securitycenterClient.updateSource(request); - console.log(response); - } - - callUpdateSource(); - // [END securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/src/index.ts b/owl-bot-staging/v1p1beta1/src/index.ts deleted file mode 100644 index 6ddd67bf..00000000 --- a/owl-bot-staging/v1p1beta1/src/index.ts +++ /dev/null @@ -1,25 +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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1p1beta1 from './v1p1beta1'; -const SecurityCenterClient = v1p1beta1.SecurityCenterClient; -type SecurityCenterClient = v1p1beta1.SecurityCenterClient; -export {v1p1beta1, SecurityCenterClient}; -export default {v1p1beta1, SecurityCenterClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json b/owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json deleted file mode 100644 index c0d8ccc6..00000000 --- a/owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json +++ /dev/null @@ -1,277 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.securitycenter.v1p1beta1", - "libraryPackage": "@google-cloud/security-center", - "services": { - "SecurityCenter": { - "clients": { - "grpc": { - "libraryClient": "SecurityCenterClient", - "rpcs": { - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "CreateFinding": { - "methods": [ - "createFinding" - ] - }, - "CreateNotificationConfig": { - "methods": [ - "createNotificationConfig" - ] - }, - "DeleteNotificationConfig": { - "methods": [ - "deleteNotificationConfig" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetNotificationConfig": { - "methods": [ - "getNotificationConfig" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateNotificationConfig": { - "methods": [ - "updateNotificationConfig" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListNotificationConfigs": { - "methods": [ - "listNotificationConfigs", - "listNotificationConfigsStream", - "listNotificationConfigsAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SecurityCenterClient", - "rpcs": { - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "CreateFinding": { - "methods": [ - "createFinding" - ] - }, - "CreateNotificationConfig": { - "methods": [ - "createNotificationConfig" - ] - }, - "DeleteNotificationConfig": { - "methods": [ - "deleteNotificationConfig" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetNotificationConfig": { - "methods": [ - "getNotificationConfig" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateNotificationConfig": { - "methods": [ - "updateNotificationConfig" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListNotificationConfigs": { - "methods": [ - "listNotificationConfigs", - "listNotificationConfigsStream", - "listNotificationConfigsAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts b/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts deleted file mode 100644 index de26020d..00000000 --- a/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts +++ /dev/null @@ -1,19 +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. -// -// ** 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 {SecurityCenterClient} from './security_center_client'; diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client.ts b/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client.ts deleted file mode 100644 index 77aa23f6..00000000 --- a/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client.ts +++ /dev/null @@ -1,4923 +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. -// -// ** 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, LROperation, 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/v1p1beta1/security_center_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './security_center_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * V1p1Beta1 APIs for Security Center service. - * @class - * @memberof v1p1beta1 - */ -export class SecurityCenterClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - securityCenterStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SecurityCenterClient. - * - * @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). - * 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} [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. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SecurityCenterClient; - 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 = { - folderAssetPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/assets/{asset}' - ), - folderAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/assets/{asset}/securityMarks' - ), - folderSourcePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}' - ), - folderSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}/findings/{finding}' - ), - folderSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}/findings/{finding}/securityMarks' - ), - notificationConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationConfigs/{notification_config}' - ), - organizationPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}' - ), - organizationAssetPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/assets/{asset}' - ), - organizationAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/assets/{asset}/securityMarks' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/organizationSettings' - ), - organizationSourcePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}' - ), - organizationSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}' - ), - organizationSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}/securityMarks' - ), - projectAssetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/assets/{asset}' - ), - projectAssetSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/assets/{asset}/securityMarks' - ), - projectSourcePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}' - ), - projectSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}/findings/{finding}' - ), - projectSourceFindingSecurityMarksPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}/findings/{finding}/securityMarks' - ), - }; - - // 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 = { - groupAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), - groupFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groupByResults'), - listAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listAssetsResults'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'listFindingsResults'), - listNotificationConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notificationConfigs'), - listSources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const runAssetDiscoveryResponse = protoFilesRoot.lookup( - '.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryResponse') as gax.protobuf.Type; - const runAssetDiscoveryMetadata = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - - this.descriptors.longrunning = { - runAssetDiscovery: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - runAssetDiscoveryResponse.decode.bind(runAssetDiscoveryResponse), - runAssetDiscoveryMetadata.decode.bind(runAssetDiscoveryMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.securitycenter.v1p1beta1.SecurityCenter', 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.securityCenterStub) { - return this.securityCenterStub; - } - - // Put together the "service stub" for - // google.cloud.securitycenter.v1p1beta1.SecurityCenter. - this.securityCenterStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.securitycenter.v1p1beta1.SecurityCenter') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.securitycenter.v1p1beta1.SecurityCenter, - 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 securityCenterStubMethods = - ['createSource', 'createFinding', 'createNotificationConfig', 'deleteNotificationConfig', 'getIamPolicy', 'getNotificationConfig', 'getOrganizationSettings', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listFindings', 'listNotificationConfigs', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setIamPolicy', 'testIamPermissions', 'updateFinding', 'updateNotificationConfig', 'updateOrganizationSettings', 'updateSource', 'updateSecurityMarks']; - for (const methodName of securityCenterStubMethods) { - const callPromise = this.securityCenterStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.securityCenterStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'securitycenter.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 'securitycenter.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 source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new source's parent. Its format should be - * "organizations/[organization_id]". - * @param {google.cloud.securitycenter.v1p1beta1.Source} request.source - * Required. The Source being created, only the display_name and description will be - * used. All other fields will be ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Source]{@link google.cloud.securitycenter.v1p1beta1.Source}. - * 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/v1p1beta1/security_center.create_source.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async - */ - createSource( - request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|undefined, {}|undefined - ]>; - createSource( - request: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): void; - createSource( - request: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): void; - createSource( - request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.ICreateSourceRequest|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.createSource(request, options, callback); - } -/** - * Creates a finding. The corresponding source must exist for finding - * creation to succeed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new finding's parent. Its format should be - * "organizations/[organization_id]/sources/[source_id]". - * @param {string} request.findingId - * Required. Unique identifier provided by the client within the parent scope. - * @param {google.cloud.securitycenter.v1p1beta1.Finding} request.finding - * Required. The Finding being created. The name and security_marks will be ignored as - * they are both output only fields on this resource. - * @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.securitycenter.v1p1beta1.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/v1p1beta1/security_center.create_finding.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async - */ - createFinding( - request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|undefined, {}|undefined - ]>; - createFinding( - request: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): void; - createFinding( - request: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): void; - createFinding( - request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ICreateFindingRequest|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.createFinding(request, options, callback); - } -/** - * Creates a notification config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new notification config's parent. Its format is - * "organizations/[organization_id]". - * @param {string} request.configId - * Required. Unique identifier provided by the client within the parent scope. - * It must be between 1 and 128 characters, and contains alphanumeric - * characters, underscores or hyphens only. - * @param {google.cloud.securitycenter.v1p1beta1.NotificationConfig} request.notificationConfig - * Required. The notification config being created. The name and the service account - * will be ignored as they are both output only fields on this resource. - * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1p1beta1.NotificationConfig}. - * 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/v1p1beta1/security_center.create_notification_config.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async - */ - createNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|undefined, {}|undefined - ]>; - createNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - createNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - createNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.ICreateNotificationConfigRequest|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.createNotificationConfig(request, options, callback); - } -/** - * Deletes a notification config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the notification config to delete. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.delete_notification_config.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async - */ - deleteNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|undefined, {}|undefined - ]>; - deleteNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1p1beta1.IDeleteNotificationConfigRequest|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.deleteNotificationConfig(request, options, callback); - } -/** - * Gets the access control policy on the specified Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * @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 [Policy]{@link google.iam.v1.Policy}. - * 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/v1p1beta1/security_center.get_iam_policy.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|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({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.getIamPolicy(request, options, callback); - } -/** - * Gets a notification config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the notification config to get. Its format is - * "organizations/[organization_id]/notificationConfigs/[config_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [NotificationConfig]{@link google.cloud.securitycenter.v1p1beta1.NotificationConfig}. - * 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/v1p1beta1/security_center.get_notification_config.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async - */ - getNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|undefined, {}|undefined - ]>; - getNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - getNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - getNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IGetNotificationConfigRequest|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.getNotificationConfig(request, options, callback); - } -/** - * Gets the settings for an organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the organization to get organization settings for. Its format is - * "organizations/[organization_id]/organizationSettings". - * @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 [OrganizationSettings]{@link google.cloud.securitycenter.v1p1beta1.OrganizationSettings}. - * 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/v1p1beta1/security_center.get_organization_settings.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async - */ - getOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|undefined, {}|undefined - ]>; - getOrganizationSettings( - request: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - getOrganizationSettings( - request: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - getOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IGetOrganizationSettingsRequest|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.getOrganizationSettings(request, options, callback); - } -/** - * Gets a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Relative resource name of the source. Its format is - * "organizations/[organization_id]/source/[source_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Source]{@link google.cloud.securitycenter.v1p1beta1.Source}. - * 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/v1p1beta1/security_center.get_source.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async - */ - getSource( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|undefined, {}|undefined - ]>; - getSource( - request: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; - getSource( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IGetSourceRequest|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.getSource(request, options, callback); - } -/** - * Updates the state of a finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The relative resource name of the finding. See: - * https://cloud.google.com/apis/design/resource_names#relative_resource_name - * Example: - * "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}". - * @param {google.cloud.securitycenter.v1p1beta1.Finding.State} request.state - * Required. The desired State of the finding. - * @param {google.protobuf.Timestamp} request.startTime - * Required. The time at which the updated state takes effect. - * @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.securitycenter.v1p1beta1.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/v1p1beta1/security_center.set_finding_state.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async - */ - setFindingState( - request?: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|undefined, {}|undefined - ]>; - setFindingState( - request: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): void; - setFindingState( - request: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): void; - setFindingState( - request?: protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.ISetFindingStateRequest|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.setFindingState(request, options, callback); - } -/** - * Sets the access control policy on the specified Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @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 [Policy]{@link google.iam.v1.Policy}. - * 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/v1p1beta1/security_center.set_iam_policy.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async - */ - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|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({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.setIamPolicy(request, options, callback); - } -/** - * Returns the permissions that a caller has on the specified source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @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 [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * 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/v1p1beta1/security_center.test_iam_permissions.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async - */ - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|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({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.testIamPermissions(request, options, callback); - } -/** - * Creates or updates a finding. The corresponding source must exist for a - * finding creation to succeed. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1p1beta1.Finding} request.finding - * Required. The finding resource to update or create if it does not already exist. - * parent, security_marks, and update_time will be ignored. - * - * In the case of creation, the finding id portion of the name must be - * alphanumeric and less than or equal to 32 characters and greater than 0 - * characters in length. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the finding resource. This field should - * not be specified when creating a finding. - * - * When updating a finding, an empty mask is treated as updating all mutable - * fields and replacing source_properties. Individual source_properties can - * be added/updated by using "source_properties." in the field - * mask. - * @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.securitycenter.v1p1beta1.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/v1p1beta1/security_center.update_finding.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async - */ - updateFinding( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|undefined, {}|undefined - ]>; - updateFinding( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): void; - updateFinding( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): void; - updateFinding( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IFinding, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateFindingRequest|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({ - 'finding.name': request.finding!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateFinding(request, options, callback); - } -/** - * Updates a notification config. The following update - * fields are allowed: description, pubsub_topic, streaming_config.filter - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1p1beta1.NotificationConfig} request.notificationConfig - * Required. The notification config to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the notification config. - * - * If empty all mutable fields will be updated. - * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1p1beta1.NotificationConfig}. - * 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/v1p1beta1/security_center.update_notification_config.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async - */ - updateNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|undefined, {}|undefined - ]>; - updateNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - updateNotificationConfig( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>): void; - updateNotificationConfig( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateNotificationConfigRequest|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({ - 'notification_config.name': request.notificationConfig!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateNotificationConfig(request, options, callback); - } -/** - * Updates an organization's settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1p1beta1.OrganizationSettings} request.organizationSettings - * Required. The organization settings resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the settings resource. - * - * If empty all mutable fields will be updated. - * @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 [OrganizationSettings]{@link google.cloud.securitycenter.v1p1beta1.OrganizationSettings}. - * 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/v1p1beta1/security_center.update_organization_settings.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async - */ - updateOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|undefined, {}|undefined - ]>; - updateOrganizationSettings( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateOrganizationSettings( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateOrganizationSettings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateOrganizationSettingsRequest|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({ - 'organization_settings.name': request.organizationSettings!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateOrganizationSettings(request, options, callback); - } -/** - * Updates a source. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1p1beta1.Source} request.source - * Required. The source resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the source resource. - * - * If empty all mutable fields will be updated. - * @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 [Source]{@link google.cloud.securitycenter.v1p1beta1.Source}. - * 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/v1p1beta1/security_center.update_source.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async - */ - updateSource( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|undefined, {}|undefined - ]>; - updateSource( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): void; - updateSource( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): void; - updateSource( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSourceRequest|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({ - 'source.name': request.source!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateSource(request, options, callback); - } -/** - * Updates security marks. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1p1beta1.SecurityMarks} request.securityMarks - * Required. The security marks resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the security marks resource. - * - * The field mask must not contain duplicate fields. - * If empty or set to "marks", all marks will be replaced. Individual - * marks can be updated using "marks.". - * @param {google.protobuf.Timestamp} request.startTime - * The time at which the updated SecurityMarks take effect. - * If not set uses current server time. Updates will be applied to the - * SecurityMarks that are active immediately preceding this time. - * @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 [SecurityMarks]{@link google.cloud.securitycenter.v1p1beta1.SecurityMarks}. - * 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/v1p1beta1/security_center.update_security_marks.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async - */ - updateSecurityMarks( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|undefined, {}|undefined - ]>; - updateSecurityMarks( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityMarks( - request: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): void; - updateSecurityMarks( - request?: protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks, - protos.google.cloud.securitycenter.v1p1beta1.IUpdateSecurityMarksRequest|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({ - 'security_marks.name': request.securityMarks!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateSecurityMarks(request, options, callback); - } - -/** - * Runs asset discovery. The discovery is tracked with a long-running - * operation. - * - * This API can only be called with limited frequency for an organization. If - * it is called too frequently the caller will receive a TOO_MANY_REQUESTS - * error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to run asset discovery for. Its format is - * "organizations/[organization_id]". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.run_asset_discovery.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async - */ - runAssetDiscovery( - request?: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - runAssetDiscovery( - request: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runAssetDiscovery( - request: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - runAssetDiscovery( - request?: protos.google.cloud.securitycenter.v1p1beta1.IRunAssetDiscoveryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.runAssetDiscovery(request, options, callback); - } -/** - * Check the status of the long running operation returned by `runAssetDiscovery()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.run_asset_discovery.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async - */ - async checkRunAssetDiscoveryProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.runAssetDiscovery, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Filters an organization's assets and groups them by their specified - * properties. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_name_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [GroupResult]{@link google.cloud.securitycenter.v1p1beta1.GroupResult}. - * 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 `groupAssetsAsync()` - * 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. - */ - groupAssets( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse - ]>; - groupAssets( - request: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; - groupAssets( - request: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; - groupAssets( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsResponse - ]>|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.groupAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_name_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [GroupResult]{@link google.cloud.securitycenter.v1p1beta1.GroupResult} 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 `groupAssetsAsync()` - * 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. - */ - groupAssetsStream( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - 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['groupAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupAssets.createStream( - this.innerApiCalls.groupAssets as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `groupAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to groupBy. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_name_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping. The string - * value should follow SQL syntax: comma separated list of fields. For - * example: - * "security_center_properties.resource_project,security_center_properties.project". - * - * The following fields are supported when compare_duration is not set: - * - * * security_center_properties.resource_project - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_type - * * security_center_properties.resource_parent - * * security_center_properties.resource_parent_display_name - * - * The following fields are supported when compare_duration is set: - * - * * security_center_properties.resource_type - * * security_center_properties.resource_project_display_name - * * security_center_properties.resource_parent_display_name - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" property is - * updated to indicate whether the asset was added, removed, or remained - * present during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at reference_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at reference_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and reference_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {string} request.pageToken - * The value returned by the last `GroupAssetsResponse`; indicates - * that this is a continuation of a prior `GroupAssets` call, and that the - * system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [GroupResult]{@link google.cloud.securitycenter.v1p1beta1.GroupResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.group_assets.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async - */ - groupAssetsAsync( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupAssetsRequest, - 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['groupAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupAssets.asyncIterate( - this.innerApiCalls['groupAssets'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Filters an organization or source's findings and groups them by their - * specified properties. - * - * To group across all sources provide a `-` as the source id. - * Example: /v1/organizations/{organization_id}/sources/-/findings, - * /v1/folders/{folder_id}/sources/-/findings, - * /v1/projects/{project_id}/sources/-/findings - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state_change`). The string value should follow SQL syntax: comma separated - * list of fields. For example: "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * * severity - * - * The following fields are supported when compare_duration is set: - * - * * state_change - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [GroupResult]{@link google.cloud.securitycenter.v1p1beta1.GroupResult}. - * 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 `groupFindingsAsync()` - * 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. - */ - groupFindings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse - ]>; - groupFindings( - request: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; - groupFindings( - request: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): void; - groupFindings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[], - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsResponse - ]>|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.groupFindings(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state_change`). The string value should follow SQL syntax: comma separated - * list of fields. For example: "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * * severity - * - * The following fields are supported when compare_duration is set: - * - * * state_change - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [GroupResult]{@link google.cloud.securitycenter.v1p1beta1.GroupResult} 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 `groupFindingsAsync()` - * 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. - */ - groupFindingsStream( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - 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['groupFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupFindings.createStream( - this.innerApiCalls.groupFindings as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `groupFindings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source to groupBy. Its format is - * "organizations/[organization_id]/sources/[source_id]", - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]. To groupBy across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/-, - * or projects/{project_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * * security_marks.marks: `=`, `:` - * * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * @param {string} request.groupBy - * Required. Expression that defines what assets fields to use for grouping (including - * `state_change`). The string value should follow SQL syntax: comma separated - * list of fields. For example: "parent,resource_name". - * - * The following fields are supported: - * - * * resource_name - * * category - * * state - * * parent - * * severity - * - * The following fields are supported when compare_duration is set: - * - * * state_change - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the GroupResult's "state_change" attribute is - * updated to indicate whether the finding had its state changed, the - * finding's state remained unchanged, or if the finding was added during the - * compare_duration period of time that precedes the read_time. This is the - * time between (read_time - compare_duration) and read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present - * at read_time. - * - * If this field is set then `state_change` must be a specified field in - * `group_by`. - * @param {string} request.pageToken - * The value returned by the last `GroupFindingsResponse`; indicates - * that this is a continuation of a prior `GroupFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [GroupResult]{@link google.cloud.securitycenter.v1p1beta1.GroupResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.group_findings.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async - */ - groupFindingsAsync( - request?: protos.google.cloud.securitycenter.v1p1beta1.IGroupFindingsRequest, - 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['groupFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.groupFindings.asyncIterate( - this.innerApiCalls['groupFindings'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists an organization's assets. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following are the allowed field and operator combinations: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [ListAssetsResult]{@link google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssets( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[], - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse - ]>; - listAssets( - request: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>): void; - listAssets( - request: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>): void; - listAssets( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[], - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListAssetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following are the allowed field and operator combinations: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [ListAssetsResult]{@link google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssetsStream( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.createStream( - this.innerApiCalls.listAssets as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization assets should belong to. Its format is - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.filter - * Expression that defines the filter to apply across assets. - * The expression is a list of zero or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. The fields map to those - * defined in the Asset resource. Examples include: - * - * * name - * * security_center_properties.resource_name - * * resource_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following are the allowed field and operator combinations: - * - * * name: `=` - * * update_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `update_time = "2019-06-10T16:07:18-07:00"` - * `update_time = 1560208038000` - * - * * create_time: `=`, `>`, `<`, `>=`, `<=` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `create_time = "2019-06-10T16:07:18-07:00"` - * `create_time = 1560208038000` - * - * * iam_policy.policy_blob: `=`, `:` - * * resource_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * * security_marks.marks: `=`, `:` - * * security_center_properties.resource_name: `=`, `:` - * * security_center_properties.resource_display_name: `=`, `:` - * * security_center_properties.resource_type: `=`, `:` - * * security_center_properties.resource_parent: `=`, `:` - * * security_center_properties.resource_parent_display_name: `=`, `:` - * * security_center_properties.resource_project: `=`, `:` - * * security_center_properties.resource_project_display_name: `=`, `:` - * * security_center_properties.resource_owners: `=`, `:` - * - * For example, `resource_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `resource_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-resource_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,resource_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,resource_properties.a_property" and " - * name desc , resource_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * update_time - * resource_properties - * security_marks.marks - * security_center_properties.resource_name - * security_center_properties.resource_display_name - * security_center_properties.resource_parent - * security_center_properties.resource_parent_display_name - * security_center_properties.resource_project - * security_center_properties.resource_project_display_name - * security_center_properties.resource_type - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering assets. The filter is limited - * to assets existing at the supplied time and their values are those at that - * specific time. Absence of this field will default to the API's version of - * NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListAssetsResult's "state_change" - * attribute is updated to indicate whether the asset was added, removed, or - * remained present during the compare_duration period of time that precedes - * the read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence of the asset at the - * two points in time. Intermediate state changes between the two times don't - * affect the result. For example, the results aren't affected if the asset is - * removed and re-created again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "ADDED": indicates that the asset was not present at the start of - * compare_duration, but present at read_time. - * * "REMOVED": indicates that the asset was present at the start of - * compare_duration, but not present at read_time. - * * "ACTIVE": indicates that the asset was present at both the - * start and the end of the time period defined by - * compare_duration and read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all assets present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the ListAssetsResult fields to be listed in the - * response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListAssetsResponse`; indicates - * that this is a continuation of a prior `ListAssets` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [ListAssetsResult]{@link google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.list_assets.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async - */ - listAssetsAsync( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListAssetsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.asyncIterate( - this.innerApiCalls['listAssets'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists an organization or source's findings. - * - * To list across all sources provide a `-` as the source id. - * Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * security_marks.marks: `=`, `:` - * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [ListFindingsResult]{@link google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult}. - * 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.securitycenter.v1p1beta1.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[], - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse - ]>; - listFindings( - request: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>): void; - listFindings( - request: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>): void; - listFindings( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[], - protos.google.cloud.securitycenter.v1p1beta1.IListFindingsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.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. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * security_marks.marks: `=`, `:` - * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [ListFindingsResult]{@link google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult} 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.securitycenter.v1p1beta1.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. Name of the source the findings belong to. Its format is - * "organizations/[organization_id]/sources/[source_id], - * folders/[folder_id]/sources/[source_id], or - * projects/[project_id]/sources/[source_id]". To list across all sources - * provide a source_id of `-`. For example: - * organizations/{organization_id}/sources/-, folders/{folder_id}/sources/- or - * projects/{projects_id}/sources/- - * @param {string} request.filter - * Expression that defines the filter to apply across findings. - * The expression is a list of one or more restrictions combined via logical - * operators `AND` and `OR`. - * Parentheses are supported, and `OR` has higher precedence than `AND`. - * - * Restrictions have the form ` ` and may have a `-` - * character in front of them to indicate negation. Examples include: - * - * * name - * * source_properties.a_property - * * security_marks.marks.marka - * - * The supported operators are: - * - * * `=` for all value types. - * * `>`, `<`, `>=`, `<=` for integer values. - * * `:`, meaning substring matching, for strings. - * - * The supported value types are: - * - * * string literals in quotes. - * * integer literals without quotes. - * * boolean literals `true` and `false` without quotes. - * - * The following field and operator combinations are supported: - * - * * name: `=` - * * parent: `=`, `:` - * * resource_name: `=`, `:` - * * state: `=`, `:` - * * category: `=`, `:` - * * external_uri: `=`, `:` - * * event_time: `=`, `>`, `<`, `>=`, `<=` - * * severity: `=`, `:` - * - * Usage: This should be milliseconds since epoch or an RFC3339 string. - * Examples: - * `event_time = "2019-06-10T16:07:18-07:00"` - * `event_time = 1560208038000` - * - * security_marks.marks: `=`, `:` - * source_properties: `=`, `:`, `>`, `<`, `>=`, `<=` - * - * For example, `source_properties.size = 100` is a valid filter string. - * - * Use a partial match on the empty string to filter based on a property - * existing: `source_properties.my_property : ""` - * - * Use a negated partial match on the empty string to filter based on a - * property not existing: `-source_properties.my_property : ""` - * @param {string} request.orderBy - * Expression that defines what fields and order to use for sorting. The - * string value should follow SQL syntax: comma separated list of fields. For - * example: "name,resource_properties.a_property". The default sorting order - * is ascending. To specify descending order for a field, a suffix " desc" - * should be appended to the field name. For example: "name - * desc,source_properties.a_property". Redundant space characters in the - * syntax are insignificant. "name desc,source_properties.a_property" and " - * name desc , source_properties.a_property " are equivalent. - * - * The following fields are supported: - * name - * parent - * state - * category - * resource_name - * event_time - * source_properties - * security_marks.marks - * @param {google.protobuf.Timestamp} request.readTime - * Time used as a reference point when filtering findings. The filter is - * limited to findings existing at the supplied time and their values are - * those at that specific time. Absence of this field will default to the - * API's version of NOW. - * @param {google.protobuf.Duration} request.compareDuration - * When compare_duration is set, the ListFindingsResult's "state_change" - * attribute is updated to indicate whether the finding had its state changed, - * the finding's state remained unchanged, or if the finding was added in any - * state during the compare_duration period of time that precedes the - * read_time. This is the time between (read_time - compare_duration) and - * read_time. - * - * The state_change value is derived based on the presence and state of the - * finding at the two points in time. Intermediate state changes between the - * two times don't affect the result. For example, the results aren't affected - * if the finding is made inactive and then active again. - * - * Possible "state_change" values when compare_duration is specified: - * - * * "CHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration, but changed its - * state at read_time. - * * "UNCHANGED": indicates that the finding was present and matched the given - * filter at the start of compare_duration and did not change - * state at read_time. - * * "ADDED": indicates that the finding did not match the given filter or - * was not present at the start of compare_duration, but was - * present at read_time. - * * "REMOVED": indicates that the finding was present and matched the - * filter at the start of compare_duration, but did not match - * the filter at read_time. - * - * If compare_duration is not specified, then the only possible state_change - * is "UNUSED", which will be the state_change set for all findings present at - * read_time. - * @param {google.protobuf.FieldMask} request.fieldMask - * A field mask to specify the Finding fields to be listed in the response. - * An empty field mask will list all fields. - * @param {string} request.pageToken - * The value returned by the last `ListFindingsResponse`; indicates - * that this is a continuation of a prior `ListFindings` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [ListFindingsResult]{@link google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.list_findings.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async - */ - listFindingsAsync( - request?: protos.google.cloud.securitycenter.v1p1beta1.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; - } - /** - * Lists notification configs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to list notification configs. - * Its format is "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1p1beta1.NotificationConfig}. - * 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 `listNotificationConfigsAsync()` - * 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. - */ - listNotificationConfigs( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[], - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse - ]>; - listNotificationConfigs( - request: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>): void; - listNotificationConfigs( - request: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>): void; - listNotificationConfigs( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[], - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsResponse - ]>|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.listNotificationConfigs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to list notification configs. - * Its format is "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [NotificationConfig]{@link google.cloud.securitycenter.v1p1beta1.NotificationConfig} 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 `listNotificationConfigsAsync()` - * 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. - */ - listNotificationConfigsStream( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - 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['listNotificationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNotificationConfigs.createStream( - this.innerApiCalls.listNotificationConfigs as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNotificationConfigs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization to list notification configs. - * Its format is "organizations/[organization_id]". - * @param {string} request.pageToken - * The value returned by the last `ListNotificationConfigsResponse`; indicates - * that this is a continuation of a prior `ListNotificationConfigs` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [NotificationConfig]{@link google.cloud.securitycenter.v1p1beta1.NotificationConfig}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.list_notification_configs.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async - */ - listNotificationConfigsAsync( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListNotificationConfigsRequest, - 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['listNotificationConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listNotificationConfigs.asyncIterate( - this.innerApiCalls['listNotificationConfigs'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists all sources belonging to an organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [Source]{@link google.cloud.securitycenter.v1p1beta1.Source}. - * 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 `listSourcesAsync()` - * 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. - */ - listSources( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource[], - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse - ]>; - listSources( - request: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ISource>): void; - listSources( - request: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ISource>): void; - listSources( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ISource>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse|null|undefined, - protos.google.cloud.securitycenter.v1p1beta1.ISource>): - Promise<[ - protos.google.cloud.securitycenter.v1p1beta1.ISource[], - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest|null, - protos.google.cloud.securitycenter.v1p1beta1.IListSourcesResponse - ]>|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.listSources(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. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 [Source]{@link google.cloud.securitycenter.v1p1beta1.Source} 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 `listSourcesAsync()` - * 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. - */ - listSourcesStream( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - 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['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.createStream( - this.innerApiCalls.listSources as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSources`, 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. Resource name of the parent of sources to list. Its format should be - * "organizations/[organization_id], folders/[folder_id], or - * projects/[project_id]". - * @param {string} request.pageToken - * The value returned by the last `ListSourcesResponse`; indicates - * that this is a continuation of a prior `ListSources` call, and - * that the system should return the next page of data. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. Default is - * 10, minimum is 1, maximum is 1000. - * @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 - * [Source]{@link google.cloud.securitycenter.v1p1beta1.Source}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/security_center.list_sources.js - * region_tag:securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async - */ - listSourcesAsync( - request?: protos.google.cloud.securitycenter.v1p1beta1.IListSourcesRequest, - 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['listSources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSources.asyncIterate( - this.innerApiCalls['listSources'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAsset resource name string. - * - * @param {string} folder - * @param {string} asset - * @returns {string} Resource name string. - */ - folderAssetPath(folder:string,asset:string) { - return this.pathTemplates.folderAssetPathTemplate.render({ - folder: folder, - asset: asset, - }); - } - - /** - * Parse the folder from FolderAsset resource. - * - * @param {string} folderAssetName - * A fully-qualified path representing folder_asset resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAssetName(folderAssetName: string) { - return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).folder; - } - - /** - * Parse the asset from FolderAsset resource. - * - * @param {string} folderAssetName - * A fully-qualified path representing folder_asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromFolderAssetName(folderAssetName: string) { - return this.pathTemplates.folderAssetPathTemplate.match(folderAssetName).asset; - } - - /** - * Return a fully-qualified folderAssetSecurityMarks resource name string. - * - * @param {string} folder - * @param {string} asset - * @returns {string} Resource name string. - */ - folderAssetSecurityMarksPath(folder:string,asset:string) { - return this.pathTemplates.folderAssetSecurityMarksPathTemplate.render({ - folder: folder, - asset: asset, - }); - } - - /** - * Parse the folder from FolderAssetSecurityMarks resource. - * - * @param {string} folderAssetSecurityMarksName - * A fully-qualified path representing folder_asset_securityMarks resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { - return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).folder; - } - - /** - * Parse the asset from FolderAssetSecurityMarks resource. - * - * @param {string} folderAssetSecurityMarksName - * A fully-qualified path representing folder_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromFolderAssetSecurityMarksName(folderAssetSecurityMarksName: string) { - return this.pathTemplates.folderAssetSecurityMarksPathTemplate.match(folderAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified folderSource resource name string. - * - * @param {string} folder - * @param {string} source - * @returns {string} Resource name string. - */ - folderSourcePath(folder:string,source:string) { - return this.pathTemplates.folderSourcePathTemplate.render({ - folder: folder, - source: source, - }); - } - - /** - * Parse the folder from FolderSource resource. - * - * @param {string} folderSourceName - * A fully-qualified path representing folder_source resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceName(folderSourceName: string) { - return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).folder; - } - - /** - * Parse the source from FolderSource resource. - * - * @param {string} folderSourceName - * A fully-qualified path representing folder_source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceName(folderSourceName: string) { - return this.pathTemplates.folderSourcePathTemplate.match(folderSourceName).source; - } - - /** - * Return a fully-qualified folderSourceFinding resource name string. - * - * @param {string} folder - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - folderSourceFindingPath(folder:string,source:string,finding:string) { - return this.pathTemplates.folderSourceFindingPathTemplate.render({ - folder: folder, - source: source, - finding: finding, - }); - } - - /** - * Parse the folder from FolderSourceFinding resource. - * - * @param {string} folderSourceFindingName - * A fully-qualified path representing folder_source_finding resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceFindingName(folderSourceFindingName: string) { - return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).folder; - } - - /** - * Parse the source from FolderSourceFinding resource. - * - * @param {string} folderSourceFindingName - * A fully-qualified path representing folder_source_finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceFindingName(folderSourceFindingName: string) { - return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).source; - } - - /** - * Parse the finding from FolderSourceFinding resource. - * - * @param {string} folderSourceFindingName - * A fully-qualified path representing folder_source_finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFolderSourceFindingName(folderSourceFindingName: string) { - return this.pathTemplates.folderSourceFindingPathTemplate.match(folderSourceFindingName).finding; - } - - /** - * Return a fully-qualified folderSourceFindingSecurityMarks resource name string. - * - * @param {string} folder - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - folderSourceFindingSecurityMarksPath(folder:string,source:string,finding:string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render({ - folder: folder, - source: source, - finding: finding, - }); - } - - /** - * Parse the folder from FolderSourceFindingSecurityMarks resource. - * - * @param {string} folderSourceFindingSecurityMarksName - * A fully-qualified path representing folder_source_finding_securityMarks resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).folder; - } - - /** - * Parse the source from FolderSourceFindingSecurityMarks resource. - * - * @param {string} folderSourceFindingSecurityMarksName - * A fully-qualified path representing folder_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from FolderSourceFindingSecurityMarks resource. - * - * @param {string} folderSourceFindingSecurityMarksName - * A fully-qualified path representing folder_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFolderSourceFindingSecurityMarksName(folderSourceFindingSecurityMarksName: string) { - return this.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match(folderSourceFindingSecurityMarksName).finding; - } - - /** - * Return a fully-qualified notificationConfig resource name string. - * - * @param {string} organization - * @param {string} notification_config - * @returns {string} Resource name string. - */ - notificationConfigPath(organization:string,notificationConfig:string) { - return this.pathTemplates.notificationConfigPathTemplate.render({ - organization: organization, - notification_config: notificationConfig, - }); - } - - /** - * Parse the organization from NotificationConfig resource. - * - * @param {string} notificationConfigName - * A fully-qualified path representing NotificationConfig resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromNotificationConfigName(notificationConfigName: string) { - return this.pathTemplates.notificationConfigPathTemplate.match(notificationConfigName).organization; - } - - /** - * Parse the notification_config from NotificationConfig resource. - * - * @param {string} notificationConfigName - * A fully-qualified path representing NotificationConfig resource. - * @returns {string} A string representing the notification_config. - */ - matchNotificationConfigFromNotificationConfigName(notificationConfigName: string) { - return this.pathTemplates.notificationConfigPathTemplate.match(notificationConfigName).notification_config; - } - - /** - * Return a fully-qualified organization resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationPath(organization:string) { - return this.pathTemplates.organizationPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from Organization resource. - * - * @param {string} organizationName - * A fully-qualified path representing Organization resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationName(organizationName: string) { - return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; - } - - /** - * Return a fully-qualified organizationAsset resource name string. - * - * @param {string} organization - * @param {string} asset - * @returns {string} Resource name string. - */ - organizationAssetPath(organization:string,asset:string) { - return this.pathTemplates.organizationAssetPathTemplate.render({ - organization: organization, - asset: asset, - }); - } - - /** - * Parse the organization from OrganizationAsset resource. - * - * @param {string} organizationAssetName - * A fully-qualified path representing organization_asset resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAssetName(organizationAssetName: string) { - return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).organization; - } - - /** - * Parse the asset from OrganizationAsset resource. - * - * @param {string} organizationAssetName - * A fully-qualified path representing organization_asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromOrganizationAssetName(organizationAssetName: string) { - return this.pathTemplates.organizationAssetPathTemplate.match(organizationAssetName).asset; - } - - /** - * Return a fully-qualified organizationAssetSecurityMarks resource name string. - * - * @param {string} organization - * @param {string} asset - * @returns {string} Resource name string. - */ - organizationAssetSecurityMarksPath(organization:string,asset:string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.render({ - organization: organization, - asset: asset, - }); - } - - /** - * Parse the organization from OrganizationAssetSecurityMarks resource. - * - * @param {string} organizationAssetSecurityMarksName - * A fully-qualified path representing organization_asset_securityMarks resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).organization; - } - - /** - * Parse the asset from OrganizationAssetSecurityMarks resource. - * - * @param {string} organizationAssetSecurityMarksName - * A fully-qualified path representing organization_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromOrganizationAssetSecurityMarksName(organizationAssetSecurityMarksName: string) { - return this.pathTemplates.organizationAssetSecurityMarksPathTemplate.match(organizationAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing OrganizationSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSource resource name string. - * - * @param {string} organization - * @param {string} source - * @returns {string} Resource name string. - */ - organizationSourcePath(organization:string,source:string) { - return this.pathTemplates.organizationSourcePathTemplate.render({ - organization: organization, - source: source, - }); - } - - /** - * Parse the organization from OrganizationSource resource. - * - * @param {string} organizationSourceName - * A fully-qualified path representing organization_source resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceName(organizationSourceName: string) { - return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).organization; - } - - /** - * Parse the source from OrganizationSource resource. - * - * @param {string} organizationSourceName - * A fully-qualified path representing organization_source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceName(organizationSourceName: string) { - return this.pathTemplates.organizationSourcePathTemplate.match(organizationSourceName).source; - } - - /** - * Return a fully-qualified organizationSourceFinding resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - organizationSourceFindingPath(organization:string,source:string,finding:string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - }); - } - - /** - * Parse the organization from OrganizationSourceFinding resource. - * - * @param {string} organizationSourceFindingName - * A fully-qualified path representing organization_source_finding resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceFindingName(organizationSourceFindingName: string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).organization; - } - - /** - * Parse the source from OrganizationSourceFinding resource. - * - * @param {string} organizationSourceFindingName - * A fully-qualified path representing organization_source_finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceFindingName(organizationSourceFindingName: string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).source; - } - - /** - * Parse the finding from OrganizationSourceFinding resource. - * - * @param {string} organizationSourceFindingName - * A fully-qualified path representing organization_source_finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromOrganizationSourceFindingName(organizationSourceFindingName: string) { - return this.pathTemplates.organizationSourceFindingPathTemplate.match(organizationSourceFindingName).finding; - } - - /** - * Return a fully-qualified organizationSourceFindingSecurityMarks resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - organizationSourceFindingSecurityMarksPath(organization:string,source:string,finding:string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - }); - } - - /** - * Parse the organization from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).organization; - } - - /** - * Parse the source from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from OrganizationSourceFindingSecurityMarks resource. - * - * @param {string} organizationSourceFindingSecurityMarksName - * A fully-qualified path representing organization_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromOrganizationSourceFindingSecurityMarksName(organizationSourceFindingSecurityMarksName: string) { - return this.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match(organizationSourceFindingSecurityMarksName).finding; - } - - /** - * Return a fully-qualified projectAsset resource name string. - * - * @param {string} project - * @param {string} asset - * @returns {string} Resource name string. - */ - projectAssetPath(project:string,asset:string) { - return this.pathTemplates.projectAssetPathTemplate.render({ - project: project, - asset: asset, - }); - } - - /** - * Parse the project from ProjectAsset resource. - * - * @param {string} projectAssetName - * A fully-qualified path representing project_asset resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAssetName(projectAssetName: string) { - return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).project; - } - - /** - * Parse the asset from ProjectAsset resource. - * - * @param {string} projectAssetName - * A fully-qualified path representing project_asset resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromProjectAssetName(projectAssetName: string) { - return this.pathTemplates.projectAssetPathTemplate.match(projectAssetName).asset; - } - - /** - * Return a fully-qualified projectAssetSecurityMarks resource name string. - * - * @param {string} project - * @param {string} asset - * @returns {string} Resource name string. - */ - projectAssetSecurityMarksPath(project:string,asset:string) { - return this.pathTemplates.projectAssetSecurityMarksPathTemplate.render({ - project: project, - asset: asset, - }); - } - - /** - * Parse the project from ProjectAssetSecurityMarks resource. - * - * @param {string} projectAssetSecurityMarksName - * A fully-qualified path representing project_asset_securityMarks resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { - return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).project; - } - - /** - * Parse the asset from ProjectAssetSecurityMarks resource. - * - * @param {string} projectAssetSecurityMarksName - * A fully-qualified path representing project_asset_securityMarks resource. - * @returns {string} A string representing the asset. - */ - matchAssetFromProjectAssetSecurityMarksName(projectAssetSecurityMarksName: string) { - return this.pathTemplates.projectAssetSecurityMarksPathTemplate.match(projectAssetSecurityMarksName).asset; - } - - /** - * Return a fully-qualified projectSource resource name string. - * - * @param {string} project - * @param {string} source - * @returns {string} Resource name string. - */ - projectSourcePath(project:string,source:string) { - return this.pathTemplates.projectSourcePathTemplate.render({ - project: project, - source: source, - }); - } - - /** - * Parse the project from ProjectSource resource. - * - * @param {string} projectSourceName - * A fully-qualified path representing project_source resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceName(projectSourceName: string) { - return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).project; - } - - /** - * Parse the source from ProjectSource resource. - * - * @param {string} projectSourceName - * A fully-qualified path representing project_source resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceName(projectSourceName: string) { - return this.pathTemplates.projectSourcePathTemplate.match(projectSourceName).source; - } - - /** - * Return a fully-qualified projectSourceFinding resource name string. - * - * @param {string} project - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - projectSourceFindingPath(project:string,source:string,finding:string) { - return this.pathTemplates.projectSourceFindingPathTemplate.render({ - project: project, - source: source, - finding: finding, - }); - } - - /** - * Parse the project from ProjectSourceFinding resource. - * - * @param {string} projectSourceFindingName - * A fully-qualified path representing project_source_finding resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceFindingName(projectSourceFindingName: string) { - return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).project; - } - - /** - * Parse the source from ProjectSourceFinding resource. - * - * @param {string} projectSourceFindingName - * A fully-qualified path representing project_source_finding resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceFindingName(projectSourceFindingName: string) { - return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).source; - } - - /** - * Parse the finding from ProjectSourceFinding resource. - * - * @param {string} projectSourceFindingName - * A fully-qualified path representing project_source_finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromProjectSourceFindingName(projectSourceFindingName: string) { - return this.pathTemplates.projectSourceFindingPathTemplate.match(projectSourceFindingName).finding; - } - - /** - * Return a fully-qualified projectSourceFindingSecurityMarks resource name string. - * - * @param {string} project - * @param {string} source - * @param {string} finding - * @returns {string} Resource name string. - */ - projectSourceFindingSecurityMarksPath(project:string,source:string,finding:string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render({ - project: project, - source: source, - finding: finding, - }); - } - - /** - * Parse the project from ProjectSourceFindingSecurityMarks resource. - * - * @param {string} projectSourceFindingSecurityMarksName - * A fully-qualified path representing project_source_finding_securityMarks resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).project; - } - - /** - * Parse the source from ProjectSourceFindingSecurityMarks resource. - * - * @param {string} projectSourceFindingSecurityMarksName - * A fully-qualified path representing project_source_finding_securityMarks resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).source; - } - - /** - * Parse the finding from ProjectSourceFindingSecurityMarks resource. - * - * @param {string} projectSourceFindingSecurityMarksName - * A fully-qualified path representing project_source_finding_securityMarks resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromProjectSourceFindingSecurityMarksName(projectSourceFindingSecurityMarksName: string) { - return this.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match(projectSourceFindingSecurityMarksName).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 { - this.initialize(); - if (!this._terminated) { - return this.securityCenterStub!.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client_config.json b/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client_config.json deleted file mode 100644 index b8821e07..00000000 --- a/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client_config.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "interfaces": { - "google.cloud.securitycenter.v1p1beta1.SecurityCenter": { - "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": { - "CreateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateFinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetOrganizationSettings": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetSource": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GroupAssets": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GroupFindings": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListAssets": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindings": { - "timeout_millis": 480000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListNotificationConfigs": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListSources": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "RunAssetDiscovery": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetFindingState": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateFinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateOrganizationSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSource": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSecurityMarks": { - "timeout_millis": 480000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_proto_list.json b/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_proto_list.json deleted file mode 100644 index dcb821bf..00000000 --- a/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_proto_list.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - "../../protos/google/cloud/securitycenter/v1p1beta1/asset.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/finding.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/folder.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/notification_config.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/notification_message.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/organization_settings.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/resource.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/security_marks.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto", - "../../protos/google/cloud/securitycenter/v1p1beta1/source.proto" -] diff --git a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 37333715..00000000 --- a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +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. -// -// ** 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 securitycenter = require('@google-cloud/security-center'); - -function main() { - const securityCenterClient = new securitycenter.SecurityCenterClient(); -} - -main(); diff --git a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index b4153c94..00000000 --- a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +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. -// -// ** 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 {SecurityCenterClient} from '@google-cloud/security-center'; - -// check that the client class type name can be used -function doStuffWithSecurityCenterClient(client: SecurityCenterClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const securityCenterClient = new SecurityCenterClient(); - doStuffWithSecurityCenterClient(securityCenterClient); -} - -main(); diff --git a/owl-bot-staging/v1p1beta1/system-test/install.ts b/owl-bot-staging/v1p1beta1/system-test/install.ts deleted file mode 100644 index 1f850b52..00000000 --- a/owl-bot-staging/v1p1beta1/system-test/install.ts +++ /dev/null @@ -1,49 +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. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts b/owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts deleted file mode 100644 index e392d53b..00000000 --- a/owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts +++ /dev/null @@ -1,3743 +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. -// -// ** 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 securitycenterModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} 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 stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1p1beta1.SecurityCenterClient', () => { - it('has servicePath', () => { - const servicePath = securitycenterModule.v1p1beta1.SecurityCenterClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = securitycenterModule.v1p1beta1.SecurityCenterClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = securitycenterModule.v1p1beta1.SecurityCenterClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.securityCenterStub, undefined); - await client.initialize(); - assert(client.securityCenterStub); - }); - - it('has close method', () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - 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 securitycenterModule.v1p1beta1.SecurityCenterClient({ - 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('createSource', () => { - it('invokes createSource without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()); - client.innerApiCalls.createSource = stubSimpleCall(expectedResponse); - const [response] = await client.createSource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createSource without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()); - client.innerApiCalls.createSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createSource with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateSourceRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSource(request), expectedError); - assert((client.innerApiCalls.createSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createFinding', () => { - it('invokes createFinding without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Finding()); - client.innerApiCalls.createFinding = stubSimpleCall(expectedResponse); - const [response] = await client.createFinding(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createFinding without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Finding()); - client.innerApiCalls.createFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFinding( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createFinding with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateFindingRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createFinding(request), expectedError); - assert((client.innerApiCalls.createFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createNotificationConfig', () => { - it('invokes createNotificationConfig without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()); - client.innerApiCalls.createNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()); - client.innerApiCalls.createNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNotificationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createNotificationConfig with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.CreateNotificationConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createNotificationConfig(request), expectedError); - assert((client.innerApiCalls.createNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteNotificationConfig', () => { - it('invokes deleteNotificationConfig without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNotificationConfig( - 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.deleteNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteNotificationConfig with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.DeleteNotificationConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteNotificationConfig(request), expectedError); - assert((client.innerApiCalls.deleteNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getNotificationConfig', () => { - it('invokes getNotificationConfig without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()); - client.innerApiCalls.getNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()); - client.innerApiCalls.getNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNotificationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getNotificationConfig with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetNotificationConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNotificationConfig(request), expectedError); - assert((client.innerApiCalls.getNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getOrganizationSettings', () => { - it('invokes getOrganizationSettings without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings()); - client.innerApiCalls.getOrganizationSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getOrganizationSettings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getOrganizationSettings without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings()); - client.innerApiCalls.getOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getOrganizationSettings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getOrganizationSettings with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetOrganizationSettingsRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getOrganizationSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getOrganizationSettings(request), expectedError); - assert((client.innerApiCalls.getOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getSource', () => { - it('invokes getSource without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()); - client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); - const [response] = await client.getSource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSource without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()); - client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getSource with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GetSourceRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSource(request), expectedError); - assert((client.innerApiCalls.getSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('setFindingState', () => { - it('invokes setFindingState without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Finding()); - client.innerApiCalls.setFindingState = stubSimpleCall(expectedResponse); - const [response] = await client.setFindingState(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setFindingState without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Finding()); - client.innerApiCalls.setFindingState = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setFindingState( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes setFindingState with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.SetFindingStateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setFindingState = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setFindingState(request), expectedError); - assert((client.innerApiCalls.setFindingState as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes testIamPermissions with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateFinding', () => { - it('invokes updateFinding without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest()); - request.finding = {}; - request.finding.name = ''; - const expectedHeaderRequestParams = "finding.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Finding()); - client.innerApiCalls.updateFinding = stubSimpleCall(expectedResponse); - const [response] = await client.updateFinding(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateFinding without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest()); - request.finding = {}; - request.finding.name = ''; - const expectedHeaderRequestParams = "finding.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Finding()); - client.innerApiCalls.updateFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFinding( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateFinding with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateFindingRequest()); - request.finding = {}; - request.finding.name = ''; - const expectedHeaderRequestParams = "finding.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFinding(request), expectedError); - assert((client.innerApiCalls.updateFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateNotificationConfig', () => { - it('invokes updateNotificationConfig without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest()); - request.notificationConfig = {}; - request.notificationConfig.name = ''; - const expectedHeaderRequestParams = "notification_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()); - client.innerApiCalls.updateNotificationConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateNotificationConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateNotificationConfig without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest()); - request.notificationConfig = {}; - request.notificationConfig.name = ''; - const expectedHeaderRequestParams = "notification_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()); - client.innerApiCalls.updateNotificationConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNotificationConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateNotificationConfig with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateNotificationConfigRequest()); - request.notificationConfig = {}; - request.notificationConfig.name = ''; - const expectedHeaderRequestParams = "notification_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNotificationConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateNotificationConfig(request), expectedError); - assert((client.innerApiCalls.updateNotificationConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateOrganizationSettings', () => { - it('invokes updateOrganizationSettings without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest()); - request.organizationSettings = {}; - request.organizationSettings.name = ''; - const expectedHeaderRequestParams = "organization_settings.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings()); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateOrganizationSettings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateOrganizationSettings without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest()); - request.organizationSettings = {}; - request.organizationSettings.name = ''; - const expectedHeaderRequestParams = "organization_settings.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.OrganizationSettings()); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateOrganizationSettings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IOrganizationSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateOrganizationSettings with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateOrganizationSettingsRequest()); - request.organizationSettings = {}; - request.organizationSettings.name = ''; - const expectedHeaderRequestParams = "organization_settings.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateOrganizationSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateOrganizationSettings(request), expectedError); - assert((client.innerApiCalls.updateOrganizationSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateSource', () => { - it('invokes updateSource without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest()); - request.source = {}; - request.source.name = ''; - const expectedHeaderRequestParams = "source.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()); - client.innerApiCalls.updateSource = stubSimpleCall(expectedResponse); - const [response] = await client.updateSource(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSource without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest()); - request.source = {}; - request.source.name = ''; - const expectedHeaderRequestParams = "source.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()); - client.innerApiCalls.updateSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSource( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateSource with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateSourceRequest()); - request.source = {}; - request.source.name = ''; - const expectedHeaderRequestParams = "source.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSource(request), expectedError); - assert((client.innerApiCalls.updateSource as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateSecurityMarks', () => { - it('invokes updateSecurityMarks without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest()); - request.securityMarks = {}; - request.securityMarks.name = ''; - const expectedHeaderRequestParams = "security_marks.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.SecurityMarks()); - client.innerApiCalls.updateSecurityMarks = stubSimpleCall(expectedResponse); - const [response] = await client.updateSecurityMarks(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSecurityMarks without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest()); - request.securityMarks = {}; - request.securityMarks.name = ''; - const expectedHeaderRequestParams = "security_marks.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.SecurityMarks()); - client.innerApiCalls.updateSecurityMarks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSecurityMarks( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISecurityMarks|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateSecurityMarks with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.UpdateSecurityMarksRequest()); - request.securityMarks = {}; - request.securityMarks.name = ''; - const expectedHeaderRequestParams = "security_marks.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecurityMarks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSecurityMarks(request), expectedError); - assert((client.innerApiCalls.updateSecurityMarks as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('runAssetDiscovery', () => { - it('invokes runAssetDiscovery without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(expectedResponse); - const [operation] = await client.runAssetDiscovery(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes runAssetDiscovery without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runAssetDiscovery( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes runAssetDiscovery with call error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runAssetDiscovery(request), expectedError); - assert((client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes runAssetDiscovery with LRO error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.RunAssetDiscoveryRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.runAssetDiscovery = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runAssetDiscovery(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.runAssetDiscovery as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkRunAssetDiscoveryProgress without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage(new operationsProtos.google.longrunning.Operation()); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRunAssetDiscoveryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunAssetDiscoveryProgress with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRunAssetDiscoveryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('groupAssets', () => { - it('invokes groupAssets without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.innerApiCalls.groupAssets = stubSimpleCall(expectedResponse); - const [response] = await client.groupAssets(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes groupAssets without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.innerApiCalls.groupAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.groupAssets( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes groupAssets with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.groupAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.groupAssets(request), expectedError); - assert((client.innerApiCalls.groupAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes groupAssetsStream without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.groupAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { - 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.groupAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); - assert.strictEqual( - (client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes groupAssetsStream with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.groupAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.groupAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupAssets, request)); - assert.strictEqual( - (client.descriptors.page.groupAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with groupAssets without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; - const iterable = client.groupAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with groupAssets with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.groupAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.groupAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.groupAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('groupFindings', () => { - it('invokes groupFindings without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.innerApiCalls.groupFindings = stubSimpleCall(expectedResponse); - const [response] = await client.groupFindings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes groupFindings without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.innerApiCalls.groupFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.groupFindings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes groupFindings with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.groupFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.groupFindings(request), expectedError); - assert((client.innerApiCalls.groupFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes groupFindingsStream without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.groupFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { - 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.groupFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); - assert.strictEqual( - (client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes groupFindingsStream with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.groupFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.groupFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.GroupResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.GroupResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.groupFindings, request)); - assert.strictEqual( - (client.descriptors.page.groupFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with groupFindings without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupResult()), - ]; - client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; - const iterable = client.groupFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with groupFindings with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.GroupFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.groupFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.groupFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.IGroupResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.groupFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listAssets', () => { - it('invokes listAssets without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); - const [response] = await client.listAssets(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAssets without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAssets( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listAssets with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAssets(request), expectedError); - assert((client.innerApiCalls.listAssets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAssetsStream without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert.strictEqual( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listAssetsStream with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert.strictEqual( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAssets without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.ListAssetsResult()), - ]; - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[] = []; - const iterable = client.listAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAssets with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListAssetsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListAssetsResponse.IListAssetsResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAssets.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 securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - ]; - 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 securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[]|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 securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.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 securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult) => { - 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 securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.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.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult) => { - 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 securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.ListFindingsResult()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[] = []; - 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 securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.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.securitycenter.v1p1beta1.ListFindingsResponse.IListFindingsResult[] = []; - 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('listNotificationConfigs', () => { - it('invokes listNotificationConfigs without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - ]; - client.innerApiCalls.listNotificationConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listNotificationConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listNotificationConfigs without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - ]; - client.innerApiCalls.listNotificationConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNotificationConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listNotificationConfigs with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listNotificationConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNotificationConfigs(request), expectedError); - assert((client.innerApiCalls.listNotificationConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listNotificationConfigsStream without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - ]; - client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNotificationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig) => { - 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.listNotificationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listNotificationConfigsStream with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNotificationConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listNotificationConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listNotificationConfigs without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.NotificationConfig()), - ]; - client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[] = []; - const iterable = client.listNotificationConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listNotificationConfigs with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listNotificationConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNotificationConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.INotificationConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listNotificationConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listSources', () => { - it('invokes listSources without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); - const [response] = await client.listSources(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSources as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSources without error using callback', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSources( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1p1beta1.ISource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSources as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listSources with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSources(request), expectedError); - assert((client.innerApiCalls.listSources as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSourcesStream without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - ]; - client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.Source[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.Source) => { - 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.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert.strictEqual( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listSourcesStream with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.Source[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1p1beta1.Source) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert.strictEqual( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSources without error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.Source()), - ]; - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1p1beta1.ISource[] = []; - const iterable = client.listSourcesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSources with error', async () => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.securitycenter.v1p1beta1.ListSourcesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSourcesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1p1beta1.ISource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('folderAsset', () => { - const fakePath = "/rendered/path/folderAsset"; - const expectedParameters = { - folder: "folderValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderAssetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAssetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAssetPath', () => { - const result = client.folderAssetPath("folderValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAssetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAssetName', () => { - const result = client.matchFolderFromFolderAssetName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromFolderAssetName', () => { - const result = client.matchAssetFromFolderAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.folderAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAssetSecurityMarks', () => { - const fakePath = "/rendered/path/folderAssetSecurityMarks"; - const expectedParameters = { - folder: "folderValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAssetSecurityMarksPath', () => { - const result = client.folderAssetSecurityMarksPath("folderValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAssetSecurityMarksName', () => { - const result = client.matchFolderFromFolderAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromFolderAssetSecurityMarksName', () => { - const result = client.matchAssetFromFolderAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.folderAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSource', () => { - const fakePath = "/rendered/path/folderSource"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourcePath', () => { - const result = client.folderSourcePath("folderValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceName', () => { - const result = client.matchFolderFromFolderSourceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceName', () => { - const result = client.matchSourceFromFolderSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSourceFinding', () => { - const fakePath = "/rendered/path/folderSourceFinding"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourceFindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourceFindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourceFindingPath', () => { - const result = client.folderSourceFindingPath("folderValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourceFindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceFindingName', () => { - const result = client.matchFolderFromFolderSourceFindingName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceFindingName', () => { - const result = client.matchSourceFromFolderSourceFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFolderSourceFindingName', () => { - const result = client.matchFindingFromFolderSourceFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.folderSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/folderSourceFindingSecurityMarks"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourceFindingSecurityMarksPath', () => { - const result = client.folderSourceFindingSecurityMarksPath("folderValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceFindingSecurityMarksName', () => { - const result = client.matchFolderFromFolderSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromFolderSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFolderSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromFolderSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.folderSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('notificationConfig', () => { - const fakePath = "/rendered/path/notificationConfig"; - const expectedParameters = { - organization: "organizationValue", - notification_config: "notificationConfigValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.notificationConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.notificationConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('notificationConfigPath', () => { - const result = client.notificationConfigPath("organizationValue", "notificationConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.notificationConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromNotificationConfigName', () => { - const result = client.matchOrganizationFromNotificationConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.notificationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationConfigFromNotificationConfigName', () => { - const result = client.matchNotificationConfigFromNotificationConfigName(fakePath); - assert.strictEqual(result, "notificationConfigValue"); - assert((client.pathTemplates.notificationConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organization', () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationPath', () => { - const result = client.organizationPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationName', () => { - const result = client.matchOrganizationFromOrganizationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAsset', () => { - const fakePath = "/rendered/path/organizationAsset"; - const expectedParameters = { - organization: "organizationValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationAssetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAssetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAssetPath', () => { - const result = client.organizationAssetPath("organizationValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAssetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAssetName', () => { - const result = client.matchOrganizationFromOrganizationAssetName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromOrganizationAssetName', () => { - const result = client.matchAssetFromOrganizationAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.organizationAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAssetSecurityMarks', () => { - const fakePath = "/rendered/path/organizationAssetSecurityMarks"; - const expectedParameters = { - organization: "organizationValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAssetSecurityMarksPath', () => { - const result = client.organizationAssetSecurityMarksPath("organizationValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAssetSecurityMarksName', () => { - const result = client.matchOrganizationFromOrganizationAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromOrganizationAssetSecurityMarksName', () => { - const result = client.matchAssetFromOrganizationAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.organizationAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSource', () => { - const fakePath = "/rendered/path/organizationSource"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourcePath', () => { - const result = client.organizationSourcePath("organizationValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceName', () => { - const result = client.matchOrganizationFromOrganizationSourceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceName', () => { - const result = client.matchSourceFromOrganizationSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSourceFinding', () => { - const fakePath = "/rendered/path/organizationSourceFinding"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourceFindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourceFindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourceFindingPath', () => { - const result = client.organizationSourceFindingPath("organizationValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceFindingName', () => { - const result = client.matchOrganizationFromOrganizationSourceFindingName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceFindingName', () => { - const result = client.matchSourceFromOrganizationSourceFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromOrganizationSourceFindingName', () => { - const result = client.matchFindingFromOrganizationSourceFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.organizationSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/organizationSourceFindingSecurityMarks"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourceFindingSecurityMarksPath', () => { - const result = client.organizationSourceFindingSecurityMarksPath("organizationValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchOrganizationFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromOrganizationSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromOrganizationSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.organizationSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAsset', () => { - const fakePath = "/rendered/path/projectAsset"; - const expectedParameters = { - project: "projectValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAssetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAssetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAssetPath', () => { - const result = client.projectAssetPath("projectValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAssetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAssetName', () => { - const result = client.matchProjectFromProjectAssetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromProjectAssetName', () => { - const result = client.matchAssetFromProjectAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.projectAssetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAssetSecurityMarks', () => { - const fakePath = "/rendered/path/projectAssetSecurityMarks"; - const expectedParameters = { - project: "projectValue", - asset: "assetValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectAssetSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAssetSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAssetSecurityMarksPath', () => { - const result = client.projectAssetSecurityMarksPath("projectValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAssetSecurityMarksName', () => { - const result = client.matchProjectFromProjectAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromProjectAssetSecurityMarksName', () => { - const result = client.matchAssetFromProjectAssetSecurityMarksName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.projectAssetSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSource', () => { - const fakePath = "/rendered/path/projectSource"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourcePath', () => { - const result = client.projectSourcePath("projectValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceName', () => { - const result = client.matchProjectFromProjectSourceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceName', () => { - const result = client.matchSourceFromProjectSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSourceFinding', () => { - const fakePath = "/rendered/path/projectSourceFinding"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourceFindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourceFindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourceFindingPath', () => { - const result = client.projectSourceFindingPath("projectValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourceFindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceFindingName', () => { - const result = client.matchProjectFromProjectSourceFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceFindingName', () => { - const result = client.matchSourceFromProjectSourceFindingName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromProjectSourceFindingName', () => { - const result = client.matchFindingFromProjectSourceFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.projectSourceFindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSourceFindingSecurityMarks', () => { - const fakePath = "/rendered/path/projectSourceFindingSecurityMarks"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - finding: "findingValue", - }; - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourceFindingSecurityMarksPath', () => { - const result = client.projectSourceFindingSecurityMarksPath("projectValue", "sourceValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceFindingSecurityMarksName', () => { - const result = client.matchProjectFromProjectSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceFindingSecurityMarksName', () => { - const result = client.matchSourceFromProjectSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromProjectSourceFindingSecurityMarksName', () => { - const result = client.matchFindingFromProjectSourceFindingSecurityMarksName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.projectSourceFindingSecurityMarksPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1p1beta1/tsconfig.json b/owl-bot-staging/v1p1beta1/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- a/owl-bot-staging/v1p1beta1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1p1beta1/webpack.config.js b/owl-bot-staging/v1p1beta1/webpack.config.js deleted file mode 100644 index 4aeca8bf..00000000 --- a/owl-bot-staging/v1p1beta1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'SecurityCenter', - filename: './security-center.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/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto b/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto index d127dd72..958e6971 100644 --- a/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto +++ b/protos/google/cloud/securitycenter/v1p1beta1/securitycenter_service.proto @@ -1317,7 +1317,7 @@ message UpdateOrganizationSettingsRequest { // The FieldMask to use when updating the settings resource. // - // If empty all mutable fields will be updated. + // If empty all mutable fields will be updated. google.protobuf.FieldMask update_mask = 2; } diff --git a/samples/generated/v1p1beta1/security_center.update_organization_settings.js b/samples/generated/v1p1beta1/security_center.update_organization_settings.js index 169ddaf0..b9084384 100644 --- a/samples/generated/v1p1beta1/security_center.update_organization_settings.js +++ b/samples/generated/v1p1beta1/security_center.update_organization_settings.js @@ -25,7 +25,7 @@ function main(organizationSettings) { // const organizationSettings = {} /** * The FieldMask to use when updating the settings resource. - * If empty all mutable fields will be updated. + * If empty all mutable fields will be updated. */ // const updateMask = {} diff --git a/src/v1p1beta1/security_center_client.ts b/src/v1p1beta1/security_center_client.ts index 054b07d6..a36a4d9b 100644 --- a/src/v1p1beta1/security_center_client.ts +++ b/src/v1p1beta1/security_center_client.ts @@ -1758,7 +1758,7 @@ export class SecurityCenterClient { * @param {google.protobuf.FieldMask} request.updateMask * The FieldMask to use when updating the settings resource. * - * If empty all mutable fields will be updated. + * If empty all mutable fields will be updated. * @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.