From 04c8c6e78768e60a77c6cde8b89e6d6a9fbc1dca Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 7 Apr 2022 01:48:08 +0000 Subject: [PATCH 1/2] feat: Add iam_binding field to findings attributes. It represents particular IAM bindings, which captures a member's role addition, removal, or state PiperOrigin-RevId: 439976914 Source-Link: https://github.com/googleapis/googleapis/commit/f83787ed5e7985e1eceefb56e5fb685dd8eaadf2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a4e583e31dda27c647f4865794349b3130c776bd Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTRlNTgzZTMxZGRhMjdjNjQ3ZjQ4NjU3OTQzNDliMzEzMGM3NzZiZCJ9 --- owl-bot-staging/v1/.eslintignore | 7 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 + owl-bot-staging/v1/.mocharc.js | 33 + owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 16 + owl-bot-staging/v1/package.json | 64 + .../cloud/securitycenter/v1/access.proto | 54 + .../cloud/securitycenter/v1/asset.proto | 134 + .../securitycenter/v1/bigquery_export.proto | 99 + .../securitycenter/v1/external_system.proto | 59 + .../cloud/securitycenter/v1/finding.proto | 275 + .../cloud/securitycenter/v1/folder.proto | 36 + .../cloud/securitycenter/v1/iam_binding.proto | 52 + .../cloud/securitycenter/v1/indicator.proto | 37 + .../securitycenter/v1/mitre_attack.proto | 194 + .../cloud/securitycenter/v1/mute_config.proto | 89 + .../v1/notification_config.proto | 95 + .../v1/notification_message.proto | 44 + .../v1/organization_settings.proto | 85 + .../cloud/securitycenter/v1/resource.proto | 58 + .../v1/run_asset_discovery_response.proto | 51 + .../securitycenter/v1/security_marks.proto | 69 + .../v1/securitycenter_service.proto | 1852 +++++ .../cloud/securitycenter/v1/source.proto | 69 + .../securitycenter/v1/vulnerability.proto | 216 + .../v1/security_center.bulk_mute_findings.js | 84 + ...security_center.create_big_query_export.js | 73 + .../v1/security_center.create_finding.js | 72 + .../v1/security_center.create_mute_config.js | 73 + ...urity_center.create_notification_config.js | 74 + .../v1/security_center.create_source.js | 65 + ...security_center.delete_big_query_export.js | 61 + .../v1/security_center.delete_mute_config.js | 61 + ...urity_center.delete_notification_config.js | 59 + .../security_center.get_big_query_export.js | 61 + .../v1/security_center.get_iam_policy.js | 64 + .../v1/security_center.get_mute_config.js | 61 + ...security_center.get_notification_config.js | 59 + ...curity_center.get_organization_settings.js | 59 + .../v1/security_center.get_source.js | 59 + .../v1/security_center.group_assets.js | 173 + .../v1/security_center.group_findings.js | 177 + .../v1/security_center.list_assets.js | 182 + .../security_center.list_big_query_exports.js | 76 + .../v1/security_center.list_findings.js | 188 + .../v1/security_center.list_mute_configs.js | 76 + ...curity_center.list_notification_configs.js | 72 + .../v1/security_center.list_sources.js | 73 + .../v1/security_center.run_asset_discovery.js | 60 + .../v1/security_center.set_finding_state.js | 71 + .../v1/security_center.set_iam_policy.js | 74 + .../generated/v1/security_center.set_mute.js | 68 + .../security_center.test_iam_permissions.js | 67 + ...security_center.update_big_query_export.js | 63 + .../security_center.update_external_system.js | 63 + .../v1/security_center.update_finding.js | 71 + .../v1/security_center.update_mute_config.js | 63 + ...urity_center.update_notification_config.js | 63 + ...ity_center.update_organization_settings.js | 63 + .../security_center.update_security_marks.js | 72 + .../v1/security_center.update_source.js | 63 + ...tadata.google.cloud.securitycenter.v1.json | 1699 +++++ owl-bot-staging/v1/src/index.ts | 25 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 415 + owl-bot-staging/v1/src/v1/index.ts | 19 + .../v1/src/v1/security_center_client.ts | 6712 +++++++++++++++++ .../src/v1/security_center_client_config.json | 193 + .../v1/src/v1/security_center_proto_list.json | 21 + .../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 | 5933 +++++++++++++++ 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 | 16 + 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 | 72 + .../v1beta1/security_center.create_source.js | 65 + .../v1beta1/security_center.get_iam_policy.js | 64 + ...curity_center.get_organization_settings.js | 59 + .../v1beta1/security_center.get_source.js | 59 + .../v1beta1/security_center.group_assets.js | 136 + .../v1beta1/security_center.group_findings.js | 115 + .../v1beta1/security_center.list_assets.js | 141 + .../v1beta1/security_center.list_findings.js | 118 + .../v1beta1/security_center.list_sources.js | 72 + .../security_center.run_asset_discovery.js | 60 + .../security_center.set_finding_state.js | 71 + .../v1beta1/security_center.set_iam_policy.js | 74 + .../security_center.test_iam_permissions.js | 67 + .../v1beta1/security_center.update_finding.js | 67 + ...ity_center.update_organization_settings.js | 62 + .../security_center.update_security_marks.js | 66 + .../v1beta1/security_center.update_source.js | 62 + ...a.google.cloud.securitycenter.v1beta1.json | 895 +++ 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 | 3253 ++++++++ .../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 | 2906 +++++++ 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 | 16 + 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 | 70 + ...urity_center.create_notification_config.js | 72 + .../security_center.create_source.js | 65 + ...urity_center.delete_notification_config.js | 59 + .../security_center.get_iam_policy.js | 64 + ...security_center.get_notification_config.js | 59 + ...curity_center.get_organization_settings.js | 59 + .../v1p1beta1/security_center.get_source.js | 59 + .../v1p1beta1/security_center.group_assets.js | 173 + .../security_center.group_findings.js | 169 + .../v1p1beta1/security_center.list_assets.js | 182 + .../security_center.list_findings.js | 178 + ...curity_center.list_notification_configs.js | 72 + .../v1p1beta1/security_center.list_sources.js | 73 + .../security_center.run_asset_discovery.js | 60 + .../security_center.set_finding_state.js | 71 + .../security_center.set_iam_policy.js | 74 + .../security_center.test_iam_permissions.js | 67 + .../security_center.update_finding.js | 71 + ...urity_center.update_notification_config.js | 63 + ...ity_center.update_organization_settings.js | 63 + .../security_center.update_security_marks.js | 71 + .../security_center.update_source.js | 63 + ...google.cloud.securitycenter.v1p1beta1.json | 1123 +++ 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 | 4928 ++++++++++++ .../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 | 3971 ++++++++++ owl-bot-staging/v1p1beta1/tsconfig.json | 19 + owl-bot-staging/v1p1beta1/webpack.config.js | 64 + 180 files changed, 47412 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/access.proto 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/bigquery_export.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/external_system.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/iam_binding.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/mitre_attack.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/mute_config.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.bulk_mute_findings.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.create_big_query_export.js 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_mute_config.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_big_query_export.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.delete_mute_config.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_big_query_export.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_mute_config.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_big_query_exports.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_mute_configs.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.set_mute.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_big_query_export.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.update_external_system.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_mute_config.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/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json 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/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json 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/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json 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..3f4fcde5 --- /dev/null +++ b/owl-bot-staging/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/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..481c522b --- /dev/null +++ b/owl-bot-staging/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 00000000..494e1478 --- /dev/null +++ b/owl-bot-staging/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 00000000..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..befd23c8 --- /dev/null +++ b/owl-bot-staging/v1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 00000000..5a98ee64 --- /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.29.4" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/access.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/access.proto new file mode 100644 index 00000000..e1b57247 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/access.proto @@ -0,0 +1,54 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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; + +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 = "AccessProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Represents an access event. +message Access { + // Associated email, such as "foo@google.com". + string principal_email = 1; + + // Caller's IP address, such as "1.1.1.1". + string caller_ip = 2; + + // The caller IP's geolocation, which identifies where the call came from. + Geolocation caller_ip_geo = 3; + + // What kind of user agent is associated, e.g. operating system shells, + // embedded or stand-alone applications, etc. + string user_agent_family = 4; + + // This is the API service that the service account made a call to, e.g. + // "iam.googleapis.com" + string service_name = 5; + + // The method that the service account called, e.g. "SetIamPolicy". + string method_name = 6; +} + +// Represents a geographical location for a given access. +message Geolocation { + // A CLDR. + string region_code = 1; +} 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..55ba5641 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/asset.proto @@ -0,0 +1,134 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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"; + +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/bigquery_export.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/bigquery_export.proto new file mode 100644 index 00000000..850c66e5 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/bigquery_export.proto @@ -0,0 +1,99 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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/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_outer_classname = "BigQueryExportProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Configures how to deliver Findings to BigQuery Instance. +message BigQueryExport { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/BigQueryExport" + pattern: "organizations/{organization}/bigQueryExports/{export}" + pattern: "folders/{folder}/bigQueryExports/{export}" + pattern: "projects/{project}/bigQueryExports/{export}" + }; + + // The relative resource name of this export. See: + // https://cloud.google.com/apis/design/resource_names#relative_resource_name. + // Example format: + // "organizations/{organization_id}/bigQueryExports/{export_id}" Example + // format: "folders/{folder_id}/bigQueryExports/{export_id}" Example format: + // "projects/{project_id}/bigQueryExports/{export_id}" + // This field is provided in responses, and is ignored when provided in create + // requests. + string name = 1; + + // The description of the export (max of 1024 characters). + string description = 2; + + // Expression that defines the filter to apply across create/update events + // of findings. 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 = 3; + + // The dataset to write findings' updates to. Its format is + // "projects/[project_id]/datasets/[bigquery_dataset_id]". + // BigQuery Dataset unique ID must contain only letters (a-z, A-Z), numbers + // (0-9), or underscores (_). + string dataset = 4; + + // Output only. The time at which the big query export was created. + // This field is set by the server and will be ignored if provided on export + // on creation. + google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The most recent time at which the big export was updated. + // This field is set by the server and will be ignored if provided on export + // creation or update. + google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Email address of the user who last edited the big query export. + // This field is set by the server and will be ignored if provided on export + // creation or update. + string most_recent_editor = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The service account that needs permission to create table, upload data to + // the big query dataset. + string principal = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/external_system.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/external_system.proto new file mode 100644 index 00000000..8ba69813 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/external_system.proto @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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/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_outer_classname = "ExternalSystemProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Representation of third party SIEM/SOAR fields within SCC. +message ExternalSystem { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/ExternalSystem" + pattern: "organizations/{organization}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}" + pattern: "folders/{folder}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}" + pattern: "projects/{project}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}" + }; + + // External System Name e.g. jira, demisto, etc. + // e.g.: + // `organizations/1234/sources/5678/findings/123456/externalSystems/jira` + // `folders/1234/sources/5678/findings/123456/externalSystems/jira` + // `projects/1234/sources/5678/findings/123456/externalSystems/jira` + string name = 1; + + // References primary/secondary etc assignees in the external system. + repeated string assignees = 2; + + // Identifier that's used to track the given finding in the external system. + string external_uid = 3; + + // Most recent status of the corresponding finding's ticket/tracker in the + // external system. + string status = 4; + + // The most recent time when the corresponding finding's ticket/tracker was + // updated in the external system. + google.protobuf.Timestamp external_system_update_time = 5; +} 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..c3154ae1 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/finding.proto @@ -0,0 +1,275 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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/access.proto"; +import "google/cloud/securitycenter/v1/external_system.proto"; +import "google/cloud/securitycenter/v1/iam_binding.proto"; +import "google/cloud/securitycenter/v1/indicator.proto"; +import "google/cloud/securitycenter/v1/mitre_attack.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"; + +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; + } + + // Mute state a finding can be in. + enum Mute { + // Unspecified. + MUTE_UNSPECIFIED = 0; + + // Finding has been muted. + MUTED = 1; + + // Finding has been unmuted. + UNMUTED = 2; + + // Finding has never been muted/unmuted. + UNDEFINED = 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; + + // Describes an error that prevents some SCC functionality. + SCC_ERROR = 5; + } + + // 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 the finding was first detected. If an existing finding is updated, + // then this is the time the update occurred. + // For example, if the finding represents an open firewall, this property + // captures the time the detector believes the firewall became open. The + // accuracy is determined by the detector. If the finding is later resolved, + // then this time reflects when the finding was resolved. This 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; + + // Indicates the mute state of a finding (either muted, unmuted + // or undefined). Unlike other attributes of a finding, a finding provider + // shouldn't set the value of mute. + Mute mute = 15; + + // 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; + + // Output only. The most recent time this finding was muted or unmuted. + google.protobuf.Timestamp mute_update_time = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Third party SIEM/SOAR fields within SCC, contains external system + // information and external system finding fields. + map external_systems = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // MITRE ATT&CK tactics and techniques related to this finding. + // See: https://attack.mitre.org + MitreAttack mitre_attack = 25; + + // Access details associated to the Finding, such as more information on the + // caller, which method was accessed, from where, etc. + Access access = 26; + + // First known as mute_annotation. Records additional information about the + // mute operation e.g. mute config that muted the finding, user who muted the + // finding, etc. Unlike other attributes of a finding, a finding provider + // shouldn't set the value of mute. + string mute_initiator = 28; + + // Represents IAM bindings associated with the Finding. + repeated IamBinding iam_bindings = 39; +} 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..4078a527 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/folder.proto @@ -0,0 +1,36 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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; + +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/iam_binding.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/iam_binding.proto new file mode 100644 index 00000000..c1e57a37 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/iam_binding.proto @@ -0,0 +1,52 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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; + +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 = "IamBindingProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Represents a particular IAM binding, which captures a member's role addition, +// removal, or state. +message IamBinding { + // The type of action performed on a Binding in a policy. + enum Action { + // Unspecified. + ACTION_UNSPECIFIED = 0; + + // Addition of a Binding. + ADD = 1; + + // Removal of a Binding. + REMOVE = 2; + } + + // The action that was performed on a Binding. + Action action = 1; + + // Role that is assigned to "members". + // For example, "roles/viewer", "roles/editor", or "roles/owner". + string role = 2; + + // A single identity requesting access for a Cloud Platform resource, + // e.g. "foo@google.com". + string member = 3; +} 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..92234776 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/indicator.proto @@ -0,0 +1,37 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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; + +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 = "IndicatorProto"; +option java_package = "com.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/mitre_attack.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/mitre_attack.proto new file mode 100644 index 00000000..547f6f69 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/mitre_attack.proto @@ -0,0 +1,194 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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; + +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 = "MitreAttackProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// MITRE ATT&CK tactics and techniques related to this finding. +// See: https://attack.mitre.org +message MitreAttack { + // MITRE ATT&CK tactics that can be referenced by SCC findings. + // See: https://attack.mitre.org/tactics/enterprise/ + enum Tactic { + // Unspecified value. + TACTIC_UNSPECIFIED = 0; + + // TA0043 + RECONNAISSANCE = 1; + + // TA0042 + RESOURCE_DEVELOPMENT = 2; + + // TA0001 + INITIAL_ACCESS = 5; + + // TA0002 + EXECUTION = 3; + + // TA0003 + PERSISTENCE = 6; + + // TA0004 + PRIVILEGE_ESCALATION = 8; + + // TA0005 + DEFENSE_EVASION = 7; + + // TA0006 + CREDENTIAL_ACCESS = 9; + + // TA0007 + DISCOVERY = 10; + + // TA0008 + LATERAL_MOVEMENT = 11; + + // TA0009 + COLLECTION = 12; + + // TA0011 + COMMAND_AND_CONTROL = 4; + + // TA0010 + EXFILTRATION = 13; + + // TA0040 + IMPACT = 14; + } + + // MITRE ATT&CK techniques that can be referenced by SCC findings. + // See: https://attack.mitre.org/techniques/enterprise/ + // Next ID: 30 + enum Technique { + // Unspecified value. + TECHNIQUE_UNSPECIFIED = 0; + + // T1595 + ACTIVE_SCANNING = 1; + + // T1595.001 + SCANNING_IP_BLOCKS = 2; + + // T1105 + INGRESS_TOOL_TRANSFER = 3; + + // T1106 + NATIVE_API = 4; + + // T1129 + SHARED_MODULES = 5; + + // T1059 + COMMAND_AND_SCRIPTING_INTERPRETER = 6; + + // T1059.004 + UNIX_SHELL = 7; + + // T1496 + RESOURCE_HIJACKING = 8; + + // T1090 + PROXY = 9; + + // T1090.002 + EXTERNAL_PROXY = 10; + + // T1090.003 + MULTI_HOP_PROXY = 11; + + // T1568 + DYNAMIC_RESOLUTION = 12; + + // T1552 + UNSECURED_CREDENTIALS = 13; + + // T1078 + VALID_ACCOUNTS = 14; + + // T1078.003 + LOCAL_ACCOUNTS = 15; + + // T1078.004 + CLOUD_ACCOUNTS = 16; + + // T1498 + NETWORK_DENIAL_OF_SERVICE = 17; + + // T1069 + PERMISSION_GROUPS_DISCOVERY = 18; + + // T1069.003 + CLOUD_GROUPS = 19; + + // T1567 + EXFILTRATION_OVER_WEB_SERVICE = 20; + + // T1567.002 + EXFILTRATION_TO_CLOUD_STORAGE = 21; + + // T1098 + ACCOUNT_MANIPULATION = 22; + + // T1098.004 + SSH_AUTHORIZED_KEYS = 23; + + // T1543 + CREATE_OR_MODIFY_SYSTEM_PROCESS = 24; + + // T1539 + STEAL_WEB_SESSION_COOKIE = 25; + + // T1578 + MODIFY_CLOUD_COMPUTE_INFRASTRUCTURE = 26; + + // T1190 + EXPLOIT_PUBLIC_FACING_APPLICATION = 27; + + // T1556 + MODIFY_AUTHENTICATION_PROCESS = 28; + + // T1485 + DATA_DESTRUCTION = 29; + } + + // The MITRE ATT&CK tactic most closely represented by this finding, if any. + Tactic primary_tactic = 1; + + // The MITRE ATT&CK technique most closely represented by this finding, if + // any. primary_techniques is a repeated field because there are multiple + // levels of MITRE ATT&CK techniques. If the technique most closely + // represented by this finding is a sub-technique (e.g. `SCANNING_IP_BLOCKS`), + // both the sub-technique and its parent technique(s) will be listed (e.g. + // `SCANNING_IP_BLOCKS`, `ACTIVE_SCANNING`). + repeated Technique primary_techniques = 2; + + // Additional MITRE ATT&CK tactics related to this finding, if any. + repeated Tactic additional_tactics = 3; + + // Additional MITRE ATT&CK techniques related to this finding, if any, along + // with any of their respective parent techniques. + repeated Technique additional_techniques = 4; + + // The MITRE ATT&CK version referenced by the above fields. E.g. "8". + string version = 5; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/mute_config.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/mute_config.proto new file mode 100644 index 00000000..74426957 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/mute_config.proto @@ -0,0 +1,89 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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/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_outer_classname = "MuteConfigProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// A mute config is a Cloud SCC resource that contains the configuration +// to mute create/update events of findings. +message MuteConfig { + option (google.api.resource) = { + type: "securitycenter.googleapis.com/MuteConfig" + pattern: "organizations/{organization}/muteConfigs/{mute_config}" + pattern: "folders/{folder}/muteConfigs/{mute_config}" + pattern: "projects/{project}/muteConfigs/{mute_config}" + }; + + // This field will be ignored if provided on config creation. Format + // "organizations/{organization}/muteConfigs/{mute_config}" + // "folders/{folder}/muteConfigs/{mute_config}" + // "projects/{project}/muteConfigs/{mute_config}" + string name = 1; + + // The human readable name to be displayed for the mute config. + string display_name = 2 [deprecated = true]; + + // A description of the mute config. + string description = 3; + + // Required. An expression that defines the filter to apply across create/update events + // of findings. While creating a filter string, be mindful of the + // scope in which the mute configuration is being created. E.g., If a filter + // contains project = X but is created under the project = Y scope, it might + // not match any findings. + // + // The following field and operator combinations are supported: + // + // * severity: `=`, `:` + // * category: `=`, `:` + // * resource.name: `=`, `:` + // * resource.project_name: `=`, `:` + // * resource.project_display_name: `=`, `:` + // * resource.folders.resource_folder: `=`, `:` + // * resource.parent_name: `=`, `:` + // * resource.parent_display_name: `=`, `:` + // * resource.type: `=`, `:` + // * finding_class: `=`, `:` + // * indicator.ip_addresses: `=`, `:` + // * indicator.domains: `=`, `:` + string filter = 4 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The time at which the mute config was created. + // This field is set by the server and will be ignored if provided on config + // creation. + google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The most recent time at which the mute config was updated. + // This field is set by the server and will be ignored if provided on config + // creation or update. + google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Email address of the user who last edited the mute config. + // This field is set by the server and will be ignored if provided on config + // creation or update. + string most_recent_editor = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} 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..7ab94662 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_config.proto @@ -0,0 +1,95 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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"; + +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..3605dfbe --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_message.proto @@ -0,0 +1,44 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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"; + +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..e8bc9687 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto @@ -0,0 +1,85 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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"; + +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..ab241d8b --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/resource.proto @@ -0,0 +1,58 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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"; + +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 human readable name of the resource. + string display_name = 8; + + // The full resource type of the resource. + string type = 6; + + // The full resource name of project that the resource belongs to. + string project = 2; + + // The project ID 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/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..70088c06 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto @@ -0,0 +1,51 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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"; + +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..15c9769f --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/security_marks.proto @@ -0,0 +1,69 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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"; + +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..a95f5c03 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto @@ -0,0 +1,1852 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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/bigquery_export.proto"; +import "google/cloud/securitycenter/v1/external_system.proto"; +import "google/cloud/securitycenter/v1/finding.proto"; +import "google/cloud/securitycenter/v1/folder.proto"; +import "google/cloud/securitycenter/v1/mute_config.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"; + + // Kicks off an LRO to bulk mute findings for a parent based on a filter. The + // parent can be either an organization, folder or project. The findings + // matched by the filter will be muted after the LRO is done. + rpc BulkMuteFindings(BulkMuteFindingsRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/findings:bulkMute" + body: "*" + additional_bindings { + post: "/v1/{parent=folders/*}/findings:bulkMute" + body: "*" + } + additional_bindings { + post: "/v1/{parent=projects/*}/findings:bulkMute" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.securitycenter.v1.BulkMuteFindingsResponse" + metadata_type: "google.protobuf.Empty" + }; + } + + // 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 mute config. + rpc CreateMuteConfig(CreateMuteConfigRequest) returns (MuteConfig) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/muteConfigs" + body: "mute_config" + additional_bindings { + post: "/v1/{parent=folders/*}/muteConfigs" + body: "mute_config" + } + additional_bindings { + post: "/v1/{parent=projects/*}/muteConfigs" + body: "mute_config" + } + }; + option (google.api.method_signature) = "parent,mute_config"; + option (google.api.method_signature) = "parent,mute_config,mute_config_id"; + } + + // 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 an existing mute config. + rpc DeleteMuteConfig(DeleteMuteConfigRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=organizations/*/muteConfigs/*}" + additional_bindings { delete: "/v1/{name=folders/*/muteConfigs/*}" } + additional_bindings { delete: "/v1/{name=projects/*/muteConfigs/*}" } + }; + option (google.api.method_signature) = "name"; + } + + // 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 a big query export. + rpc GetBigQueryExport(GetBigQueryExportRequest) returns (BigQueryExport) { + option (google.api.http) = { + get: "/v1/{name=organizations/*/bigQueryExports/*}" + additional_bindings { get: "/v1/{name=folders/*/bigQueryExports/*}" } + additional_bindings { get: "/v1/{name=projects/*/bigQueryExports/*}" } + }; + 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 mute config. + rpc GetMuteConfig(GetMuteConfigRequest) returns (MuteConfig) { + option (google.api.http) = { + get: "/v1/{name=organizations/*/muteConfigs/*}" + additional_bindings { get: "/v1/{name=folders/*/muteConfigs/*}" } + additional_bindings { get: "/v1/{name=projects/*/muteConfigs/*}" } + }; + option (google.api.method_signature) = "name"; + } + + // 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 mute configs. + rpc ListMuteConfigs(ListMuteConfigsRequest) + returns (ListMuteConfigsResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*}/muteConfigs" + additional_bindings { get: "/v1/{parent=folders/*}/muteConfigs" } + additional_bindings { get: "/v1/{parent=projects/*}/muteConfigs" } + }; + option (google.api.method_signature) = "parent"; + } + + // 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"; + } + + // Updates the mute state of a finding. + rpc SetMute(SetMuteRequest) returns (Finding) { + option (google.api.http) = { + post: "/v1/{name=organizations/*/sources/*/findings/*}:setMute" + body: "*" + additional_bindings { + post: "/v1/{name=folders/*/sources/*/findings/*}:setMute" + body: "*" + } + additional_bindings { + post: "/v1/{name=projects/*/sources/*/findings/*}:setMute" + body: "*" + } + }; + option (google.api.method_signature) = "name,mute"; + } + + // 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"; + } + + // Updates external system. This is for a given finding. + rpc UpdateExternalSystem(UpdateExternalSystemRequest) + returns (ExternalSystem) { + option (google.api.http) = { + patch: "/v1/{external_system.name=organizations/*/sources/*/findings/*/externalSystems/*}" + body: "external_system" + additional_bindings { + patch: "/v1/{external_system.name=folders/*/sources/*/findings/*/externalSystems/*}" + body: "external_system" + } + additional_bindings { + patch: "/v1/{external_system.name=projects/*/sources/*/findings/*/externalSystems/*}" + body: "external_system" + } + }; + option (google.api.method_signature) = "external_system,update_mask"; + } + + // 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 mute config. + rpc UpdateMuteConfig(UpdateMuteConfigRequest) returns (MuteConfig) { + option (google.api.http) = { + patch: "/v1/{mute_config.name=organizations/*/muteConfigs/*}" + body: "mute_config" + additional_bindings { + patch: "/v1/{mute_config.name=folders/*/muteConfigs/*}" + body: "mute_config" + } + additional_bindings { + patch: "/v1/{mute_config.name=projects/*/muteConfigs/*}" + body: "mute_config" + } + }; + option (google.api.method_signature) = "mute_config,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: "/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"; + } + + // Creates a big query export. + rpc CreateBigQueryExport(CreateBigQueryExportRequest) + returns (BigQueryExport) { + option (google.api.http) = { + post: "/v1/{parent=organizations/*}/bigQueryExports" + body: "big_query_export" + additional_bindings { + post: "/v1/{parent=folders/*}/bigQueryExports" + body: "big_query_export" + } + additional_bindings { + post: "/v1/{parent=projects/*}/bigQueryExports" + body: "big_query_export" + } + }; + option (google.api.method_signature) = + "parent,big_query_export,big_query_export_id"; + } + + // Deletes an existing big query export. + rpc DeleteBigQueryExport(DeleteBigQueryExportRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=organizations/*/bigQueryExports/*}" + additional_bindings { delete: "/v1/{name=folders/*/bigQueryExports/*}" } + additional_bindings { delete: "/v1/{name=projects/*/bigQueryExports/*}" } + }; + option (google.api.method_signature) = "name"; + } + + // Updates a BigQuery export. + rpc UpdateBigQueryExport(UpdateBigQueryExportRequest) + returns (BigQueryExport) { + option (google.api.http) = { + patch: "/v1/{big_query_export.name=organizations/*/bigQueryExports/*}" + body: "big_query_export" + additional_bindings { + patch: "/v1/{big_query_export.name=folders/*/bigQueryExports/*}" + body: "big_query_export" + } + additional_bindings { + patch: "/v1/{big_query_export.name=projects/*/bigQueryExports/*}" + body: "big_query_export" + } + }; + option (google.api.method_signature) = "big_query_export,update_mask"; + } + + // Lists BigQuery exports. Note that when requesting BigQuery exports at a + // given level all exports under that level are also returned e.g. if + // requesting BigQuery exports under a folder, then all BigQuery exports + // immediately under the folder plus the ones created under the projects + // within the folder are returned. + rpc ListBigQueryExports(ListBigQueryExportsRequest) + returns (ListBigQueryExportsResponse) { + option (google.api.http) = { + get: "/v1/{parent=organizations/*}/bigQueryExports" + additional_bindings { get: "/v1/{parent=folders/*}/bigQueryExports" } + additional_bindings { get: "/v1/{parent=projects/*}/bigQueryExports" } + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request message for bulk findings update. +// +// Note: +// 1. If multiple bulk update requests match the same resource, the order in +// which they get executed is not defined. +// 2. Once a bulk operation is started, there is no way to stop it. +message BulkMuteFindingsRequest { + // Required. The parent, at which bulk action needs to be applied. Its format + // is "organizations/[organization_id]", "folders/[folder_id]", + // "projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "*" } + ]; + + // Expression that identifies findings that should be updated. + // 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 = 2; + + // This can be a mute configuration name or any identifier for mute/unmute + // of findings based on the filter. + string mute_annotation = 3 [deprecated = true]; +} + +// The response to a BulkMute request. Contains the LRO information. +message BulkMuteFindingsResponse {} + +// 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 mute config. +message CreateMuteConfigRequest { + // Required. Resource name of the new mute configs's parent. 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/MuteConfig" + } + ]; + + // Required. The mute config being created. + MuteConfig mute_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Unique identifier provided by the client within the parent scope. + // It must consist of lower case letters, numbers, and hyphen, with the first + // character a letter, the last a letter or a number, and a 63 character + // maximum. + string mute_config_id = 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 mute config. +message DeleteMuteConfigRequest { + // Required. Name of the mute config to delete. Its format is + // organizations/{organization}/muteConfigs/{config_id}, + // folders/{folder}/muteConfigs/{config_id}, or + // projects/{project}/muteConfigs/{config_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/MuteConfig" + } + ]; +} + +// 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 retrieving a big query export. +message GetBigQueryExportRequest { + // Required. Name of the big query export to retrieve. Its format is + // organizations/{organization}/bigQueryExports/{export_id}, + // folders/{folder}/bigQueryExports/{export_id}, or + // projects/{project}/bigQueryExports/{export_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/BigQueryExport" + } + ]; +} + +// Request message for retrieving a mute config. +message GetMuteConfigRequest { + // Required. Name of the mute config to retrieve. Its format is + // organizations/{organization}/muteConfigs/{config_id}, + // folders/{folder}/muteConfigs/{config_id}, or + // projects/{project}/muteConfigs/{config_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/MuteConfig" + } + ]; +} + +// 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 mute configs at a given scope e.g. organization, +// folder or project. +message ListMuteConfigsRequest { + // Required. The parent, which owns the collection of mute configs. Its format + // is "organizations/[organization_id]", "folders/[folder_id]", + // "projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/MuteConfig" + } + ]; + + // The maximum number of configs to return. The service may return fewer than + // this value. + // If unspecified, at most 10 configs will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListMuteConfigs` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListMuteConfigs` must + // match the call that provided the page token. + string page_token = 3; +} + +// Response message for listing mute configs. +message ListMuteConfigsResponse { + // The mute configs from the specified parent. + repeated MuteConfig mute_configs = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request 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 { + // 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; + } + + // 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 human readable name of the resource. + string display_name = 8; + + // The full resource type of the resource. + string type = 6; + + // The full resource name of project that the resource belongs to. + string project_name = 2; + + // The project ID 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 = 7; + } + + // 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 updating a finding's mute status. +message SetMuteRequest { + // 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}", + // "folders/{folder_id}/sources/{source_id}/finding/{finding_id}", + // "projects/{project_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 Mute. + Finding.Mute mute = 2 [(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 a ExternalSystem resource. +message UpdateExternalSystemRequest { + // Required. The external system resource to update. + ExternalSystem external_system = 1 [(google.api.field_behavior) = REQUIRED]; + + // The FieldMask to use when updating the external system resource. + // + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// 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 mute config. +message UpdateMuteConfigRequest { + // Required. The mute config being updated. + MuteConfig mute_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + // If empty all mutable fields will be updated. + 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. Must be + // earlier or equal to the server time. + google.protobuf.Timestamp start_time = 3; +} + +// Request message for creating a big query export. +message CreateBigQueryExportRequest { + // Required. Resource name of the new big query export's parent. 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/BigQueryExport" + } + ]; + + // Required. The big query export being created. + BigQueryExport big_query_export = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Unique identifier provided by the client within the parent scope. + // It must consist of lower case letters, numbers, and hyphen, with the first + // character a letter, the last a letter or a number, and a 63 character + // maximum. + string big_query_export_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for updating a BigQuery export. +message UpdateBigQueryExportRequest { + // Required. The BigQuery export being updated. + BigQueryExport big_query_export = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + // If empty all mutable fields will be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for listing BigQuery exports at a given scope e.g. +// organization, folder or project. +message ListBigQueryExportsRequest { + // Required. The parent, which owns the collection of BigQuery exports. Its + // format is "organizations/[organization_id]", "folders/[folder_id]", + // "projects/[project_id]". + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "securitycenter.googleapis.com/BigQueryExport" + } + ]; + + // The maximum number of configs to return. The service may return fewer than + // this value. + // If unspecified, at most 10 configs will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // A page token, received from a previous `ListBigQueryExports` call. + // Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to `ListBigQueryExports` + // must match the call that provided the page token. + string page_token = 3; +} + +// Response message for listing BigQuery exports. +message ListBigQueryExportsResponse { + // The BigQuery exports from the specified parent. + repeated BigQueryExport big_query_exports = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for deleting a big query export. +message DeleteBigQueryExportRequest { + // Required. Name of the big query export to delete. Its format is + // organizations/{organization}/bigQueryExports/{export_id}, + // folders/{folder}/bigQueryExports/{export_id}, or + // projects/{project}/bigQueryExports/{export_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "securitycenter.googleapis.com/BigQueryExport" + } + ]; +} 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..75c069a1 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/source.proto @@ -0,0 +1,69 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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"; + +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..3810d90c --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto @@ -0,0 +1,216 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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; + +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; + + // Whether upstream fix is available for the CVE. + bool upstream_fix_available = 4; +} + +// 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.bulk_mute_findings.js b/owl-bot-staging/v1/samples/generated/v1/security_center.bulk_mute_findings.js new file mode 100644 index 00000000..dc7a324f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.bulk_mute_findings.js @@ -0,0 +1,84 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, at which bulk action needs to be applied. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Expression that identifies findings that should be updated. + * 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. + */ + // const filter = 'abc123' + /** + * This can be a mute configuration name or any identifier for mute/unmute + * of findings based on the filter. + */ + // const muteAnnotation = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callBulkMuteFindings() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await securitycenterClient.bulkMuteFindings(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBulkMuteFindings(); + // [END securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_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_big_query_export.js b/owl-bot-staging/v1/samples/generated/v1/security_center.create_big_query_export.js new file mode 100644 index 00000000..83f63f53 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.create_big_query_export.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, bigQueryExport, bigQueryExportId) { + // [START securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new big query export's parent. Its format is + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Required. The big query export being created. + */ + // const bigQueryExport = {} + /** + * Required. Unique identifier provided by the client within the parent scope. + * It must consist of lower case letters, numbers, and hyphen, with the first + * character a letter, the last a letter or a number, and a 63 character + * maximum. + */ + // const bigQueryExportId = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateBigQueryExport() { + // Construct request + const request = { + parent, + bigQueryExport, + bigQueryExportId, + }; + + // Run request + const response = await securitycenterClient.createBigQueryExport(request); + console.log(response); + } + + callCreateBigQueryExport(); + // [END securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_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_finding.js b/owl-bot-staging/v1/samples/generated/v1/security_center.create_finding.js new file mode 100644 index 00000000..c90e509f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.create_finding.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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_mute_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.create_mute_config.js new file mode 100644 index 00000000..f6ad1e56 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.create_mute_config.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, muteConfig, muteConfigId) { + // [START securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource name of the new mute configs's parent. Its format is + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * Required. The mute config being created. + */ + // const muteConfig = {} + /** + * Required. Unique identifier provided by the client within the parent scope. + * It must consist of lower case letters, numbers, and hyphen, with the first + * character a letter, the last a letter or a number, and a 63 character + * maximum. + */ + // const muteConfigId = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callCreateMuteConfig() { + // Construct request + const request = { + parent, + muteConfig, + muteConfigId, + }; + + // Run request + const response = await securitycenterClient.createMuteConfig(request); + console.log(response); + } + + callCreateMuteConfig(); + // [END securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_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..7b101bf3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.create_notification_config.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, 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..b06d0f14 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.create_source.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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_big_query_export.js b/owl-bot-staging/v1/samples/generated/v1/security_center.delete_big_query_export.js new file mode 100644 index 00000000..c82674a4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.delete_big_query_export.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the big query export to delete. Its format is + * organizations/{organization}/bigQueryExports/{export_id}, + * folders/{folder}/bigQueryExports/{export_id}, or + * projects/{project}/bigQueryExports/{export_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 callDeleteBigQueryExport() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.deleteBigQueryExport(request); + console.log(response); + } + + callDeleteBigQueryExport(); + // [END securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_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_mute_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.delete_mute_config.js new file mode 100644 index 00000000..0d3d0984 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.delete_mute_config.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the mute config to delete. Its format is + * organizations/{organization}/muteConfigs/{config_id}, + * folders/{folder}/muteConfigs/{config_id}, or + * projects/{project}/muteConfigs/{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 callDeleteMuteConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.deleteMuteConfig(request); + console.log(response); + } + + callDeleteMuteConfig(); + // [END securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_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..9a922f8d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.delete_notification_config.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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_big_query_export.js b/owl-bot-staging/v1/samples/generated/v1/security_center.get_big_query_export.js new file mode 100644 index 00000000..ca654081 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.get_big_query_export.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the big query export to retrieve. Its format is + * organizations/{organization}/bigQueryExports/{export_id}, + * folders/{folder}/bigQueryExports/{export_id}, or + * projects/{project}/bigQueryExports/{export_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 callGetBigQueryExport() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getBigQueryExport(request); + console.log(response); + } + + callGetBigQueryExport(); + // [END securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_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..c35eaa59 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.get_iam_policy.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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`. + */ + // 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_mute_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.get_mute_config.js new file mode 100644 index 00000000..1364ec1b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.get_mute_config.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the mute config to retrieve. Its format is + * organizations/{organization}/muteConfigs/{config_id}, + * folders/{folder}/muteConfigs/{config_id}, or + * projects/{project}/muteConfigs/{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 callGetMuteConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await securitycenterClient.getMuteConfig(request); + console.log(response); + } + + callGetMuteConfig(); + // [END securitycenter_v1_generated_SecurityCenter_GetMuteConfig_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..090b0283 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.get_notification_config.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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..0bb6cbad --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.get_organization_settings.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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..55f6f645 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.get_source.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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..c1365acc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.group_assets.js @@ -0,0 +1,173 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, 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..b1a357f1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.group_findings.js @@ -0,0 +1,177 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, 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..bf2dd52f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.list_assets.js @@ -0,0 +1,182 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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_big_query_exports.js b/owl-bot-staging/v1/samples/generated/v1/security_center.list_big_query_exports.js new file mode 100644 index 00000000..3dce0c2c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.list_big_query_exports.js @@ -0,0 +1,76 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns the collection of BigQuery exports. Its + * format is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * The maximum number of configs to return. The service may return fewer than + * this value. + * If unspecified, at most 10 configs will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListBigQueryExports` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListBigQueryExports` + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListBigQueryExports() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listBigQueryExportsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBigQueryExports(); + // [END securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_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..15eb8d4a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.list_findings.js @@ -0,0 +1,188 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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_mute_configs.js b/owl-bot-staging/v1/samples/generated/v1/security_center.list_mute_configs.js new file mode 100644 index 00000000..7a20b7d8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.list_mute_configs.js @@ -0,0 +1,76 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns the collection of mute configs. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + */ + // const parent = 'abc123' + /** + * The maximum number of configs to return. The service may return fewer than + * this value. + * If unspecified, at most 10 configs will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListMuteConfigs` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListMuteConfigs` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callListMuteConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await securitycenterClient.listMuteConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMuteConfigs(); + // [END securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_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..2e4e8da7 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.list_notification_configs.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..c4a1ad3d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.list_sources.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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..75b1cc83 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.run_asset_discovery.js @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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..4ef14087 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.set_finding_state.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..f1c269c9 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.set_iam_policy.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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 = {} + /** + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * `paths: "bindings, etag"` + */ + // const updateMask = {} + + // 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.set_mute.js b/owl-bot-staging/v1/samples/generated/v1/security_center.set_mute.js new file mode 100644 index 00000000..b5430cb0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.set_mute.js @@ -0,0 +1,68 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, mute) { + // [START securitycenter_v1_generated_SecurityCenter_SetMute_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}", + * "folders/{folder_id}/sources/{source_id}/finding/{finding_id}", + * "projects/{project_id}/sources/{source_id}/finding/{finding_id}". + */ + // const name = 'abc123' + /** + * Required. The desired state of the Mute. + */ + // const mute = {} + + // Imports the Securitycenter library + const {SecurityCenterClient} = require('@google-cloud/security-center').v1; + + // Instantiates a client + const securitycenterClient = new SecurityCenterClient(); + + async function callSetMute() { + // Construct request + const request = { + name, + mute, + }; + + // Run request + const response = await securitycenterClient.setMute(request); + console.log(response); + } + + callSetMute(); + // [END securitycenter_v1_generated_SecurityCenter_SetMute_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..eec1299c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.test_iam_permissions.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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_big_query_export.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_big_query_export.js new file mode 100644 index 00000000..e74d9c23 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.update_big_query_export.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(bigQueryExport) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The BigQuery export being updated. + */ + // const bigQueryExport = {} + /** + * The list of fields to be updated. + * 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 callUpdateBigQueryExport() { + // Construct request + const request = { + bigQueryExport, + }; + + // Run request + const response = await securitycenterClient.updateBigQueryExport(request); + console.log(response); + } + + callUpdateBigQueryExport(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_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_external_system.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_external_system.js new file mode 100644 index 00000000..0c91e772 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.update_external_system.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(externalSystem) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The external system resource to update. + */ + // const externalSystem = {} + /** + * The FieldMask to use when updating the external system 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 callUpdateExternalSystem() { + // Construct request + const request = { + externalSystem, + }; + + // Run request + const response = await securitycenterClient.updateExternalSystem(request); + console.log(response); + } + + callUpdateExternalSystem(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_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..effade31 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.update_finding.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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_mute_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_mute_config.js new file mode 100644 index 00000000..e624ed19 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.update_mute_config.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(muteConfig) { + // [START securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The mute config being updated. + */ + // const muteConfig = {} + /** + * The list of fields to be updated. + * 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 callUpdateMuteConfig() { + // Construct request + const request = { + muteConfig, + }; + + // Run request + const response = await securitycenterClient.updateMuteConfig(request); + console.log(response); + } + + callUpdateMuteConfig(); + // [END securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_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..d8bc1878 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.update_notification_config.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..31b890d1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.update_organization_settings.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..3f19fca7 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.update_security_marks.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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. Must be + * earlier or equal to the server 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..03c19de4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/security_center.update_source.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json new file mode 100644 index 00000000..a1cbd617 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json @@ -0,0 +1,1699 @@ +{ + "clientLibrary": { + "name": "nodejs-securitycenter", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.securitycenter.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async", + "title": "SecurityCenter bulkMuteFindings Sample", + "origin": "API_DEFINITION", + "description": " Kicks off an LRO to bulk mute findings for a parent based on a filter. The parent can be either an organization, folder or project. The findings matched by the filter will be muted after the LRO is done.", + "canonical": true, + "file": "security_center.bulk_mute_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BulkMuteFindings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.BulkMuteFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "mute_annotation", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "BulkMuteFindings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.BulkMuteFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateSource_async", + "title": "SecurityCenter createSource Sample", + "origin": "API_DEFINITION", + "description": " Creates a source.", + "canonical": true, + "file": "security_center.create_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSource", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateSource", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source", + "type": ".google.cloud.securitycenter.v1.Source" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateSource", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateFinding_async", + "title": "SecurityCenter createFinding Sample", + "origin": "API_DEFINITION", + "description": " Creates a finding. The corresponding source must exist for finding creation to succeed.", + "canonical": true, + "file": "security_center.create_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFinding", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateFinding", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "finding_id", + "type": "TYPE_STRING" + }, + { + "name": "finding", + "type": ".google.cloud.securitycenter.v1.Finding" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateFinding", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateFinding", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async", + "title": "SecurityCenter createMuteConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a mute config.", + "canonical": true, + "file": "security_center.create_mute_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateMuteConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "mute_config", + "type": ".google.cloud.securitycenter.v1.MuteConfig" + }, + { + "name": "mute_config_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.MuteConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateMuteConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async", + "title": "SecurityCenter createNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a notification config.", + "canonical": true, + "file": "security_center.create_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateNotificationConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "config_id", + "type": "TYPE_STRING" + }, + { + "name": "notification_config", + "type": ".google.cloud.securitycenter.v1.NotificationConfig" + } + ], + "resultType": ".google.cloud.securitycenter.v1.NotificationConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async", + "title": "SecurityCenter deleteMuteConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing mute config.", + "canonical": true, + "file": "security_center.delete_mute_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteMuteConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "DeleteMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteMuteConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async", + "title": "SecurityCenter deleteNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes a notification config.", + "canonical": true, + "file": "security_center.delete_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteNotificationConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "DeleteNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async", + "title": "SecurityCenter getBigQueryExport Sample", + "origin": "API_DEFINITION", + "description": " Gets a big query export.", + "canonical": true, + "file": "security_center.get_big_query_export.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetBigQueryExport", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.BigQueryExport", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetBigQueryExport", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async", + "title": "SecurityCenter getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy on the specified Source.", + "canonical": true, + "file": "security_center.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetIamPolicy", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async", + "title": "SecurityCenter getMuteConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a mute config.", + "canonical": true, + "file": "security_center.get_mute_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetMuteConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.MuteConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetMuteConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async", + "title": "SecurityCenter getNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a notification config.", + "canonical": true, + "file": "security_center.get_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetNotificationConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.NotificationConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async", + "title": "SecurityCenter getOrganizationSettings Sample", + "origin": "API_DEFINITION", + "description": " Gets the settings for an organization.", + "canonical": true, + "file": "security_center.get_organization_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetOrganizationSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.OrganizationSettings", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetOrganizationSettings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GetSource_async", + "title": "SecurityCenter getSource Sample", + "origin": "API_DEFINITION", + "description": " Gets a source.", + "canonical": true, + "file": "security_center.get_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSource", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetSource", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GetSource", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GroupAssets_async", + "title": "SecurityCenter groupAssets Sample", + "origin": "API_DEFINITION", + "description": " Filters an organization's assets and groups them by their specified properties.", + "canonical": true, + "file": "security_center.group_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 165, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GroupAssets", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "group_by", + "type": "TYPE_STRING" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1.GroupAssetsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GroupAssets", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupAssets", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_GroupFindings_async", + "title": "SecurityCenter groupFindings Sample", + "origin": "API_DEFINITION", + "description": " 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", + "canonical": true, + "file": "security_center.group_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 169, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GroupFindings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "group_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1.GroupFindingsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "GroupFindings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListAssets_async", + "title": "SecurityCenter listAssets Sample", + "origin": "API_DEFINITION", + "description": " Lists an organization's assets.", + "canonical": true, + "file": "security_center.list_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 174, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAssets", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListAssetsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListAssets", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListAssets", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListFindings_async", + "title": "SecurityCenter listFindings Sample", + "origin": "API_DEFINITION", + "description": " 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", + "canonical": true, + "file": "security_center.list_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 180, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListFindingsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListFindings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async", + "title": "SecurityCenter listMuteConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists mute configs.", + "canonical": true, + "file": "security_center.list_mute_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMuteConfigs", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListMuteConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListMuteConfigsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListMuteConfigs", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListMuteConfigs", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async", + "title": "SecurityCenter listNotificationConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists notification configs.", + "canonical": true, + "file": "security_center.list_notification_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNotificationConfigs", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListNotificationConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListNotificationConfigsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListNotificationConfigs", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListNotificationConfigs", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListSources_async", + "title": "SecurityCenter listSources Sample", + "origin": "API_DEFINITION", + "description": " Lists all sources belonging to an organization.", + "canonical": true, + "file": "security_center.list_sources.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSources", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListSources", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListSourcesResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListSources", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListSources", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async", + "title": "SecurityCenter runAssetDiscovery Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "security_center.run_asset_discovery.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RunAssetDiscovery", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.RunAssetDiscovery", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "RunAssetDiscovery", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.RunAssetDiscovery", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_SetFindingState_async", + "title": "SecurityCenter setFindingState Sample", + "origin": "API_DEFINITION", + "description": " Updates the state of a finding.", + "canonical": true, + "file": "security_center.set_finding_state.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetFindingState", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetFindingState", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "state", + "type": ".google.cloud.securitycenter.v1.Finding.State" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "SetFindingState", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetFindingState", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_SetMute_async", + "title": "SecurityCenter setMute Sample", + "origin": "API_DEFINITION", + "description": " Updates the mute state of a finding.", + "canonical": true, + "file": "security_center.set_mute.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetMute", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetMute", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "mute", + "type": ".google.cloud.securitycenter.v1.Finding.Mute" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "SetMute", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetMute", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async", + "title": "SecurityCenter setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy on the specified Source.", + "canonical": true, + "file": "security_center.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetIamPolicy", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async", + "title": "SecurityCenter testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns the permissions that a caller has on the specified source.", + "canonical": true, + "file": "security_center.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.TestIamPermissions", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async", + "title": "SecurityCenter updateExternalSystem Sample", + "origin": "API_DEFINITION", + "description": " Updates external system. This is for a given finding.", + "canonical": true, + "file": "security_center.update_external_system.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateExternalSystem", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateExternalSystem", + "async": true, + "parameters": [ + { + "name": "external_system", + "type": ".google.cloud.securitycenter.v1.ExternalSystem" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ExternalSystem", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateExternalSystem", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateExternalSystem", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateFinding_async", + "title": "SecurityCenter updateFinding Sample", + "origin": "API_DEFINITION", + "description": " Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.", + "canonical": true, + "file": "security_center.update_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFinding", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateFinding", + "async": true, + "parameters": [ + { + "name": "finding", + "type": ".google.cloud.securitycenter.v1.Finding" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateFinding", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateFinding", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async", + "title": "SecurityCenter updateMuteConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a mute config.", + "canonical": true, + "file": "security_center.update_mute_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateMuteConfig", + "async": true, + "parameters": [ + { + "name": "mute_config", + "type": ".google.cloud.securitycenter.v1.MuteConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.MuteConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateMuteConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateMuteConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async", + "title": "SecurityCenter updateNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a notification config. The following update fields are allowed: description, pubsub_topic, streaming_config.filter", + "canonical": true, + "file": "security_center.update_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateNotificationConfig", + "async": true, + "parameters": [ + { + "name": "notification_config", + "type": ".google.cloud.securitycenter.v1.NotificationConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.NotificationConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async", + "title": "SecurityCenter updateOrganizationSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates an organization's settings.", + "canonical": true, + "file": "security_center.update_organization_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateOrganizationSettings", + "async": true, + "parameters": [ + { + "name": "organization_settings", + "type": ".google.cloud.securitycenter.v1.OrganizationSettings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.OrganizationSettings", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateOrganizationSettings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateSource_async", + "title": "SecurityCenter updateSource Sample", + "origin": "API_DEFINITION", + "description": " Updates a source.", + "canonical": true, + "file": "security_center.update_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSource", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSource", + "async": true, + "parameters": [ + { + "name": "source", + "type": ".google.cloud.securitycenter.v1.Source" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateSource", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async", + "title": "SecurityCenter updateSecurityMarks Sample", + "origin": "API_DEFINITION", + "description": " Updates security marks.", + "canonical": true, + "file": "security_center.update_security_marks.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSecurityMarks", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSecurityMarks", + "async": true, + "parameters": [ + { + "name": "security_marks", + "type": ".google.cloud.securitycenter.v1.SecurityMarks" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.securitycenter.v1.SecurityMarks", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateSecurityMarks", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSecurityMarks", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async", + "title": "SecurityCenter createBigQueryExport Sample", + "origin": "API_DEFINITION", + "description": " Creates a big query export.", + "canonical": true, + "file": "security_center.create_big_query_export.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateBigQueryExport", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "big_query_export", + "type": ".google.cloud.securitycenter.v1.BigQueryExport" + }, + { + "name": "big_query_export_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.BigQueryExport", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateBigQueryExport", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async", + "title": "SecurityCenter deleteBigQueryExport Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing big query export.", + "canonical": true, + "file": "security_center.delete_big_query_export.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteBigQueryExport", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "DeleteBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteBigQueryExport", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async", + "title": "SecurityCenter updateBigQueryExport Sample", + "origin": "API_DEFINITION", + "description": " Updates a BigQuery export.", + "canonical": true, + "file": "security_center.update_big_query_export.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateBigQueryExport", + "async": true, + "parameters": [ + { + "name": "big_query_export", + "type": ".google.cloud.securitycenter.v1.BigQueryExport" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1.BigQueryExport", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateBigQueryExport", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateBigQueryExport", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async", + "title": "SecurityCenter listBigQueryExports Sample", + "origin": "API_DEFINITION", + "description": " Lists BigQuery exports. Note that when requesting BigQuery exports at a given level all exports under that level are also returned e.g. if requesting BigQuery exports under a folder, then all BigQuery exports immediately under the folder plus the ones created under the projects within the folder are returned.", + "canonical": true, + "file": "security_center.list_big_query_exports.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBigQueryExports", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListBigQueryExports", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1.ListBigQueryExportsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" + }, + "method": { + "shortName": "ListBigQueryExports", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListBigQueryExports", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1.SecurityCenter" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 00000000..dfd6be93 --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +const 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..adec8cae --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,415 @@ +{ + "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" + ] + }, + "CreateMuteConfig": { + "methods": [ + "createMuteConfig" + ] + }, + "CreateNotificationConfig": { + "methods": [ + "createNotificationConfig" + ] + }, + "DeleteMuteConfig": { + "methods": [ + "deleteMuteConfig" + ] + }, + "DeleteNotificationConfig": { + "methods": [ + "deleteNotificationConfig" + ] + }, + "GetBigQueryExport": { + "methods": [ + "getBigQueryExport" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetMuteConfig": { + "methods": [ + "getMuteConfig" + ] + }, + "GetNotificationConfig": { + "methods": [ + "getNotificationConfig" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetMute": { + "methods": [ + "setMute" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateExternalSystem": { + "methods": [ + "updateExternalSystem" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateMuteConfig": { + "methods": [ + "updateMuteConfig" + ] + }, + "UpdateNotificationConfig": { + "methods": [ + "updateNotificationConfig" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "CreateBigQueryExport": { + "methods": [ + "createBigQueryExport" + ] + }, + "DeleteBigQueryExport": { + "methods": [ + "deleteBigQueryExport" + ] + }, + "UpdateBigQueryExport": { + "methods": [ + "updateBigQueryExport" + ] + }, + "BulkMuteFindings": { + "methods": [ + "bulkMuteFindings" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListMuteConfigs": { + "methods": [ + "listMuteConfigs", + "listMuteConfigsStream", + "listMuteConfigsAsync" + ] + }, + "ListNotificationConfigs": { + "methods": [ + "listNotificationConfigs", + "listNotificationConfigsStream", + "listNotificationConfigsAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + }, + "ListBigQueryExports": { + "methods": [ + "listBigQueryExports", + "listBigQueryExportsStream", + "listBigQueryExportsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SecurityCenterClient", + "rpcs": { + "CreateSource": { + "methods": [ + "createSource" + ] + }, + "CreateFinding": { + "methods": [ + "createFinding" + ] + }, + "CreateMuteConfig": { + "methods": [ + "createMuteConfig" + ] + }, + "CreateNotificationConfig": { + "methods": [ + "createNotificationConfig" + ] + }, + "DeleteMuteConfig": { + "methods": [ + "deleteMuteConfig" + ] + }, + "DeleteNotificationConfig": { + "methods": [ + "deleteNotificationConfig" + ] + }, + "GetBigQueryExport": { + "methods": [ + "getBigQueryExport" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "GetMuteConfig": { + "methods": [ + "getMuteConfig" + ] + }, + "GetNotificationConfig": { + "methods": [ + "getNotificationConfig" + ] + }, + "GetOrganizationSettings": { + "methods": [ + "getOrganizationSettings" + ] + }, + "GetSource": { + "methods": [ + "getSource" + ] + }, + "SetFindingState": { + "methods": [ + "setFindingState" + ] + }, + "SetMute": { + "methods": [ + "setMute" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateExternalSystem": { + "methods": [ + "updateExternalSystem" + ] + }, + "UpdateFinding": { + "methods": [ + "updateFinding" + ] + }, + "UpdateMuteConfig": { + "methods": [ + "updateMuteConfig" + ] + }, + "UpdateNotificationConfig": { + "methods": [ + "updateNotificationConfig" + ] + }, + "UpdateOrganizationSettings": { + "methods": [ + "updateOrganizationSettings" + ] + }, + "UpdateSource": { + "methods": [ + "updateSource" + ] + }, + "UpdateSecurityMarks": { + "methods": [ + "updateSecurityMarks" + ] + }, + "CreateBigQueryExport": { + "methods": [ + "createBigQueryExport" + ] + }, + "DeleteBigQueryExport": { + "methods": [ + "deleteBigQueryExport" + ] + }, + "UpdateBigQueryExport": { + "methods": [ + "updateBigQueryExport" + ] + }, + "BulkMuteFindings": { + "methods": [ + "bulkMuteFindings" + ] + }, + "RunAssetDiscovery": { + "methods": [ + "runAssetDiscovery" + ] + }, + "GroupAssets": { + "methods": [ + "groupAssets", + "groupAssetsStream", + "groupAssetsAsync" + ] + }, + "GroupFindings": { + "methods": [ + "groupFindings", + "groupFindingsStream", + "groupFindingsAsync" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + }, + "ListMuteConfigs": { + "methods": [ + "listMuteConfigs", + "listMuteConfigsStream", + "listMuteConfigsAsync" + ] + }, + "ListNotificationConfigs": { + "methods": [ + "listNotificationConfigs", + "listNotificationConfigsStream", + "listNotificationConfigsAsync" + ] + }, + "ListSources": { + "methods": [ + "listSources", + "listSourcesStream", + "listSourcesAsync" + ] + }, + "ListBigQueryExports": { + "methods": [ + "listBigQueryExports", + "listBigQueryExportsStream", + "listBigQueryExportsAsync" + ] + } + } + } + } + } + } +} 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..d7817680 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {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..e7baa596 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/security_center_client.ts @@ -0,0 +1,6712 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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' + ), + folderExportPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/bigQueryExports/{export}' + ), + folderMuteConfigPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/muteConfigs/{mute_config}' + ), + folderSourcePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}' + ), + folderSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}/findings/{finding}' + ), + folderSourceFindingExternalsystemPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}' + ), + 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' + ), + organizationExportPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/bigQueryExports/{export}' + ), + organizationMuteConfigPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/muteConfigs/{mute_config}' + ), + 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}' + ), + organizationSourceFindingExternalsystemPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}' + ), + 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' + ), + projectExportPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/bigQueryExports/{export}' + ), + projectMuteConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/muteConfigs/{mute_config}' + ), + projectSourcePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}' + ), + projectSourceFindingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}/findings/{finding}' + ), + projectSourceFindingExternalsystemPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}' + ), + 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'), + listMuteConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'muteConfigs'), + listNotificationConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notificationConfigs'), + listSources: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources'), + listBigQueryExports: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'bigQueryExports') + }; + + 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 bulkMuteFindingsResponse = protoFilesRoot.lookup( + '.google.cloud.securitycenter.v1.BulkMuteFindingsResponse') as gax.protobuf.Type; + const bulkMuteFindingsMetadata = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + 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 = { + bulkMuteFindings: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + bulkMuteFindingsResponse.decode.bind(bulkMuteFindingsResponse), + bulkMuteFindingsMetadata.decode.bind(bulkMuteFindingsMetadata)), + 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 = + ['bulkMuteFindings', 'createSource', 'createFinding', 'createMuteConfig', 'createNotificationConfig', 'deleteMuteConfig', 'deleteNotificationConfig', 'getBigQueryExport', 'getIamPolicy', 'getMuteConfig', 'getNotificationConfig', 'getOrganizationSettings', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listFindings', 'listMuteConfigs', 'listNotificationConfigs', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setMute', 'setIamPolicy', 'testIamPermissions', 'updateExternalSystem', 'updateFinding', 'updateMuteConfig', 'updateNotificationConfig', 'updateOrganizationSettings', 'updateSource', 'updateSecurityMarks', 'createBigQueryExport', 'deleteBigQueryExport', 'updateBigQueryExport', 'listBigQueryExports']; + 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 mute config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new mute configs's parent. Its format is + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {google.cloud.securitycenter.v1.MuteConfig} request.muteConfig + * Required. The mute config being created. + * @param {string} request.muteConfigId + * Required. Unique identifier provided by the client within the parent scope. + * It must consist of lower case letters, numbers, and hyphen, with the first + * character a letter, the last a letter or a number, and a 63 character + * maximum. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [MuteConfig]{@link google.cloud.securitycenter.v1.MuteConfig}. + * 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_mute_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async + */ + createMuteConfig( + request?: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|undefined, {}|undefined + ]>; + createMuteConfig( + request: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + createMuteConfig( + request: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + createMuteConfig( + request?: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|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.createMuteConfig(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 an existing mute config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the mute config to delete. Its format is + * organizations/{organization}/muteConfigs/{config_id}, + * folders/{folder}/muteConfigs/{config_id}, or + * projects/{project}/muteConfigs/{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_mute_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async + */ + deleteMuteConfig( + request?: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|undefined, {}|undefined + ]>; + deleteMuteConfig( + request: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteMuteConfig( + request: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteMuteConfig( + request?: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|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.deleteMuteConfig(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 a big query export. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the big query export to retrieve. Its format is + * organizations/{organization}/bigQueryExports/{export_id}, + * folders/{folder}/bigQueryExports/{export_id}, or + * projects/{project}/bigQueryExports/{export_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 [BigQueryExport]{@link google.cloud.securitycenter.v1.BigQueryExport}. + * 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_big_query_export.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async + */ + getBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|undefined, {}|undefined + ]>; + getBigQueryExport( + request: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + getBigQueryExport( + request: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + getBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|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.getBigQueryExport(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`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 mute config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the mute config to retrieve. Its format is + * organizations/{organization}/muteConfigs/{config_id}, + * folders/{folder}/muteConfigs/{config_id}, or + * projects/{project}/muteConfigs/{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 [MuteConfig]{@link google.cloud.securitycenter.v1.MuteConfig}. + * 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_mute_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async + */ + getMuteConfig( + request?: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|undefined, {}|undefined + ]>; + getMuteConfig( + request: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + getMuteConfig( + request: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + getMuteConfig( + request?: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|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.getMuteConfig(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); + } +/** + * Updates the mute 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}", + * "folders/{folder_id}/sources/{source_id}/finding/{finding_id}", + * "projects/{project_id}/sources/{source_id}/finding/{finding_id}". + * @param {google.cloud.securitycenter.v1.Finding.Mute} request.mute + * Required. The desired state of the Mute. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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_mute.js + * region_tag:securitycenter_v1_generated_SecurityCenter_SetMute_async + */ + setMute( + request?: protos.google.cloud.securitycenter.v1.ISetMuteRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetMuteRequest|undefined, {}|undefined + ]>; + setMute( + request: protos.google.cloud.securitycenter.v1.ISetMuteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, + {}|null|undefined>): void; + setMute( + request: protos.google.cloud.securitycenter.v1.ISetMuteRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, + {}|null|undefined>): void; + setMute( + request?: protos.google.cloud.securitycenter.v1.ISetMuteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IFinding, + protos.google.cloud.securitycenter.v1.ISetMuteRequest|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.setMute(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 {google.protobuf.FieldMask} request.updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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); + } +/** + * Updates external system. This is for a given finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.ExternalSystem} request.externalSystem + * Required. The external system resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * The FieldMask to use when updating the external system 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 [ExternalSystem]{@link google.cloud.securitycenter.v1.ExternalSystem}. + * 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_external_system.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async + */ + updateExternalSystem( + request?: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IExternalSystem, + protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|undefined, {}|undefined + ]>; + updateExternalSystem( + request: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IExternalSystem, + protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, + {}|null|undefined>): void; + updateExternalSystem( + request: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IExternalSystem, + protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, + {}|null|undefined>): void; + updateExternalSystem( + request?: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IExternalSystem, + protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IExternalSystem, + protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IExternalSystem, + protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|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({ + 'external_system.name': request.externalSystem!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateExternalSystem(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 mute config. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.MuteConfig} request.muteConfig + * Required. The mute config being updated. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to 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. + * The first element of the array is an object representing [MuteConfig]{@link google.cloud.securitycenter.v1.MuteConfig}. + * 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_mute_config.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async + */ + updateMuteConfig( + request?: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|undefined, {}|undefined + ]>; + updateMuteConfig( + request: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + updateMuteConfig( + request: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, + {}|null|undefined>): void; + updateMuteConfig( + request?: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig, + protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|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({ + 'mute_config.name': request.muteConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateMuteConfig(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. Must be + * earlier or equal to the server 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); + } +/** + * Creates a big query export. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the new big query export's parent. Its format is + * "organizations/[organization_id]", "folders/[folder_id]", or + * "projects/[project_id]". + * @param {google.cloud.securitycenter.v1.BigQueryExport} request.bigQueryExport + * Required. The big query export being created. + * @param {string} request.bigQueryExportId + * Required. Unique identifier provided by the client within the parent scope. + * It must consist of lower case letters, numbers, and hyphen, with the first + * character a letter, the last a letter or a number, and a 63 character + * maximum. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [BigQueryExport]{@link google.cloud.securitycenter.v1.BigQueryExport}. + * 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_big_query_export.js + * region_tag:securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async + */ + createBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|undefined, {}|undefined + ]>; + createBigQueryExport( + request: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + createBigQueryExport( + request: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + createBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|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.createBigQueryExport(request, options, callback); + } +/** + * Deletes an existing big query export. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the big query export to delete. Its format is + * organizations/{organization}/bigQueryExports/{export_id}, + * folders/{folder}/bigQueryExports/{export_id}, or + * projects/{project}/bigQueryExports/{export_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_big_query_export.js + * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async + */ + deleteBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|undefined, {}|undefined + ]>; + deleteBigQueryExport( + request: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + deleteBigQueryExport( + request: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + deleteBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|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.deleteBigQueryExport(request, options, callback); + } +/** + * Updates a BigQuery export. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.securitycenter.v1.BigQueryExport} request.bigQueryExport + * Required. The BigQuery export being updated. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to 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. + * The first element of the array is an object representing [BigQueryExport]{@link google.cloud.securitycenter.v1.BigQueryExport}. + * 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_big_query_export.js + * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async + */ + updateBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|undefined, {}|undefined + ]>; + updateBigQueryExport( + request: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + updateBigQueryExport( + request: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, + callback: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, + {}|null|undefined>): void; + updateBigQueryExport( + request?: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport, + protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|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({ + 'big_query_export.name': request.bigQueryExport!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateBigQueryExport(request, options, callback); + } + +/** + * Kicks off an LRO to bulk mute findings for a parent based on a filter. The + * parent can be either an organization, folder or project. The findings + * matched by the filter will be muted after the LRO is done. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, at which bulk action needs to be applied. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {string} request.filter + * Expression that identifies findings that should be updated. + * 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. + * @param {string} request.muteAnnotation + * This can be a mute configuration name or any identifier for mute/unmute + * of findings based on the filter. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.bulk_mute_findings.js + * region_tag:securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async + */ + bulkMuteFindings( + request?: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + bulkMuteFindings( + request: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + bulkMuteFindings( + request: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + bulkMuteFindings( + request?: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, + 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.bulkMuteFindings(request, options, callback); + } +/** + * Check the status of the long running operation returned by `bulkMuteFindings()`. + * @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.bulk_mute_findings.js + * region_tag:securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async + */ + async checkBulkMuteFindingsProgress(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.bulkMuteFindings, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * 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 mute configs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns the collection of mute configs. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {number} request.pageSize + * The maximum number of configs to return. The service may return fewer than + * this value. + * If unspecified, at most 10 configs will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListMuteConfigs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListMuteConfigs` must + * match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [MuteConfig]{@link google.cloud.securitycenter.v1.MuteConfig}. + * 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 `listMuteConfigsAsync()` + * 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. + */ + listMuteConfigs( + request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig[], + protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest|null, + protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse + ]>; + listMuteConfigs( + request: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IMuteConfig>): void; + listMuteConfigs( + request: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IMuteConfig>): void; + listMuteConfigs( + request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IMuteConfig>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IMuteConfig>): + Promise<[ + protos.google.cloud.securitycenter.v1.IMuteConfig[], + protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest|null, + protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listMuteConfigs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns the collection of mute configs. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {number} request.pageSize + * The maximum number of configs to return. The service may return fewer than + * this value. + * If unspecified, at most 10 configs will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListMuteConfigs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListMuteConfigs` must + * match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [MuteConfig]{@link google.cloud.securitycenter.v1.MuteConfig} 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 `listMuteConfigsAsync()` + * 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. + */ + listMuteConfigsStream( + request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + 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['listMuteConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMuteConfigs.createStream( + this.innerApiCalls.listMuteConfigs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMuteConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns the collection of mute configs. Its format + * is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {number} request.pageSize + * The maximum number of configs to return. The service may return fewer than + * this value. + * If unspecified, at most 10 configs will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListMuteConfigs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListMuteConfigs` must + * match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [MuteConfig]{@link google.cloud.securitycenter.v1.MuteConfig}. 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_mute_configs.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async + */ + listMuteConfigsAsync( + request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, + 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['listMuteConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMuteConfigs.asyncIterate( + this.innerApiCalls['listMuteConfigs'] 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; + } + /** + * Lists BigQuery exports. Note that when requesting BigQuery exports at a + * given level all exports under that level are also returned e.g. if + * requesting BigQuery exports under a folder, then all BigQuery exports + * immediately under the folder plus the ones created under the projects + * within the folder are returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns the collection of BigQuery exports. Its + * format is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {number} request.pageSize + * The maximum number of configs to return. The service may return fewer than + * this value. + * If unspecified, at most 10 configs will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBigQueryExports` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListBigQueryExports` + * must match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [BigQueryExport]{@link google.cloud.securitycenter.v1.BigQueryExport}. + * 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 `listBigQueryExportsAsync()` + * 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. + */ + listBigQueryExports( + request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport[], + protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest|null, + protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse + ]>; + listBigQueryExports( + request: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IBigQueryExport>): void; + listBigQueryExports( + request: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + callback: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IBigQueryExport>): void; + listBigQueryExports( + request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IBigQueryExport>, + callback?: PaginationCallback< + protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, + protos.google.cloud.securitycenter.v1.IBigQueryExport>): + Promise<[ + protos.google.cloud.securitycenter.v1.IBigQueryExport[], + protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest|null, + protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listBigQueryExports(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns the collection of BigQuery exports. Its + * format is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {number} request.pageSize + * The maximum number of configs to return. The service may return fewer than + * this value. + * If unspecified, at most 10 configs will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBigQueryExports` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListBigQueryExports` + * must match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [BigQueryExport]{@link google.cloud.securitycenter.v1.BigQueryExport} 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 `listBigQueryExportsAsync()` + * 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. + */ + listBigQueryExportsStream( + request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + 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['listBigQueryExports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBigQueryExports.createStream( + this.innerApiCalls.listBigQueryExports as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listBigQueryExports`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns the collection of BigQuery exports. Its + * format is "organizations/[organization_id]", "folders/[folder_id]", + * "projects/[project_id]". + * @param {number} request.pageSize + * The maximum number of configs to return. The service may return fewer than + * this value. + * If unspecified, at most 10 configs will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBigQueryExports` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListBigQueryExports` + * must match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [BigQueryExport]{@link google.cloud.securitycenter.v1.BigQueryExport}. 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_big_query_exports.js + * region_tag:securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async + */ + listBigQueryExportsAsync( + request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, + 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['listBigQueryExports']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBigQueryExports.asyncIterate( + this.innerApiCalls['listBigQueryExports'] 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 folderExport resource name string. + * + * @param {string} folder + * @param {string} exportParam + * @returns {string} Resource name string. + */ + folderExportPath(folder:string,exportParam:string) { + return this.pathTemplates.folderExportPathTemplate.render({ + folder: folder, + export: exportParam, + }); + } + + /** + * Parse the folder from FolderExport resource. + * + * @param {string} folderExportName + * A fully-qualified path representing folder_export resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderExportName(folderExportName: string) { + return this.pathTemplates.folderExportPathTemplate.match(folderExportName).folder; + } + + /** + * Parse the export from FolderExport resource. + * + * @param {string} folderExportName + * A fully-qualified path representing folder_export resource. + * @returns {string} A string representing the export. + */ + matchExportFromFolderExportName(folderExportName: string) { + return this.pathTemplates.folderExportPathTemplate.match(folderExportName).export; + } + + /** + * Return a fully-qualified folderMuteConfig resource name string. + * + * @param {string} folder + * @param {string} mute_config + * @returns {string} Resource name string. + */ + folderMuteConfigPath(folder:string,muteConfig:string) { + return this.pathTemplates.folderMuteConfigPathTemplate.render({ + folder: folder, + mute_config: muteConfig, + }); + } + + /** + * Parse the folder from FolderMuteConfig resource. + * + * @param {string} folderMuteConfigName + * A fully-qualified path representing folder_mute_config resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderMuteConfigName(folderMuteConfigName: string) { + return this.pathTemplates.folderMuteConfigPathTemplate.match(folderMuteConfigName).folder; + } + + /** + * Parse the mute_config from FolderMuteConfig resource. + * + * @param {string} folderMuteConfigName + * A fully-qualified path representing folder_mute_config resource. + * @returns {string} A string representing the mute_config. + */ + matchMuteConfigFromFolderMuteConfigName(folderMuteConfigName: string) { + return this.pathTemplates.folderMuteConfigPathTemplate.match(folderMuteConfigName).mute_config; + } + + /** + * 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 folderSourceFindingExternalsystem resource name string. + * + * @param {string} folder + * @param {string} source + * @param {string} finding + * @param {string} externalsystem + * @returns {string} Resource name string. + */ + folderSourceFindingExternalsystemPath(folder:string,source:string,finding:string,externalsystem:string) { + return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.render({ + folder: folder, + source: source, + finding: finding, + externalsystem: externalsystem, + }); + } + + /** + * Parse the folder from FolderSourceFindingExternalsystem resource. + * + * @param {string} folderSourceFindingExternalsystemName + * A fully-qualified path representing folder_source_finding_externalsystem resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { + return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).folder; + } + + /** + * Parse the source from FolderSourceFindingExternalsystem resource. + * + * @param {string} folderSourceFindingExternalsystemName + * A fully-qualified path representing folder_source_finding_externalsystem resource. + * @returns {string} A string representing the source. + */ + matchSourceFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { + return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).source; + } + + /** + * Parse the finding from FolderSourceFindingExternalsystem resource. + * + * @param {string} folderSourceFindingExternalsystemName + * A fully-qualified path representing folder_source_finding_externalsystem resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { + return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).finding; + } + + /** + * Parse the externalsystem from FolderSourceFindingExternalsystem resource. + * + * @param {string} folderSourceFindingExternalsystemName + * A fully-qualified path representing folder_source_finding_externalsystem resource. + * @returns {string} A string representing the externalsystem. + */ + matchExternalsystemFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { + return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).externalsystem; + } + + /** + * 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 organizationExport resource name string. + * + * @param {string} organization + * @param {string} exportParam + * @returns {string} Resource name string. + */ + organizationExportPath(organization:string,exportParam:string) { + return this.pathTemplates.organizationExportPathTemplate.render({ + organization: organization, + export: exportParam, + }); + } + + /** + * Parse the organization from OrganizationExport resource. + * + * @param {string} organizationExportName + * A fully-qualified path representing organization_export resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationExportName(organizationExportName: string) { + return this.pathTemplates.organizationExportPathTemplate.match(organizationExportName).organization; + } + + /** + * Parse the export from OrganizationExport resource. + * + * @param {string} organizationExportName + * A fully-qualified path representing organization_export resource. + * @returns {string} A string representing the export. + */ + matchExportFromOrganizationExportName(organizationExportName: string) { + return this.pathTemplates.organizationExportPathTemplate.match(organizationExportName).export; + } + + /** + * Return a fully-qualified organizationMuteConfig resource name string. + * + * @param {string} organization + * @param {string} mute_config + * @returns {string} Resource name string. + */ + organizationMuteConfigPath(organization:string,muteConfig:string) { + return this.pathTemplates.organizationMuteConfigPathTemplate.render({ + organization: organization, + mute_config: muteConfig, + }); + } + + /** + * Parse the organization from OrganizationMuteConfig resource. + * + * @param {string} organizationMuteConfigName + * A fully-qualified path representing organization_mute_config resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationMuteConfigName(organizationMuteConfigName: string) { + return this.pathTemplates.organizationMuteConfigPathTemplate.match(organizationMuteConfigName).organization; + } + + /** + * Parse the mute_config from OrganizationMuteConfig resource. + * + * @param {string} organizationMuteConfigName + * A fully-qualified path representing organization_mute_config resource. + * @returns {string} A string representing the mute_config. + */ + matchMuteConfigFromOrganizationMuteConfigName(organizationMuteConfigName: string) { + return this.pathTemplates.organizationMuteConfigPathTemplate.match(organizationMuteConfigName).mute_config; + } + + /** + * 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 organizationSourceFindingExternalsystem resource name string. + * + * @param {string} organization + * @param {string} source + * @param {string} finding + * @param {string} externalsystem + * @returns {string} Resource name string. + */ + organizationSourceFindingExternalsystemPath(organization:string,source:string,finding:string,externalsystem:string) { + return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.render({ + organization: organization, + source: source, + finding: finding, + externalsystem: externalsystem, + }); + } + + /** + * Parse the organization from OrganizationSourceFindingExternalsystem resource. + * + * @param {string} organizationSourceFindingExternalsystemName + * A fully-qualified path representing organization_source_finding_externalsystem resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { + return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).organization; + } + + /** + * Parse the source from OrganizationSourceFindingExternalsystem resource. + * + * @param {string} organizationSourceFindingExternalsystemName + * A fully-qualified path representing organization_source_finding_externalsystem resource. + * @returns {string} A string representing the source. + */ + matchSourceFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { + return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).source; + } + + /** + * Parse the finding from OrganizationSourceFindingExternalsystem resource. + * + * @param {string} organizationSourceFindingExternalsystemName + * A fully-qualified path representing organization_source_finding_externalsystem resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { + return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).finding; + } + + /** + * Parse the externalsystem from OrganizationSourceFindingExternalsystem resource. + * + * @param {string} organizationSourceFindingExternalsystemName + * A fully-qualified path representing organization_source_finding_externalsystem resource. + * @returns {string} A string representing the externalsystem. + */ + matchExternalsystemFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { + return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).externalsystem; + } + + /** + * 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 projectExport resource name string. + * + * @param {string} project + * @param {string} exportParam + * @returns {string} Resource name string. + */ + projectExportPath(project:string,exportParam:string) { + return this.pathTemplates.projectExportPathTemplate.render({ + project: project, + export: exportParam, + }); + } + + /** + * Parse the project from ProjectExport resource. + * + * @param {string} projectExportName + * A fully-qualified path representing project_export resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectExportName(projectExportName: string) { + return this.pathTemplates.projectExportPathTemplate.match(projectExportName).project; + } + + /** + * Parse the export from ProjectExport resource. + * + * @param {string} projectExportName + * A fully-qualified path representing project_export resource. + * @returns {string} A string representing the export. + */ + matchExportFromProjectExportName(projectExportName: string) { + return this.pathTemplates.projectExportPathTemplate.match(projectExportName).export; + } + + /** + * Return a fully-qualified projectMuteConfig resource name string. + * + * @param {string} project + * @param {string} mute_config + * @returns {string} Resource name string. + */ + projectMuteConfigPath(project:string,muteConfig:string) { + return this.pathTemplates.projectMuteConfigPathTemplate.render({ + project: project, + mute_config: muteConfig, + }); + } + + /** + * Parse the project from ProjectMuteConfig resource. + * + * @param {string} projectMuteConfigName + * A fully-qualified path representing project_mute_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectMuteConfigName(projectMuteConfigName: string) { + return this.pathTemplates.projectMuteConfigPathTemplate.match(projectMuteConfigName).project; + } + + /** + * Parse the mute_config from ProjectMuteConfig resource. + * + * @param {string} projectMuteConfigName + * A fully-qualified path representing project_mute_config resource. + * @returns {string} A string representing the mute_config. + */ + matchMuteConfigFromProjectMuteConfigName(projectMuteConfigName: string) { + return this.pathTemplates.projectMuteConfigPathTemplate.match(projectMuteConfigName).mute_config; + } + + /** + * 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 projectSourceFindingExternalsystem resource name string. + * + * @param {string} project + * @param {string} source + * @param {string} finding + * @param {string} externalsystem + * @returns {string} Resource name string. + */ + projectSourceFindingExternalsystemPath(project:string,source:string,finding:string,externalsystem:string) { + return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.render({ + project: project, + source: source, + finding: finding, + externalsystem: externalsystem, + }); + } + + /** + * Parse the project from ProjectSourceFindingExternalsystem resource. + * + * @param {string} projectSourceFindingExternalsystemName + * A fully-qualified path representing project_source_finding_externalsystem resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { + return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).project; + } + + /** + * Parse the source from ProjectSourceFindingExternalsystem resource. + * + * @param {string} projectSourceFindingExternalsystemName + * A fully-qualified path representing project_source_finding_externalsystem resource. + * @returns {string} A string representing the source. + */ + matchSourceFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { + return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).source; + } + + /** + * Parse the finding from ProjectSourceFindingExternalsystem resource. + * + * @param {string} projectSourceFindingExternalsystemName + * A fully-qualified path representing project_source_finding_externalsystem resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { + return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).finding; + } + + /** + * Parse the externalsystem from ProjectSourceFindingExternalsystem resource. + * + * @param {string} projectSourceFindingExternalsystemName + * A fully-qualified path representing project_source_finding_externalsystem resource. + * @returns {string} A string representing the externalsystem. + */ + matchExternalsystemFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { + return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).externalsystem; + } + + /** + * 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 { + if (this.securityCenterStub && !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..149e8338 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/security_center_client_config.json @@ -0,0 +1,193 @@ +{ + "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": { + "BulkMuteFindings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "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" + }, + "CreateMuteConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteMuteConfig": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNotificationConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBigQueryExport": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetMuteConfig": { + "retry_codes_name": "non_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" + }, + "ListMuteConfigs": { + "retry_codes_name": "non_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" + }, + "SetMute": { + "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" + }, + "UpdateExternalSystem": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateFinding": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateMuteConfig": { + "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" + }, + "CreateBigQueryExport": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBigQueryExport": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateBigQueryExport": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBigQueryExports": { + "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..db5193d0 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/security_center_proto_list.json @@ -0,0 +1,21 @@ +[ + "../../protos/google/cloud/securitycenter/v1/access.proto", + "../../protos/google/cloud/securitycenter/v1/asset.proto", + "../../protos/google/cloud/securitycenter/v1/bigquery_export.proto", + "../../protos/google/cloud/securitycenter/v1/external_system.proto", + "../../protos/google/cloud/securitycenter/v1/finding.proto", + "../../protos/google/cloud/securitycenter/v1/folder.proto", + "../../protos/google/cloud/securitycenter/v1/iam_binding.proto", + "../../protos/google/cloud/securitycenter/v1/indicator.proto", + "../../protos/google/cloud/securitycenter/v1/mitre_attack.proto", + "../../protos/google/cloud/securitycenter/v1/mute_config.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..842e41d5 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const 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..1e7b0783 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {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..8ec45222 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1/test/gapic_security_center_v1.ts b/owl-bot-staging/v1/test/gapic_security_center_v1.ts new file mode 100644 index 00000000..1e6fb642 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_security_center_v1.ts @@ -0,0 +1,5933 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 for the initialized client', done => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.securityCenterStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.securityCenterStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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)); + }); + + it('invokes createSource with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSource(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes createFinding with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createFinding(request), expectedError); + }); + }); + + describe('createMuteConfig', () => { + it('invokes createMuteConfig 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.CreateMuteConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()); + client.innerApiCalls.createMuteConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createMuteConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createMuteConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createMuteConfig 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.CreateMuteConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()); + client.innerApiCalls.createMuteConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMuteConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createMuteConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createMuteConfig 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.CreateMuteConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createMuteConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createMuteConfig(request), expectedError); + assert((client.innerApiCalls.createMuteConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createMuteConfig with closed client', 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.CreateMuteConfigRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createMuteConfig(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes createNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createNotificationConfig(request), expectedError); + }); + }); + + describe('deleteMuteConfig', () => { + it('invokes deleteMuteConfig 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.DeleteMuteConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteMuteConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteMuteConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteMuteConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteMuteConfig 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.DeleteMuteConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteMuteConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMuteConfig( + 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.deleteMuteConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteMuteConfig 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.DeleteMuteConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMuteConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteMuteConfig(request), expectedError); + assert((client.innerApiCalls.deleteMuteConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteMuteConfig with closed client', 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.DeleteMuteConfigRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteMuteConfig(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes deleteNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteNotificationConfig(request), expectedError); + }); + }); + + describe('getBigQueryExport', () => { + it('invokes getBigQueryExport 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.GetBigQueryExportRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()); + client.innerApiCalls.getBigQueryExport = stubSimpleCall(expectedResponse); + const [response] = await client.getBigQueryExport(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBigQueryExport as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getBigQueryExport 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.GetBigQueryExportRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()); + client.innerApiCalls.getBigQueryExport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBigQueryExport( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBigQueryExport as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getBigQueryExport 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.GetBigQueryExportRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getBigQueryExport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBigQueryExport(request), expectedError); + assert((client.innerApiCalls.getBigQueryExport as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getBigQueryExport with closed client', 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.GetBigQueryExportRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBigQueryExport(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes getIamPolicy with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); + }); + + describe('getMuteConfig', () => { + it('invokes getMuteConfig 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.GetMuteConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()); + client.innerApiCalls.getMuteConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getMuteConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getMuteConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getMuteConfig 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.GetMuteConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()); + client.innerApiCalls.getMuteConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMuteConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getMuteConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getMuteConfig 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.GetMuteConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getMuteConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMuteConfig(request), expectedError); + assert((client.innerApiCalls.getMuteConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getMuteConfig with closed client', 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.GetMuteConfigRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getMuteConfig(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes getNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNotificationConfig(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes getOrganizationSettings with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOrganizationSettings(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes getSource with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSource(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes setFindingState with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setFindingState(request), expectedError); + }); + }); + + describe('setMute', () => { + it('invokes setMute 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.SetMuteRequest()); + 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.setMute = stubSimpleCall(expectedResponse); + const [response] = await client.setMute(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setMute as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setMute 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.SetMuteRequest()); + 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.setMute = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setMute( + 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.setMute as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setMute 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.SetMuteRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setMute = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setMute(request), expectedError); + assert((client.innerApiCalls.setMute as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setMute with closed client', 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.SetMuteRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setMute(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes setIamPolicy with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes testIamPermissions with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); + }); + + describe('updateExternalSystem', () => { + it('invokes updateExternalSystem 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.UpdateExternalSystemRequest()); + request.externalSystem = {}; + request.externalSystem.name = ''; + const expectedHeaderRequestParams = "external_system.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ExternalSystem()); + client.innerApiCalls.updateExternalSystem = stubSimpleCall(expectedResponse); + const [response] = await client.updateExternalSystem(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateExternalSystem as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateExternalSystem 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.UpdateExternalSystemRequest()); + request.externalSystem = {}; + request.externalSystem.name = ''; + const expectedHeaderRequestParams = "external_system.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ExternalSystem()); + client.innerApiCalls.updateExternalSystem = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateExternalSystem( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IExternalSystem|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateExternalSystem as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateExternalSystem 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.UpdateExternalSystemRequest()); + request.externalSystem = {}; + request.externalSystem.name = ''; + const expectedHeaderRequestParams = "external_system.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateExternalSystem = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateExternalSystem(request), expectedError); + assert((client.innerApiCalls.updateExternalSystem as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateExternalSystem with closed client', 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.UpdateExternalSystemRequest()); + request.externalSystem = {}; + request.externalSystem.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateExternalSystem(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateFinding with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFinding(request), expectedError); + }); + }); + + describe('updateMuteConfig', () => { + it('invokes updateMuteConfig 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.UpdateMuteConfigRequest()); + request.muteConfig = {}; + request.muteConfig.name = ''; + const expectedHeaderRequestParams = "mute_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()); + client.innerApiCalls.updateMuteConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateMuteConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateMuteConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateMuteConfig 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.UpdateMuteConfigRequest()); + request.muteConfig = {}; + request.muteConfig.name = ''; + const expectedHeaderRequestParams = "mute_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()); + client.innerApiCalls.updateMuteConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMuteConfig( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateMuteConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateMuteConfig 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.UpdateMuteConfigRequest()); + request.muteConfig = {}; + request.muteConfig.name = ''; + const expectedHeaderRequestParams = "mute_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMuteConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateMuteConfig(request), expectedError); + assert((client.innerApiCalls.updateMuteConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateMuteConfig with closed client', 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.UpdateMuteConfigRequest()); + request.muteConfig = {}; + request.muteConfig.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateMuteConfig(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateNotificationConfig(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateOrganizationSettings with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateOrganizationSettings(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateSource with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSource(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateSecurityMarks with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSecurityMarks(request), expectedError); + }); + }); + + describe('createBigQueryExport', () => { + it('invokes createBigQueryExport 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.CreateBigQueryExportRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()); + client.innerApiCalls.createBigQueryExport = stubSimpleCall(expectedResponse); + const [response] = await client.createBigQueryExport(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBigQueryExport as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBigQueryExport 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.CreateBigQueryExportRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()); + client.innerApiCalls.createBigQueryExport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBigQueryExport( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBigQueryExport as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createBigQueryExport 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.CreateBigQueryExportRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createBigQueryExport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createBigQueryExport(request), expectedError); + assert((client.innerApiCalls.createBigQueryExport as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createBigQueryExport with closed client', 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.CreateBigQueryExportRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createBigQueryExport(request), expectedError); + }); + }); + + describe('deleteBigQueryExport', () => { + it('invokes deleteBigQueryExport 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.DeleteBigQueryExportRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteBigQueryExport = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBigQueryExport(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteBigQueryExport as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteBigQueryExport 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.DeleteBigQueryExportRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteBigQueryExport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBigQueryExport( + 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.deleteBigQueryExport as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteBigQueryExport 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.DeleteBigQueryExportRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBigQueryExport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteBigQueryExport(request), expectedError); + assert((client.innerApiCalls.deleteBigQueryExport as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteBigQueryExport with closed client', 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.DeleteBigQueryExportRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteBigQueryExport(request), expectedError); + }); + }); + + describe('updateBigQueryExport', () => { + it('invokes updateBigQueryExport 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.UpdateBigQueryExportRequest()); + request.bigQueryExport = {}; + request.bigQueryExport.name = ''; + const expectedHeaderRequestParams = "big_query_export.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()); + client.innerApiCalls.updateBigQueryExport = stubSimpleCall(expectedResponse); + const [response] = await client.updateBigQueryExport(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateBigQueryExport as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateBigQueryExport 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.UpdateBigQueryExportRequest()); + request.bigQueryExport = {}; + request.bigQueryExport.name = ''; + const expectedHeaderRequestParams = "big_query_export.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()); + client.innerApiCalls.updateBigQueryExport = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBigQueryExport( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateBigQueryExport as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateBigQueryExport 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.UpdateBigQueryExportRequest()); + request.bigQueryExport = {}; + request.bigQueryExport.name = ''; + const expectedHeaderRequestParams = "big_query_export.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBigQueryExport = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateBigQueryExport(request), expectedError); + assert((client.innerApiCalls.updateBigQueryExport as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateBigQueryExport with closed client', 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.UpdateBigQueryExportRequest()); + request.bigQueryExport = {}; + request.bigQueryExport.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateBigQueryExport(request), expectedError); + }); + }); + + describe('bulkMuteFindings', () => { + it('invokes bulkMuteFindings 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.BulkMuteFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.bulkMuteFindings = stubLongRunningCall(expectedResponse); + const [operation] = await client.bulkMuteFindings(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.bulkMuteFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes bulkMuteFindings 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.BulkMuteFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.bulkMuteFindings = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.bulkMuteFindings( + 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.bulkMuteFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes bulkMuteFindings 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.BulkMuteFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.bulkMuteFindings = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.bulkMuteFindings(request), expectedError); + assert((client.innerApiCalls.bulkMuteFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes bulkMuteFindings 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.BulkMuteFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.bulkMuteFindings = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.bulkMuteFindings(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.bulkMuteFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkBulkMuteFindingsProgress 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.checkBulkMuteFindingsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBulkMuteFindingsProgress 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.checkBulkMuteFindingsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + 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('listMuteConfigs', () => { + it('invokes listMuteConfigs 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.ListMuteConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + ]; + client.innerApiCalls.listMuteConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listMuteConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listMuteConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listMuteConfigs 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.ListMuteConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + ]; + client.innerApiCalls.listMuteConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMuteConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listMuteConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listMuteConfigs 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.ListMuteConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listMuteConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMuteConfigs(request), expectedError); + assert((client.innerApiCalls.listMuteConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listMuteConfigsStream 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.ListMuteConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + ]; + client.descriptors.page.listMuteConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMuteConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.MuteConfig[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.MuteConfig) => { + 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.listMuteConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMuteConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listMuteConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listMuteConfigsStream 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.ListMuteConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listMuteConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMuteConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.MuteConfig[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.MuteConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMuteConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMuteConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listMuteConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listMuteConfigs 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.ListMuteConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), + ]; + client.descriptors.page.listMuteConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.IMuteConfig[] = []; + const iterable = client.listMuteConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listMuteConfigs 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.ListMuteConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listMuteConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMuteConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.IMuteConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listMuteConfigs.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('listBigQueryExports', () => { + it('invokes listBigQueryExports 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.ListBigQueryExportsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + ]; + client.innerApiCalls.listBigQueryExports = stubSimpleCall(expectedResponse); + const [response] = await client.listBigQueryExports(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBigQueryExports as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBigQueryExports 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.ListBigQueryExportsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + ]; + client.innerApiCalls.listBigQueryExports = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBigQueryExports( + request, + (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBigQueryExports as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listBigQueryExports 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.ListBigQueryExportsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listBigQueryExports = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listBigQueryExports(request), expectedError); + assert((client.innerApiCalls.listBigQueryExports as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBigQueryExportsStream 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.ListBigQueryExportsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + ]; + client.descriptors.page.listBigQueryExports.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBigQueryExportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.BigQueryExport[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.BigQueryExport) => { + 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.listBigQueryExports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBigQueryExports, request)); + assert.strictEqual( + (client.descriptors.page.listBigQueryExports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listBigQueryExportsStream 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.ListBigQueryExportsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listBigQueryExports.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBigQueryExportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.securitycenter.v1.BigQueryExport[] = []; + stream.on('data', (response: protos.google.cloud.securitycenter.v1.BigQueryExport) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listBigQueryExports.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBigQueryExports, request)); + assert.strictEqual( + (client.descriptors.page.listBigQueryExports.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listBigQueryExports 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.ListBigQueryExportsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), + ]; + client.descriptors.page.listBigQueryExports.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.securitycenter.v1.IBigQueryExport[] = []; + const iterable = client.listBigQueryExportsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listBigQueryExports 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.ListBigQueryExportsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listBigQueryExports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBigQueryExportsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.securitycenter.v1.IBigQueryExport[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listBigQueryExports.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('folderExport', () => { + const fakePath = "/rendered/path/folderExport"; + const expectedParameters = { + folder: "folderValue", + export: "exportValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderExportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderExportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderExportPath', () => { + const result = client.folderExportPath("folderValue", "exportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderExportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderExportName', () => { + const result = client.matchFolderFromFolderExportName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderExportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExportFromFolderExportName', () => { + const result = client.matchExportFromFolderExportName(fakePath); + assert.strictEqual(result, "exportValue"); + assert((client.pathTemplates.folderExportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderMuteConfig', () => { + const fakePath = "/rendered/path/folderMuteConfig"; + const expectedParameters = { + folder: "folderValue", + mute_config: "muteConfigValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderMuteConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderMuteConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderMuteConfigPath', () => { + const result = client.folderMuteConfigPath("folderValue", "muteConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderMuteConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderMuteConfigName', () => { + const result = client.matchFolderFromFolderMuteConfigName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderMuteConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMuteConfigFromFolderMuteConfigName', () => { + const result = client.matchMuteConfigFromFolderMuteConfigName(fakePath); + assert.strictEqual(result, "muteConfigValue"); + assert((client.pathTemplates.folderMuteConfigPathTemplate.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('folderSourceFindingExternalsystem', () => { + const fakePath = "/rendered/path/folderSourceFindingExternalsystem"; + const expectedParameters = { + folder: "folderValue", + source: "sourceValue", + finding: "findingValue", + externalsystem: "externalsystemValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSourceFindingExternalsystemPath', () => { + const result = client.folderSourceFindingExternalsystemPath("folderValue", "sourceValue", "findingValue", "externalsystemValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSourceFindingExternalsystemName', () => { + const result = client.matchFolderFromFolderSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromFolderSourceFindingExternalsystemName', () => { + const result = client.matchSourceFromFolderSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFolderSourceFindingExternalsystemName', () => { + const result = client.matchFindingFromFolderSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExternalsystemFromFolderSourceFindingExternalsystemName', () => { + const result = client.matchExternalsystemFromFolderSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "externalsystemValue"); + assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.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('organizationExport', () => { + const fakePath = "/rendered/path/organizationExport"; + const expectedParameters = { + organization: "organizationValue", + export: "exportValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationExportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationExportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationExportPath', () => { + const result = client.organizationExportPath("organizationValue", "exportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationExportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationExportName', () => { + const result = client.matchOrganizationFromOrganizationExportName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationExportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExportFromOrganizationExportName', () => { + const result = client.matchExportFromOrganizationExportName(fakePath); + assert.strictEqual(result, "exportValue"); + assert((client.pathTemplates.organizationExportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationMuteConfig', () => { + const fakePath = "/rendered/path/organizationMuteConfig"; + const expectedParameters = { + organization: "organizationValue", + mute_config: "muteConfigValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationMuteConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationMuteConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationMuteConfigPath', () => { + const result = client.organizationMuteConfigPath("organizationValue", "muteConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationMuteConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationMuteConfigName', () => { + const result = client.matchOrganizationFromOrganizationMuteConfigName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationMuteConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMuteConfigFromOrganizationMuteConfigName', () => { + const result = client.matchMuteConfigFromOrganizationMuteConfigName(fakePath); + assert.strictEqual(result, "muteConfigValue"); + assert((client.pathTemplates.organizationMuteConfigPathTemplate.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('organizationSourceFindingExternalsystem', () => { + const fakePath = "/rendered/path/organizationSourceFindingExternalsystem"; + const expectedParameters = { + organization: "organizationValue", + source: "sourceValue", + finding: "findingValue", + externalsystem: "externalsystemValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSourceFindingExternalsystemPath', () => { + const result = client.organizationSourceFindingExternalsystemPath("organizationValue", "sourceValue", "findingValue", "externalsystemValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSourceFindingExternalsystemName', () => { + const result = client.matchOrganizationFromOrganizationSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromOrganizationSourceFindingExternalsystemName', () => { + const result = client.matchSourceFromOrganizationSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromOrganizationSourceFindingExternalsystemName', () => { + const result = client.matchFindingFromOrganizationSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExternalsystemFromOrganizationSourceFindingExternalsystemName', () => { + const result = client.matchExternalsystemFromOrganizationSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "externalsystemValue"); + assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.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('projectExport', () => { + const fakePath = "/rendered/path/projectExport"; + const expectedParameters = { + project: "projectValue", + export: "exportValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectExportPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectExportPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectExportPath', () => { + const result = client.projectExportPath("projectValue", "exportValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectExportPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectExportName', () => { + const result = client.matchProjectFromProjectExportName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectExportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExportFromProjectExportName', () => { + const result = client.matchExportFromProjectExportName(fakePath); + assert.strictEqual(result, "exportValue"); + assert((client.pathTemplates.projectExportPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectMuteConfig', () => { + const fakePath = "/rendered/path/projectMuteConfig"; + const expectedParameters = { + project: "projectValue", + mute_config: "muteConfigValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectMuteConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectMuteConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectMuteConfigPath', () => { + const result = client.projectMuteConfigPath("projectValue", "muteConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectMuteConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectMuteConfigName', () => { + const result = client.matchProjectFromProjectMuteConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectMuteConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMuteConfigFromProjectMuteConfigName', () => { + const result = client.matchMuteConfigFromProjectMuteConfigName(fakePath); + assert.strictEqual(result, "muteConfigValue"); + assert((client.pathTemplates.projectMuteConfigPathTemplate.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('projectSourceFindingExternalsystem', () => { + const fakePath = "/rendered/path/projectSourceFindingExternalsystem"; + const expectedParameters = { + project: "projectValue", + source: "sourceValue", + finding: "findingValue", + externalsystem: "externalsystemValue", + }; + const client = new securitycenterModule.v1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSourceFindingExternalsystemPath', () => { + const result = client.projectSourceFindingExternalsystemPath("projectValue", "sourceValue", "findingValue", "externalsystemValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSourceFindingExternalsystemName', () => { + const result = client.matchProjectFromProjectSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSourceFromProjectSourceFindingExternalsystemName', () => { + const result = client.matchSourceFromProjectSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "sourceValue"); + assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromProjectSourceFindingExternalsystemName', () => { + const result = client.matchFindingFromProjectSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchExternalsystemFromProjectSourceFindingExternalsystemName', () => { + const result = client.matchExternalsystemFromProjectSourceFindingExternalsystemName(fakePath); + assert.strictEqual(result, "externalsystemValue"); + assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.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..3f4fcde5 --- /dev/null +++ b/owl-bot-staging/v1beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/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..481c522b --- /dev/null +++ b/owl-bot-staging/v1beta1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js new file mode 100644 index 00000000..494e1478 --- /dev/null +++ b/owl-bot-staging/v1beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/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..befd23c8 --- /dev/null +++ b/owl-bot-staging/v1beta1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json new file mode 100644 index 00000000..5a98ee64 --- /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.29.4" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=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..b6d02d23 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_finding.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..89b1fb7d --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_source.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..c8f862f8 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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`. + */ + // 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..3844f406 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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..fa59cdbd --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_source.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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..f1094ea2 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_assets.js @@ -0,0 +1,136 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, 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..3eb12bb9 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_findings.js @@ -0,0 +1,115 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, 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..187079e5 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_assets.js @@ -0,0 +1,141 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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..49e6b81d --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_findings.js @@ -0,0 +1,118 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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..6a6a4c3e --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_sources.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..8cc9e964 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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..c135e7f5 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..f9bb09e4 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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 = {} + /** + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * `paths: "bindings, etag"` + */ + // const updateMask = {} + + // 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..2920bddb --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..1c305269 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_finding.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..cea471f4 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..d1aaced7 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js @@ -0,0 +1,66 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..01f4c9f4 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_source.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json new file mode 100644 index 00000000..93228556 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json @@ -0,0 +1,895 @@ +{ + "clientLibrary": { + "name": "nodejs-securitycenter", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.securitycenter.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async", + "title": "SecurityCenter createSource Sample", + "origin": "API_DEFINITION", + "description": " Creates a source.", + "canonical": true, + "file": "security_center.create_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSource", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateSource", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source", + "type": ".google.cloud.securitycenter.v1beta1.Source" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateSource", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async", + "title": "SecurityCenter createFinding Sample", + "origin": "API_DEFINITION", + "description": " Creates a finding. The corresponding source must exist for finding creation to succeed.", + "canonical": true, + "file": "security_center.create_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFinding", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateFinding", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "finding_id", + "type": "TYPE_STRING" + }, + { + "name": "finding", + "type": ".google.cloud.securitycenter.v1beta1.Finding" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateFinding", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateFinding", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async", + "title": "SecurityCenter getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy on the specified Source.", + "canonical": true, + "file": "security_center.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetIamPolicy", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async", + "title": "SecurityCenter getOrganizationSettings Sample", + "origin": "API_DEFINITION", + "description": " Gets the settings for an organization.", + "canonical": true, + "file": "security_center.get_organization_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetOrganizationSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.OrganizationSettings", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetOrganizationSettings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GetSource_async", + "title": "SecurityCenter getSource Sample", + "origin": "API_DEFINITION", + "description": " Gets a source.", + "canonical": true, + "file": "security_center.get_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSource", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetSource", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetSource", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async", + "title": "SecurityCenter groupAssets Sample", + "origin": "API_DEFINITION", + "description": " Filters an organization's assets and groups them by their specified properties.", + "canonical": true, + "file": "security_center.group_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 128, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GroupAssets", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "group_by", + "type": "TYPE_STRING" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.GroupAssetsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GroupAssets", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupAssets", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async", + "title": "SecurityCenter groupFindings Sample", + "origin": "API_DEFINITION", + "description": " 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", + "canonical": true, + "file": "security_center.group_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 107, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GroupFindings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "group_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.GroupFindingsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GroupFindings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async", + "title": "SecurityCenter listAssets Sample", + "origin": "API_DEFINITION", + "description": " Lists an organization's assets.", + "canonical": true, + "file": "security_center.list_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 133, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAssets", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.ListAssetsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListAssets", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListAssets", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async", + "title": "SecurityCenter listFindings Sample", + "origin": "API_DEFINITION", + "description": " 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", + "canonical": true, + "file": "security_center.list_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 110, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.ListFindingsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListFindings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_ListSources_async", + "title": "SecurityCenter listSources Sample", + "origin": "API_DEFINITION", + "description": " Lists all sources belonging to an organization.", + "canonical": true, + "file": "security_center.list_sources.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSources", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListSources", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.ListSourcesResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListSources", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListSources", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async", + "title": "SecurityCenter runAssetDiscovery Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "security_center.run_asset_discovery.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RunAssetDiscovery", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.RunAssetDiscovery", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "RunAssetDiscovery", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.RunAssetDiscovery", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async", + "title": "SecurityCenter setFindingState Sample", + "origin": "API_DEFINITION", + "description": " Updates the state of a finding.", + "canonical": true, + "file": "security_center.set_finding_state.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetFindingState", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetFindingState", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "state", + "type": ".google.cloud.securitycenter.v1beta1.Finding.State" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "SetFindingState", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetFindingState", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async", + "title": "SecurityCenter setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy on the specified Source.", + "canonical": true, + "file": "security_center.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetIamPolicy", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async", + "title": "SecurityCenter testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns the permissions that a caller has on the specified source.", + "canonical": true, + "file": "security_center.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.TestIamPermissions", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async", + "title": "SecurityCenter updateFinding Sample", + "origin": "API_DEFINITION", + "description": " Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.", + "canonical": true, + "file": "security_center.update_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFinding", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateFinding", + "async": true, + "parameters": [ + { + "name": "finding", + "type": ".google.cloud.securitycenter.v1beta1.Finding" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateFinding", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateFinding", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async", + "title": "SecurityCenter updateOrganizationSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates an organization's settings.", + "canonical": true, + "file": "security_center.update_organization_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateOrganizationSettings", + "async": true, + "parameters": [ + { + "name": "organization_settings", + "type": ".google.cloud.securitycenter.v1beta1.OrganizationSettings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.OrganizationSettings", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateOrganizationSettings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async", + "title": "SecurityCenter updateSource Sample", + "origin": "API_DEFINITION", + "description": " Updates a source.", + "canonical": true, + "file": "security_center.update_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSource", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSource", + "async": true, + "parameters": [ + { + "name": "source", + "type": ".google.cloud.securitycenter.v1beta1.Source" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateSource", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async", + "title": "SecurityCenter updateSecurityMarks Sample", + "origin": "API_DEFINITION", + "description": " Updates security marks.", + "canonical": true, + "file": "security_center.update_security_marks.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSecurityMarks", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSecurityMarks", + "async": true, + "parameters": [ + { + "name": "security_marks", + "type": ".google.cloud.securitycenter.v1beta1.SecurityMarks" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.securitycenter.v1beta1.SecurityMarks", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateSecurityMarks", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSecurityMarks", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts new file mode 100644 index 00000000..5fb87a6e --- /dev/null +++ b/owl-bot-staging/v1beta1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as 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..d7817680 --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {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..c18318be --- /dev/null +++ b/owl-bot-staging/v1beta1/src/v1beta1/security_center_client.ts @@ -0,0 +1,3253 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {google.protobuf.FieldMask} request.updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 { + if (this.securityCenterStub && !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..842e41d5 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const 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..1e7b0783 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {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..8ec45222 --- /dev/null +++ b/owl-bot-staging/v1beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1beta1/test/gapic_security_center_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_security_center_v1beta1.ts new file mode 100644 index 00000000..b71d839a --- /dev/null +++ b/owl-bot-staging/v1beta1/test/gapic_security_center_v1beta1.ts @@ -0,0 +1,2906 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 for the initialized client', done => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.securityCenterStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new securitycenterModule.v1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.securityCenterStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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)); + }); + + it('invokes createSource with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSource(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes createFinding with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createFinding(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes getIamPolicy with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes getOrganizationSettings with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOrganizationSettings(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes getSource with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSource(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes setFindingState with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setFindingState(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes setIamPolicy with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes testIamPermissions with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateFinding with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFinding(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateOrganizationSettings with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateOrganizationSettings(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateSource with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSource(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateSecurityMarks with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSecurityMarks(request), expectedError); + }); + }); + + 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..3f4fcde5 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/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..481c522b --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1p1beta1/.prettierrc.js b/owl-bot-staging/v1p1beta1/.prettierrc.js new file mode 100644 index 00000000..494e1478 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1p1beta1/README.md b/owl-bot-staging/v1p1beta1/README.md new file mode 100644 index 00000000..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..befd23c8 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/v1p1beta1/package.json b/owl-bot-staging/v1p1beta1/package.json new file mode 100644 index 00000000..5a98ee64 --- /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.29.4" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=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..aac99ed7 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js @@ -0,0 +1,70 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, 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..b6f6d561 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..b9efa166 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..4eb4bcec --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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..712e4fe1 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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`. + */ + // 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..8f87ffe5 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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..e96b8b4e --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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..988cb631 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START 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..6f364214 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js @@ -0,0 +1,173 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, 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..949e649f --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js @@ -0,0 +1,169 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, 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..29b0abc6 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js @@ -0,0 +1,182 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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..2e5ce81c --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js @@ -0,0 +1,178 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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..d67cbdb7 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..78951b70 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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..b53e6a02 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START 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..f10874bd --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..637a16ea --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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 = {} + /** + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * `paths: "bindings, etag"` + */ + // const updateMask = {} + + // 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..808a5c07 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..0b7e0ca3 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..d36a254b --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..73d291ae --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..c4c73bcd --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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..89e55925 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(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/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json new file mode 100644 index 00000000..27a6b4e3 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json @@ -0,0 +1,1123 @@ +{ + "clientLibrary": { + "name": "nodejs-securitycenter", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.securitycenter.v1p1beta1", + "version": "v1p1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async", + "title": "SecurityCenter createSource Sample", + "origin": "API_DEFINITION", + "description": " Creates a source.", + "canonical": true, + "file": "security_center.create_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSource", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateSource", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source", + "type": ".google.cloud.securitycenter.v1p1beta1.Source" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateSource", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async", + "title": "SecurityCenter createFinding Sample", + "origin": "API_DEFINITION", + "description": " Creates a finding. The corresponding source must exist for finding creation to succeed.", + "canonical": true, + "file": "security_center.create_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFinding", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateFinding", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "finding_id", + "type": "TYPE_STRING" + }, + { + "name": "finding", + "type": ".google.cloud.securitycenter.v1p1beta1.Finding" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateFinding", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateFinding", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async", + "title": "SecurityCenter createNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a notification config.", + "canonical": true, + "file": "security_center.create_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateNotificationConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "config_id", + "type": "TYPE_STRING" + }, + { + "name": "notification_config", + "type": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "CreateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async", + "title": "SecurityCenter deleteNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes a notification config.", + "canonical": true, + "file": "security_center.delete_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.DeleteNotificationConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "DeleteNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.DeleteNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async", + "title": "SecurityCenter getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy on the specified Source.", + "canonical": true, + "file": "security_center.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetIamPolicy", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async", + "title": "SecurityCenter getNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a notification config.", + "canonical": true, + "file": "security_center.get_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetNotificationConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async", + "title": "SecurityCenter getOrganizationSettings Sample", + "origin": "API_DEFINITION", + "description": " Gets the settings for an organization.", + "canonical": true, + "file": "security_center.get_organization_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetOrganizationSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.OrganizationSettings", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetOrganizationSettings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async", + "title": "SecurityCenter getSource Sample", + "origin": "API_DEFINITION", + "description": " Gets a source.", + "canonical": true, + "file": "security_center.get_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSource", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetSource", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GetSource", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async", + "title": "SecurityCenter groupAssets Sample", + "origin": "API_DEFINITION", + "description": " Filters an organization's assets and groups them by their specified properties.", + "canonical": true, + "file": "security_center.group_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 165, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GroupAssets", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "group_by", + "type": "TYPE_STRING" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.GroupAssetsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GroupAssets", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupAssets", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async", + "title": "SecurityCenter groupFindings Sample", + "origin": "API_DEFINITION", + "description": " 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", + "canonical": true, + "file": "security_center.group_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 161, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GroupFindings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "group_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.GroupFindingsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "GroupFindings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async", + "title": "SecurityCenter listAssets Sample", + "origin": "API_DEFINITION", + "description": " Lists an organization's assets.", + "canonical": true, + "file": "security_center.list_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 174, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAssets", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.ListAssetsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListAssets", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListAssets", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async", + "title": "SecurityCenter listFindings Sample", + "origin": "API_DEFINITION", + "description": " 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", + "canonical": true, + "file": "security_center.list_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 170, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "compare_duration", + "type": ".google.protobuf.Duration" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.ListFindingsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListFindings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListFindings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async", + "title": "SecurityCenter listNotificationConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists notification configs.", + "canonical": true, + "file": "security_center.list_notification_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListNotificationConfigs", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListNotificationConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListNotificationConfigs", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListNotificationConfigs", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async", + "title": "SecurityCenter listSources Sample", + "origin": "API_DEFINITION", + "description": " Lists all sources belonging to an organization.", + "canonical": true, + "file": "security_center.list_sources.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSources", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListSources", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.ListSourcesResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "ListSources", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListSources", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async", + "title": "SecurityCenter runAssetDiscovery Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "security_center.run_asset_discovery.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RunAssetDiscovery", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.RunAssetDiscovery", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "RunAssetDiscovery", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.RunAssetDiscovery", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async", + "title": "SecurityCenter setFindingState Sample", + "origin": "API_DEFINITION", + "description": " Updates the state of a finding.", + "canonical": true, + "file": "security_center.set_finding_state.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetFindingState", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetFindingState", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "state", + "type": ".google.cloud.securitycenter.v1p1beta1.Finding.State" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "SetFindingState", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetFindingState", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async", + "title": "SecurityCenter setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy on the specified Source.", + "canonical": true, + "file": "security_center.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetIamPolicy", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async", + "title": "SecurityCenter testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns the permissions that a caller has on the specified source.", + "canonical": true, + "file": "security_center.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.TestIamPermissions", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async", + "title": "SecurityCenter updateFinding Sample", + "origin": "API_DEFINITION", + "description": " Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.", + "canonical": true, + "file": "security_center.update_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFinding", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateFinding", + "async": true, + "parameters": [ + { + "name": "finding", + "type": ".google.cloud.securitycenter.v1p1beta1.Finding" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.Finding", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateFinding", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateFinding", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async", + "title": "SecurityCenter updateNotificationConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a notification config. The following update fields are allowed: description, pubsub_topic, streaming_config.filter", + "canonical": true, + "file": "security_center.update_notification_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateNotificationConfig", + "async": true, + "parameters": [ + { + "name": "notification_config", + "type": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateNotificationConfig", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateNotificationConfig", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async", + "title": "SecurityCenter updateOrganizationSettings Sample", + "origin": "API_DEFINITION", + "description": " Updates an organization's settings.", + "canonical": true, + "file": "security_center.update_organization_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateOrganizationSettings", + "async": true, + "parameters": [ + { + "name": "organization_settings", + "type": ".google.cloud.securitycenter.v1p1beta1.OrganizationSettings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.OrganizationSettings", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateOrganizationSettings", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateOrganizationSettings", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async", + "title": "SecurityCenter updateSource Sample", + "origin": "API_DEFINITION", + "description": " Updates a source.", + "canonical": true, + "file": "security_center.update_source.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSource", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSource", + "async": true, + "parameters": [ + { + "name": "source", + "type": ".google.cloud.securitycenter.v1p1beta1.Source" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.Source", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateSource", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSource", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + }, + { + "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async", + "title": "SecurityCenter updateSecurityMarks Sample", + "origin": "API_DEFINITION", + "description": " Updates security marks.", + "canonical": true, + "file": "security_center.update_security_marks.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSecurityMarks", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSecurityMarks", + "async": true, + "parameters": [ + { + "name": "security_marks", + "type": ".google.cloud.securitycenter.v1p1beta1.SecurityMarks" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.securitycenter.v1p1beta1.SecurityMarks", + "client": { + "shortName": "SecurityCenterClient", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" + }, + "method": { + "shortName": "UpdateSecurityMarks", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSecurityMarks", + "service": { + "shortName": "SecurityCenter", + "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1p1beta1/src/index.ts b/owl-bot-staging/v1p1beta1/src/index.ts new file mode 100644 index 00000000..d9e0d0aa --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1p1beta1 from './v1p1beta1'; +const 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..d7817680 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {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..0508bf06 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client.ts @@ -0,0 +1,4928 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {google.protobuf.FieldMask} request.updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 { + if (this.securityCenterStub && !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..842e41d5 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const 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..1e7b0783 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {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..8ec45222 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts b/owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts new file mode 100644 index 00000000..a9c27a39 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts @@ -0,0 +1,3971 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 for the initialized client', done => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.securityCenterStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.securityCenterStub, undefined); + client.close().then(() => { + done(); + }); + }); + + 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)); + }); + + it('invokes createSource with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSource(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes createFinding with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createFinding(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes createNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createNotificationConfig(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes deleteNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteNotificationConfig(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes getIamPolicy with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes getNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getNotificationConfig(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes getOrganizationSettings with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getOrganizationSettings(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes getSource with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSource(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes setFindingState with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setFindingState(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes setIamPolicy with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes testIamPermissions with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateFinding with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFinding(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateNotificationConfig(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateOrganizationSettings with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateOrganizationSettings(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateSource with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSource(request), expectedError); + }); + }); + + 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)); + }); + + it('invokes updateSecurityMarks with closed client', 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 expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSecurityMarks(request), expectedError); + }); + }); + + 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 640213637f31620552e268d047328a29e5d1c472 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 7 Apr 2022 01:51:59 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/v1/.eslintignore | 7 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 - owl-bot-staging/v1/.mocharc.js | 33 - owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 16 - owl-bot-staging/v1/package.json | 64 - .../cloud/securitycenter/v1/access.proto | 54 - .../cloud/securitycenter/v1/asset.proto | 134 - .../securitycenter/v1/bigquery_export.proto | 99 - .../securitycenter/v1/external_system.proto | 59 - .../cloud/securitycenter/v1/finding.proto | 275 - .../cloud/securitycenter/v1/folder.proto | 36 - .../cloud/securitycenter/v1/indicator.proto | 37 - .../securitycenter/v1/mitre_attack.proto | 194 - .../cloud/securitycenter/v1/mute_config.proto | 89 - .../v1/notification_config.proto | 95 - .../v1/notification_message.proto | 44 - .../v1/organization_settings.proto | 85 - .../cloud/securitycenter/v1/resource.proto | 58 - .../v1/run_asset_discovery_response.proto | 51 - .../securitycenter/v1/security_marks.proto | 69 - .../v1/securitycenter_service.proto | 1852 ----- .../cloud/securitycenter/v1/source.proto | 69 - .../securitycenter/v1/vulnerability.proto | 216 - .../v1/security_center.bulk_mute_findings.js | 84 - ...security_center.create_big_query_export.js | 73 - .../v1/security_center.create_finding.js | 72 - .../v1/security_center.create_mute_config.js | 73 - ...urity_center.create_notification_config.js | 74 - .../v1/security_center.create_source.js | 65 - ...security_center.delete_big_query_export.js | 61 - .../v1/security_center.delete_mute_config.js | 61 - ...urity_center.delete_notification_config.js | 59 - .../security_center.get_big_query_export.js | 61 - .../v1/security_center.get_iam_policy.js | 64 - .../v1/security_center.get_mute_config.js | 61 - ...security_center.get_notification_config.js | 59 - ...curity_center.get_organization_settings.js | 59 - .../v1/security_center.get_source.js | 59 - .../v1/security_center.group_assets.js | 173 - .../v1/security_center.group_findings.js | 177 - .../v1/security_center.list_assets.js | 182 - .../security_center.list_big_query_exports.js | 76 - .../v1/security_center.list_findings.js | 188 - .../v1/security_center.list_mute_configs.js | 76 - ...curity_center.list_notification_configs.js | 72 - .../v1/security_center.list_sources.js | 73 - .../v1/security_center.run_asset_discovery.js | 60 - .../v1/security_center.set_finding_state.js | 71 - .../v1/security_center.set_iam_policy.js | 74 - .../generated/v1/security_center.set_mute.js | 68 - .../security_center.test_iam_permissions.js | 67 - ...security_center.update_big_query_export.js | 63 - .../security_center.update_external_system.js | 63 - .../v1/security_center.update_finding.js | 71 - .../v1/security_center.update_mute_config.js | 63 - ...urity_center.update_notification_config.js | 63 - ...ity_center.update_organization_settings.js | 63 - .../security_center.update_security_marks.js | 72 - .../v1/security_center.update_source.js | 63 - ...tadata.google.cloud.securitycenter.v1.json | 1699 ----- owl-bot-staging/v1/src/index.ts | 25 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 415 - owl-bot-staging/v1/src/v1/index.ts | 19 - .../v1/src/v1/security_center_client.ts | 6712 ----------------- .../src/v1/security_center_client_config.json | 193 - .../v1/src/v1/security_center_proto_list.json | 21 - .../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 | 5933 --------------- 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 | 16 - 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 | 72 - .../v1beta1/security_center.create_source.js | 65 - .../v1beta1/security_center.get_iam_policy.js | 64 - ...curity_center.get_organization_settings.js | 59 - .../v1beta1/security_center.get_source.js | 59 - .../v1beta1/security_center.group_assets.js | 136 - .../v1beta1/security_center.group_findings.js | 115 - .../v1beta1/security_center.list_assets.js | 141 - .../v1beta1/security_center.list_findings.js | 118 - .../v1beta1/security_center.list_sources.js | 72 - .../security_center.run_asset_discovery.js | 60 - .../security_center.set_finding_state.js | 71 - .../v1beta1/security_center.set_iam_policy.js | 74 - .../security_center.test_iam_permissions.js | 67 - .../v1beta1/security_center.update_finding.js | 67 - ...ity_center.update_organization_settings.js | 62 - .../security_center.update_security_marks.js | 66 - .../v1beta1/security_center.update_source.js | 62 - ...a.google.cloud.securitycenter.v1beta1.json | 895 --- 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 | 3253 -------- .../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 | 2906 ------- 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 | 16 - 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 | 70 - ...urity_center.create_notification_config.js | 72 - .../security_center.create_source.js | 65 - ...urity_center.delete_notification_config.js | 59 - .../security_center.get_iam_policy.js | 64 - ...security_center.get_notification_config.js | 59 - ...curity_center.get_organization_settings.js | 59 - .../v1p1beta1/security_center.get_source.js | 59 - .../v1p1beta1/security_center.group_assets.js | 173 - .../security_center.group_findings.js | 169 - .../v1p1beta1/security_center.list_assets.js | 182 - .../security_center.list_findings.js | 178 - ...curity_center.list_notification_configs.js | 72 - .../v1p1beta1/security_center.list_sources.js | 73 - .../security_center.run_asset_discovery.js | 60 - .../security_center.set_finding_state.js | 71 - .../security_center.set_iam_policy.js | 74 - .../security_center.test_iam_permissions.js | 67 - .../security_center.update_finding.js | 71 - ...urity_center.update_notification_config.js | 63 - ...ity_center.update_organization_settings.js | 63 - .../security_center.update_security_marks.js | 71 - .../security_center.update_source.js | 63 - ...google.cloud.securitycenter.v1p1beta1.json | 1123 --- 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 | 4928 ------------ .../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 | 3971 ---------- owl-bot-staging/v1p1beta1/tsconfig.json | 19 - owl-bot-staging/v1p1beta1/webpack.config.js | 64 - .../cloud/securitycenter/v1/access.proto | 2 +- .../securitycenter/v1/bigquery_export.proto | 16 +- .../securitycenter/v1/external_system.proto | 3 +- .../cloud/securitycenter/v1/finding.proto | 18 +- .../cloud/securitycenter/v1/iam_binding.proto | 0 .../cloud/securitycenter/v1/indicator.proto | 3 +- .../securitycenter/v1/mitre_attack.proto | 4 + .../cloud/securitycenter/v1/resource.proto | 14 +- .../v1/securitycenter_service.proto | 16 +- protos/protos.d.ts | 169 +- protos/protos.js | 458 +- protos/protos.json | 67 +- .../security_center.update_security_marks.js | 2 +- src/v1/security_center_client.ts | 2 +- src/v1/security_center_proto_list.json | 1 + 194 files changed, 626 insertions(+), 47509 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/access.proto 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/bigquery_export.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/external_system.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/mitre_attack.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/mute_config.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.bulk_mute_findings.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.create_big_query_export.js 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_mute_config.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_big_query_export.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.delete_mute_config.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_big_query_export.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_mute_config.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_big_query_exports.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_mute_configs.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.set_mute.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_big_query_export.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/security_center.update_external_system.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_mute_config.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/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json 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/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json 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/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json 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 rename {owl-bot-staging/v1/protos => protos}/google/cloud/securitycenter/v1/iam_binding.proto (100%) 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 3f4fcde5..00000000 --- a/owl-bot-staging/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/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 481c522b..00000000 --- a/owl-bot-staging/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js deleted file mode 100644 index 494e1478..00000000 --- a/owl-bot-staging/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md deleted file mode 100644 index 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 befd23c8..00000000 --- a/owl-bot-staging/v1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index 5a98ee64..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.29.4" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/access.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/access.proto deleted file mode 100644 index e1b57247..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/access.proto +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -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 = "AccessProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Represents an access event. -message Access { - // Associated email, such as "foo@google.com". - string principal_email = 1; - - // Caller's IP address, such as "1.1.1.1". - string caller_ip = 2; - - // The caller IP's geolocation, which identifies where the call came from. - Geolocation caller_ip_geo = 3; - - // What kind of user agent is associated, e.g. operating system shells, - // embedded or stand-alone applications, etc. - string user_agent_family = 4; - - // This is the API service that the service account made a call to, e.g. - // "iam.googleapis.com" - string service_name = 5; - - // The method that the service account called, e.g. "SetIamPolicy". - string method_name = 6; -} - -// Represents a geographical location for a given access. -message Geolocation { - // A CLDR. - string region_code = 1; -} 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 55ba5641..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/asset.proto +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.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"; - -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/bigquery_export.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/bigquery_export.proto deleted file mode 100644 index 850c66e5..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/bigquery_export.proto +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.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_outer_classname = "BigQueryExportProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Configures how to deliver Findings to BigQuery Instance. -message BigQueryExport { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/BigQueryExport" - pattern: "organizations/{organization}/bigQueryExports/{export}" - pattern: "folders/{folder}/bigQueryExports/{export}" - pattern: "projects/{project}/bigQueryExports/{export}" - }; - - // The relative resource name of this export. See: - // https://cloud.google.com/apis/design/resource_names#relative_resource_name. - // Example format: - // "organizations/{organization_id}/bigQueryExports/{export_id}" Example - // format: "folders/{folder_id}/bigQueryExports/{export_id}" Example format: - // "projects/{project_id}/bigQueryExports/{export_id}" - // This field is provided in responses, and is ignored when provided in create - // requests. - string name = 1; - - // The description of the export (max of 1024 characters). - string description = 2; - - // Expression that defines the filter to apply across create/update events - // of findings. 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 = 3; - - // The dataset to write findings' updates to. Its format is - // "projects/[project_id]/datasets/[bigquery_dataset_id]". - // BigQuery Dataset unique ID must contain only letters (a-z, A-Z), numbers - // (0-9), or underscores (_). - string dataset = 4; - - // Output only. The time at which the big query export was created. - // This field is set by the server and will be ignored if provided on export - // on creation. - google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The most recent time at which the big export was updated. - // This field is set by the server and will be ignored if provided on export - // creation or update. - google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Email address of the user who last edited the big query export. - // This field is set by the server and will be ignored if provided on export - // creation or update. - string most_recent_editor = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The service account that needs permission to create table, upload data to - // the big query dataset. - string principal = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/external_system.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/external_system.proto deleted file mode 100644 index 8ba69813..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/external_system.proto +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT 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/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_outer_classname = "ExternalSystemProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// Representation of third party SIEM/SOAR fields within SCC. -message ExternalSystem { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/ExternalSystem" - pattern: "organizations/{organization}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}" - pattern: "folders/{folder}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}" - pattern: "projects/{project}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}" - }; - - // External System Name e.g. jira, demisto, etc. - // e.g.: - // `organizations/1234/sources/5678/findings/123456/externalSystems/jira` - // `folders/1234/sources/5678/findings/123456/externalSystems/jira` - // `projects/1234/sources/5678/findings/123456/externalSystems/jira` - string name = 1; - - // References primary/secondary etc assignees in the external system. - repeated string assignees = 2; - - // Identifier that's used to track the given finding in the external system. - string external_uid = 3; - - // Most recent status of the corresponding finding's ticket/tracker in the - // external system. - string status = 4; - - // The most recent time when the corresponding finding's ticket/tracker was - // updated in the external system. - google.protobuf.Timestamp external_system_update_time = 5; -} 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 c3154ae1..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/finding.proto +++ /dev/null @@ -1,275 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/securitycenter/v1/access.proto"; -import "google/cloud/securitycenter/v1/external_system.proto"; -import "google/cloud/securitycenter/v1/iam_binding.proto"; -import "google/cloud/securitycenter/v1/indicator.proto"; -import "google/cloud/securitycenter/v1/mitre_attack.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"; - -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; - } - - // Mute state a finding can be in. - enum Mute { - // Unspecified. - MUTE_UNSPECIFIED = 0; - - // Finding has been muted. - MUTED = 1; - - // Finding has been unmuted. - UNMUTED = 2; - - // Finding has never been muted/unmuted. - UNDEFINED = 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; - - // Describes an error that prevents some SCC functionality. - SCC_ERROR = 5; - } - - // 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 the finding was first detected. If an existing finding is updated, - // then this is the time the update occurred. - // For example, if the finding represents an open firewall, this property - // captures the time the detector believes the firewall became open. The - // accuracy is determined by the detector. If the finding is later resolved, - // then this time reflects when the finding was resolved. This 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; - - // Indicates the mute state of a finding (either muted, unmuted - // or undefined). Unlike other attributes of a finding, a finding provider - // shouldn't set the value of mute. - Mute mute = 15; - - // 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; - - // Output only. The most recent time this finding was muted or unmuted. - google.protobuf.Timestamp mute_update_time = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Third party SIEM/SOAR fields within SCC, contains external system - // information and external system finding fields. - map external_systems = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // MITRE ATT&CK tactics and techniques related to this finding. - // See: https://attack.mitre.org - MitreAttack mitre_attack = 25; - - // Access details associated to the Finding, such as more information on the - // caller, which method was accessed, from where, etc. - Access access = 26; - - // First known as mute_annotation. Records additional information about the - // mute operation e.g. mute config that muted the finding, user who muted the - // finding, etc. Unlike other attributes of a finding, a finding provider - // shouldn't set the value of mute. - string mute_initiator = 28; - - // Represents IAM bindings associated with the Finding. - repeated IamBinding iam_bindings = 39; -} 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 4078a527..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/folder.proto +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -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 92234776..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/indicator.proto +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -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 = "IndicatorProto"; -option java_package = "com.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/mitre_attack.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/mitre_attack.proto deleted file mode 100644 index 547f6f69..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/mitre_attack.proto +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -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 = "MitreAttackProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// MITRE ATT&CK tactics and techniques related to this finding. -// See: https://attack.mitre.org -message MitreAttack { - // MITRE ATT&CK tactics that can be referenced by SCC findings. - // See: https://attack.mitre.org/tactics/enterprise/ - enum Tactic { - // Unspecified value. - TACTIC_UNSPECIFIED = 0; - - // TA0043 - RECONNAISSANCE = 1; - - // TA0042 - RESOURCE_DEVELOPMENT = 2; - - // TA0001 - INITIAL_ACCESS = 5; - - // TA0002 - EXECUTION = 3; - - // TA0003 - PERSISTENCE = 6; - - // TA0004 - PRIVILEGE_ESCALATION = 8; - - // TA0005 - DEFENSE_EVASION = 7; - - // TA0006 - CREDENTIAL_ACCESS = 9; - - // TA0007 - DISCOVERY = 10; - - // TA0008 - LATERAL_MOVEMENT = 11; - - // TA0009 - COLLECTION = 12; - - // TA0011 - COMMAND_AND_CONTROL = 4; - - // TA0010 - EXFILTRATION = 13; - - // TA0040 - IMPACT = 14; - } - - // MITRE ATT&CK techniques that can be referenced by SCC findings. - // See: https://attack.mitre.org/techniques/enterprise/ - // Next ID: 30 - enum Technique { - // Unspecified value. - TECHNIQUE_UNSPECIFIED = 0; - - // T1595 - ACTIVE_SCANNING = 1; - - // T1595.001 - SCANNING_IP_BLOCKS = 2; - - // T1105 - INGRESS_TOOL_TRANSFER = 3; - - // T1106 - NATIVE_API = 4; - - // T1129 - SHARED_MODULES = 5; - - // T1059 - COMMAND_AND_SCRIPTING_INTERPRETER = 6; - - // T1059.004 - UNIX_SHELL = 7; - - // T1496 - RESOURCE_HIJACKING = 8; - - // T1090 - PROXY = 9; - - // T1090.002 - EXTERNAL_PROXY = 10; - - // T1090.003 - MULTI_HOP_PROXY = 11; - - // T1568 - DYNAMIC_RESOLUTION = 12; - - // T1552 - UNSECURED_CREDENTIALS = 13; - - // T1078 - VALID_ACCOUNTS = 14; - - // T1078.003 - LOCAL_ACCOUNTS = 15; - - // T1078.004 - CLOUD_ACCOUNTS = 16; - - // T1498 - NETWORK_DENIAL_OF_SERVICE = 17; - - // T1069 - PERMISSION_GROUPS_DISCOVERY = 18; - - // T1069.003 - CLOUD_GROUPS = 19; - - // T1567 - EXFILTRATION_OVER_WEB_SERVICE = 20; - - // T1567.002 - EXFILTRATION_TO_CLOUD_STORAGE = 21; - - // T1098 - ACCOUNT_MANIPULATION = 22; - - // T1098.004 - SSH_AUTHORIZED_KEYS = 23; - - // T1543 - CREATE_OR_MODIFY_SYSTEM_PROCESS = 24; - - // T1539 - STEAL_WEB_SESSION_COOKIE = 25; - - // T1578 - MODIFY_CLOUD_COMPUTE_INFRASTRUCTURE = 26; - - // T1190 - EXPLOIT_PUBLIC_FACING_APPLICATION = 27; - - // T1556 - MODIFY_AUTHENTICATION_PROCESS = 28; - - // T1485 - DATA_DESTRUCTION = 29; - } - - // The MITRE ATT&CK tactic most closely represented by this finding, if any. - Tactic primary_tactic = 1; - - // The MITRE ATT&CK technique most closely represented by this finding, if - // any. primary_techniques is a repeated field because there are multiple - // levels of MITRE ATT&CK techniques. If the technique most closely - // represented by this finding is a sub-technique (e.g. `SCANNING_IP_BLOCKS`), - // both the sub-technique and its parent technique(s) will be listed (e.g. - // `SCANNING_IP_BLOCKS`, `ACTIVE_SCANNING`). - repeated Technique primary_techniques = 2; - - // Additional MITRE ATT&CK tactics related to this finding, if any. - repeated Tactic additional_tactics = 3; - - // Additional MITRE ATT&CK techniques related to this finding, if any, along - // with any of their respective parent techniques. - repeated Technique additional_techniques = 4; - - // The MITRE ATT&CK version referenced by the above fields. E.g. "8". - string version = 5; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/mute_config.proto b/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/mute_config.proto deleted file mode 100644 index 74426957..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/mute_config.proto +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT 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/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_outer_classname = "MuteConfigProto"; -option java_package = "com.google.cloud.securitycenter.v1"; -option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; -option ruby_package = "Google::Cloud::SecurityCenter::V1"; - -// A mute config is a Cloud SCC resource that contains the configuration -// to mute create/update events of findings. -message MuteConfig { - option (google.api.resource) = { - type: "securitycenter.googleapis.com/MuteConfig" - pattern: "organizations/{organization}/muteConfigs/{mute_config}" - pattern: "folders/{folder}/muteConfigs/{mute_config}" - pattern: "projects/{project}/muteConfigs/{mute_config}" - }; - - // This field will be ignored if provided on config creation. Format - // "organizations/{organization}/muteConfigs/{mute_config}" - // "folders/{folder}/muteConfigs/{mute_config}" - // "projects/{project}/muteConfigs/{mute_config}" - string name = 1; - - // The human readable name to be displayed for the mute config. - string display_name = 2 [deprecated = true]; - - // A description of the mute config. - string description = 3; - - // Required. An expression that defines the filter to apply across create/update events - // of findings. While creating a filter string, be mindful of the - // scope in which the mute configuration is being created. E.g., If a filter - // contains project = X but is created under the project = Y scope, it might - // not match any findings. - // - // The following field and operator combinations are supported: - // - // * severity: `=`, `:` - // * category: `=`, `:` - // * resource.name: `=`, `:` - // * resource.project_name: `=`, `:` - // * resource.project_display_name: `=`, `:` - // * resource.folders.resource_folder: `=`, `:` - // * resource.parent_name: `=`, `:` - // * resource.parent_display_name: `=`, `:` - // * resource.type: `=`, `:` - // * finding_class: `=`, `:` - // * indicator.ip_addresses: `=`, `:` - // * indicator.domains: `=`, `:` - string filter = 4 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The time at which the mute config was created. - // This field is set by the server and will be ignored if provided on config - // creation. - google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The most recent time at which the mute config was updated. - // This field is set by the server and will be ignored if provided on config - // creation or update. - google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Email address of the user who last edited the mute config. - // This field is set by the server and will be ignored if provided on config - // creation or update. - string most_recent_editor = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} 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 7ab94662..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_config.proto +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.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 3605dfbe..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/notification_message.proto +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/cloud/securitycenter/v1/finding.proto"; -import "google/cloud/securitycenter/v1/resource.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 e8bc9687..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/organization_settings.proto +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/resource.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 ab241d8b..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/resource.proto +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT 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"; - -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 human readable name of the resource. - string display_name = 8; - - // The full resource type of the resource. - string type = 6; - - // The full resource name of project that the resource belongs to. - string project = 2; - - // The project ID 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/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 70088c06..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/run_asset_discovery_response.proto +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/protobuf/duration.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 15c9769f..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/security_marks.proto +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/resource.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 a95f5c03..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/securitycenter_service.proto +++ /dev/null @@ -1,1852 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.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/bigquery_export.proto"; -import "google/cloud/securitycenter/v1/external_system.proto"; -import "google/cloud/securitycenter/v1/finding.proto"; -import "google/cloud/securitycenter/v1/folder.proto"; -import "google/cloud/securitycenter/v1/mute_config.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"; - - // Kicks off an LRO to bulk mute findings for a parent based on a filter. The - // parent can be either an organization, folder or project. The findings - // matched by the filter will be muted after the LRO is done. - rpc BulkMuteFindings(BulkMuteFindingsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/findings:bulkMute" - body: "*" - additional_bindings { - post: "/v1/{parent=folders/*}/findings:bulkMute" - body: "*" - } - additional_bindings { - post: "/v1/{parent=projects/*}/findings:bulkMute" - body: "*" - } - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.securitycenter.v1.BulkMuteFindingsResponse" - metadata_type: "google.protobuf.Empty" - }; - } - - // 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 mute config. - rpc CreateMuteConfig(CreateMuteConfigRequest) returns (MuteConfig) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/muteConfigs" - body: "mute_config" - additional_bindings { - post: "/v1/{parent=folders/*}/muteConfigs" - body: "mute_config" - } - additional_bindings { - post: "/v1/{parent=projects/*}/muteConfigs" - body: "mute_config" - } - }; - option (google.api.method_signature) = "parent,mute_config"; - option (google.api.method_signature) = "parent,mute_config,mute_config_id"; - } - - // 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 an existing mute config. - rpc DeleteMuteConfig(DeleteMuteConfigRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=organizations/*/muteConfigs/*}" - additional_bindings { delete: "/v1/{name=folders/*/muteConfigs/*}" } - additional_bindings { delete: "/v1/{name=projects/*/muteConfigs/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // 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 a big query export. - rpc GetBigQueryExport(GetBigQueryExportRequest) returns (BigQueryExport) { - option (google.api.http) = { - get: "/v1/{name=organizations/*/bigQueryExports/*}" - additional_bindings { get: "/v1/{name=folders/*/bigQueryExports/*}" } - additional_bindings { get: "/v1/{name=projects/*/bigQueryExports/*}" } - }; - 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 mute config. - rpc GetMuteConfig(GetMuteConfigRequest) returns (MuteConfig) { - option (google.api.http) = { - get: "/v1/{name=organizations/*/muteConfigs/*}" - additional_bindings { get: "/v1/{name=folders/*/muteConfigs/*}" } - additional_bindings { get: "/v1/{name=projects/*/muteConfigs/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // 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 mute configs. - rpc ListMuteConfigs(ListMuteConfigsRequest) - returns (ListMuteConfigsResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*}/muteConfigs" - additional_bindings { get: "/v1/{parent=folders/*}/muteConfigs" } - additional_bindings { get: "/v1/{parent=projects/*}/muteConfigs" } - }; - option (google.api.method_signature) = "parent"; - } - - // 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"; - } - - // Updates the mute state of a finding. - rpc SetMute(SetMuteRequest) returns (Finding) { - option (google.api.http) = { - post: "/v1/{name=organizations/*/sources/*/findings/*}:setMute" - body: "*" - additional_bindings { - post: "/v1/{name=folders/*/sources/*/findings/*}:setMute" - body: "*" - } - additional_bindings { - post: "/v1/{name=projects/*/sources/*/findings/*}:setMute" - body: "*" - } - }; - option (google.api.method_signature) = "name,mute"; - } - - // 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"; - } - - // Updates external system. This is for a given finding. - rpc UpdateExternalSystem(UpdateExternalSystemRequest) - returns (ExternalSystem) { - option (google.api.http) = { - patch: "/v1/{external_system.name=organizations/*/sources/*/findings/*/externalSystems/*}" - body: "external_system" - additional_bindings { - patch: "/v1/{external_system.name=folders/*/sources/*/findings/*/externalSystems/*}" - body: "external_system" - } - additional_bindings { - patch: "/v1/{external_system.name=projects/*/sources/*/findings/*/externalSystems/*}" - body: "external_system" - } - }; - option (google.api.method_signature) = "external_system,update_mask"; - } - - // 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 mute config. - rpc UpdateMuteConfig(UpdateMuteConfigRequest) returns (MuteConfig) { - option (google.api.http) = { - patch: "/v1/{mute_config.name=organizations/*/muteConfigs/*}" - body: "mute_config" - additional_bindings { - patch: "/v1/{mute_config.name=folders/*/muteConfigs/*}" - body: "mute_config" - } - additional_bindings { - patch: "/v1/{mute_config.name=projects/*/muteConfigs/*}" - body: "mute_config" - } - }; - option (google.api.method_signature) = "mute_config,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: "/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"; - } - - // Creates a big query export. - rpc CreateBigQueryExport(CreateBigQueryExportRequest) - returns (BigQueryExport) { - option (google.api.http) = { - post: "/v1/{parent=organizations/*}/bigQueryExports" - body: "big_query_export" - additional_bindings { - post: "/v1/{parent=folders/*}/bigQueryExports" - body: "big_query_export" - } - additional_bindings { - post: "/v1/{parent=projects/*}/bigQueryExports" - body: "big_query_export" - } - }; - option (google.api.method_signature) = - "parent,big_query_export,big_query_export_id"; - } - - // Deletes an existing big query export. - rpc DeleteBigQueryExport(DeleteBigQueryExportRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=organizations/*/bigQueryExports/*}" - additional_bindings { delete: "/v1/{name=folders/*/bigQueryExports/*}" } - additional_bindings { delete: "/v1/{name=projects/*/bigQueryExports/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // Updates a BigQuery export. - rpc UpdateBigQueryExport(UpdateBigQueryExportRequest) - returns (BigQueryExport) { - option (google.api.http) = { - patch: "/v1/{big_query_export.name=organizations/*/bigQueryExports/*}" - body: "big_query_export" - additional_bindings { - patch: "/v1/{big_query_export.name=folders/*/bigQueryExports/*}" - body: "big_query_export" - } - additional_bindings { - patch: "/v1/{big_query_export.name=projects/*/bigQueryExports/*}" - body: "big_query_export" - } - }; - option (google.api.method_signature) = "big_query_export,update_mask"; - } - - // Lists BigQuery exports. Note that when requesting BigQuery exports at a - // given level all exports under that level are also returned e.g. if - // requesting BigQuery exports under a folder, then all BigQuery exports - // immediately under the folder plus the ones created under the projects - // within the folder are returned. - rpc ListBigQueryExports(ListBigQueryExportsRequest) - returns (ListBigQueryExportsResponse) { - option (google.api.http) = { - get: "/v1/{parent=organizations/*}/bigQueryExports" - additional_bindings { get: "/v1/{parent=folders/*}/bigQueryExports" } - additional_bindings { get: "/v1/{parent=projects/*}/bigQueryExports" } - }; - option (google.api.method_signature) = "parent"; - } -} - -// Request message for bulk findings update. -// -// Note: -// 1. If multiple bulk update requests match the same resource, the order in -// which they get executed is not defined. -// 2. Once a bulk operation is started, there is no way to stop it. -message BulkMuteFindingsRequest { - // Required. The parent, at which bulk action needs to be applied. Its format - // is "organizations/[organization_id]", "folders/[folder_id]", - // "projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "*" } - ]; - - // Expression that identifies findings that should be updated. - // 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 = 2; - - // This can be a mute configuration name or any identifier for mute/unmute - // of findings based on the filter. - string mute_annotation = 3 [deprecated = true]; -} - -// The response to a BulkMute request. Contains the LRO information. -message BulkMuteFindingsResponse {} - -// 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 mute config. -message CreateMuteConfigRequest { - // Required. Resource name of the new mute configs's parent. 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/MuteConfig" - } - ]; - - // Required. The mute config being created. - MuteConfig mute_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Unique identifier provided by the client within the parent scope. - // It must consist of lower case letters, numbers, and hyphen, with the first - // character a letter, the last a letter or a number, and a 63 character - // maximum. - string mute_config_id = 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 mute config. -message DeleteMuteConfigRequest { - // Required. Name of the mute config to delete. Its format is - // organizations/{organization}/muteConfigs/{config_id}, - // folders/{folder}/muteConfigs/{config_id}, or - // projects/{project}/muteConfigs/{config_id} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/MuteConfig" - } - ]; -} - -// 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 retrieving a big query export. -message GetBigQueryExportRequest { - // Required. Name of the big query export to retrieve. Its format is - // organizations/{organization}/bigQueryExports/{export_id}, - // folders/{folder}/bigQueryExports/{export_id}, or - // projects/{project}/bigQueryExports/{export_id} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/BigQueryExport" - } - ]; -} - -// Request message for retrieving a mute config. -message GetMuteConfigRequest { - // Required. Name of the mute config to retrieve. Its format is - // organizations/{organization}/muteConfigs/{config_id}, - // folders/{folder}/muteConfigs/{config_id}, or - // projects/{project}/muteConfigs/{config_id} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/MuteConfig" - } - ]; -} - -// 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 mute configs at a given scope e.g. organization, -// folder or project. -message ListMuteConfigsRequest { - // Required. The parent, which owns the collection of mute configs. Its format - // is "organizations/[organization_id]", "folders/[folder_id]", - // "projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/MuteConfig" - } - ]; - - // The maximum number of configs to return. The service may return fewer than - // this value. - // If unspecified, at most 10 configs will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListMuteConfigs` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListMuteConfigs` must - // match the call that provided the page token. - string page_token = 3; -} - -// Response message for listing mute configs. -message ListMuteConfigsResponse { - // The mute configs from the specified parent. - repeated MuteConfig mute_configs = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request 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 { - // 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; - } - - // 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 human readable name of the resource. - string display_name = 8; - - // The full resource type of the resource. - string type = 6; - - // The full resource name of project that the resource belongs to. - string project_name = 2; - - // The project ID 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 = 7; - } - - // 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 updating a finding's mute status. -message SetMuteRequest { - // 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}", - // "folders/{folder_id}/sources/{source_id}/finding/{finding_id}", - // "projects/{project_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 Mute. - Finding.Mute mute = 2 [(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 a ExternalSystem resource. -message UpdateExternalSystemRequest { - // Required. The external system resource to update. - ExternalSystem external_system = 1 [(google.api.field_behavior) = REQUIRED]; - - // The FieldMask to use when updating the external system resource. - // - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// 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 mute config. -message UpdateMuteConfigRequest { - // Required. The mute config being updated. - MuteConfig mute_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. - // If empty all mutable fields will be updated. - 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. Must be - // earlier or equal to the server time. - google.protobuf.Timestamp start_time = 3; -} - -// Request message for creating a big query export. -message CreateBigQueryExportRequest { - // Required. Resource name of the new big query export's parent. 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/BigQueryExport" - } - ]; - - // Required. The big query export being created. - BigQueryExport big_query_export = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Unique identifier provided by the client within the parent scope. - // It must consist of lower case letters, numbers, and hyphen, with the first - // character a letter, the last a letter or a number, and a 63 character - // maximum. - string big_query_export_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for updating a BigQuery export. -message UpdateBigQueryExportRequest { - // Required. The BigQuery export being updated. - BigQueryExport big_query_export = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. - // If empty all mutable fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for listing BigQuery exports at a given scope e.g. -// organization, folder or project. -message ListBigQueryExportsRequest { - // Required. The parent, which owns the collection of BigQuery exports. Its - // format is "organizations/[organization_id]", "folders/[folder_id]", - // "projects/[project_id]". - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "securitycenter.googleapis.com/BigQueryExport" - } - ]; - - // The maximum number of configs to return. The service may return fewer than - // this value. - // If unspecified, at most 10 configs will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // A page token, received from a previous `ListBigQueryExports` call. - // Provide this to retrieve the subsequent page. - // When paginating, all other parameters provided to `ListBigQueryExports` - // must match the call that provided the page token. - string page_token = 3; -} - -// Response message for listing BigQuery exports. -message ListBigQueryExportsResponse { - // The BigQuery exports from the specified parent. - repeated BigQueryExport big_query_exports = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for deleting a big query export. -message DeleteBigQueryExportRequest { - // Required. Name of the big query export to delete. Its format is - // organizations/{organization}/bigQueryExports/{export_id}, - // folders/{folder}/bigQueryExports/{export_id}, or - // projects/{project}/bigQueryExports/{export_id} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "securitycenter.googleapis.com/BigQueryExport" - } - ]; -} 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 75c069a1..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/source.proto +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -import "google/api/resource.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 3810d90c..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/vulnerability.proto +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.securitycenter.v1; - -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; - - // Whether upstream fix is available for the CVE. - bool upstream_fix_available = 4; -} - -// 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.bulk_mute_findings.js b/owl-bot-staging/v1/samples/generated/v1/security_center.bulk_mute_findings.js deleted file mode 100644 index dc7a324f..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.bulk_mute_findings.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, at which bulk action needs to be applied. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Expression that identifies findings that should be updated. - * 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. - */ - // const filter = 'abc123' - /** - * This can be a mute configuration name or any identifier for mute/unmute - * of findings based on the filter. - */ - // const muteAnnotation = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callBulkMuteFindings() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await securitycenterClient.bulkMuteFindings(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBulkMuteFindings(); - // [END securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_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_big_query_export.js b/owl-bot-staging/v1/samples/generated/v1/security_center.create_big_query_export.js deleted file mode 100644 index 83f63f53..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.create_big_query_export.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, bigQueryExport, bigQueryExportId) { - // [START securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new big query export's parent. Its format is - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Required. The big query export being created. - */ - // const bigQueryExport = {} - /** - * Required. Unique identifier provided by the client within the parent scope. - * It must consist of lower case letters, numbers, and hyphen, with the first - * character a letter, the last a letter or a number, and a 63 character - * maximum. - */ - // const bigQueryExportId = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateBigQueryExport() { - // Construct request - const request = { - parent, - bigQueryExport, - bigQueryExportId, - }; - - // Run request - const response = await securitycenterClient.createBigQueryExport(request); - console.log(response); - } - - callCreateBigQueryExport(); - // [END securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_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_finding.js b/owl-bot-staging/v1/samples/generated/v1/security_center.create_finding.js deleted file mode 100644 index c90e509f..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.create_finding.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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_mute_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.create_mute_config.js deleted file mode 100644 index f6ad1e56..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.create_mute_config.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, muteConfig, muteConfigId) { - // [START securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the new mute configs's parent. Its format is - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * Required. The mute config being created. - */ - // const muteConfig = {} - /** - * Required. Unique identifier provided by the client within the parent scope. - * It must consist of lower case letters, numbers, and hyphen, with the first - * character a letter, the last a letter or a number, and a 63 character - * maximum. - */ - // const muteConfigId = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callCreateMuteConfig() { - // Construct request - const request = { - parent, - muteConfig, - muteConfigId, - }; - - // Run request - const response = await securitycenterClient.createMuteConfig(request); - console.log(response); - } - - callCreateMuteConfig(); - // [END securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_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 7b101bf3..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.create_notification_config.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, 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 b06d0f14..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.create_source.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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_big_query_export.js b/owl-bot-staging/v1/samples/generated/v1/security_center.delete_big_query_export.js deleted file mode 100644 index c82674a4..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.delete_big_query_export.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the big query export to delete. Its format is - * organizations/{organization}/bigQueryExports/{export_id}, - * folders/{folder}/bigQueryExports/{export_id}, or - * projects/{project}/bigQueryExports/{export_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 callDeleteBigQueryExport() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.deleteBigQueryExport(request); - console.log(response); - } - - callDeleteBigQueryExport(); - // [END securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_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_mute_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.delete_mute_config.js deleted file mode 100644 index 0d3d0984..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.delete_mute_config.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the mute config to delete. Its format is - * organizations/{organization}/muteConfigs/{config_id}, - * folders/{folder}/muteConfigs/{config_id}, or - * projects/{project}/muteConfigs/{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 callDeleteMuteConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.deleteMuteConfig(request); - console.log(response); - } - - callDeleteMuteConfig(); - // [END securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_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 9a922f8d..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.delete_notification_config.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START 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_big_query_export.js b/owl-bot-staging/v1/samples/generated/v1/security_center.get_big_query_export.js deleted file mode 100644 index ca654081..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.get_big_query_export.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the big query export to retrieve. Its format is - * organizations/{organization}/bigQueryExports/{export_id}, - * folders/{folder}/bigQueryExports/{export_id}, or - * projects/{project}/bigQueryExports/{export_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 callGetBigQueryExport() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getBigQueryExport(request); - console.log(response); - } - - callGetBigQueryExport(); - // [END securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_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 c35eaa59..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.get_iam_policy.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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`. - */ - // 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_mute_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.get_mute_config.js deleted file mode 100644 index 1364ec1b..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.get_mute_config.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the mute config to retrieve. Its format is - * organizations/{organization}/muteConfigs/{config_id}, - * folders/{folder}/muteConfigs/{config_id}, or - * projects/{project}/muteConfigs/{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 callGetMuteConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await securitycenterClient.getMuteConfig(request); - console.log(response); - } - - callGetMuteConfig(); - // [END securitycenter_v1_generated_SecurityCenter_GetMuteConfig_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 090b0283..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.get_notification_config.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START 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 0bb6cbad..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.get_organization_settings.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START 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 55f6f645..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.get_source.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START 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 c1365acc..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.group_assets.js +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, 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 b1a357f1..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.group_findings.js +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, 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 bf2dd52f..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.list_assets.js +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START 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_big_query_exports.js b/owl-bot-staging/v1/samples/generated/v1/security_center.list_big_query_exports.js deleted file mode 100644 index 3dce0c2c..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.list_big_query_exports.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns the collection of BigQuery exports. Its - * format is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * The maximum number of configs to return. The service may return fewer than - * this value. - * If unspecified, at most 10 configs will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListBigQueryExports` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListBigQueryExports` - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListBigQueryExports() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listBigQueryExportsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBigQueryExports(); - // [END securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_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 15eb8d4a..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.list_findings.js +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START 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_mute_configs.js b/owl-bot-staging/v1/samples/generated/v1/security_center.list_mute_configs.js deleted file mode 100644 index 7a20b7d8..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.list_mute_configs.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent, which owns the collection of mute configs. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - */ - // const parent = 'abc123' - /** - * The maximum number of configs to return. The service may return fewer than - * this value. - * If unspecified, at most 10 configs will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListMuteConfigs` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListMuteConfigs` must - * match the call that provided the page token. - */ - // const pageToken = 'abc123' - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callListMuteConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await securitycenterClient.listMuteConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMuteConfigs(); - // [END securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_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 2e4e8da7..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.list_notification_configs.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 c4a1ad3d..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.list_sources.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START 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 75b1cc83..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.run_asset_discovery.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START 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 4ef14087..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.set_finding_state.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 f1c269c9..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.set_iam_policy.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 = {} - /** - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * `paths: "bindings, etag"` - */ - // const updateMask = {} - - // 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.set_mute.js b/owl-bot-staging/v1/samples/generated/v1/security_center.set_mute.js deleted file mode 100644 index b5430cb0..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.set_mute.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name, mute) { - // [START securitycenter_v1_generated_SecurityCenter_SetMute_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}", - * "folders/{folder_id}/sources/{source_id}/finding/{finding_id}", - * "projects/{project_id}/sources/{source_id}/finding/{finding_id}". - */ - // const name = 'abc123' - /** - * Required. The desired state of the Mute. - */ - // const mute = {} - - // Imports the Securitycenter library - const {SecurityCenterClient} = require('@google-cloud/security-center').v1; - - // Instantiates a client - const securitycenterClient = new SecurityCenterClient(); - - async function callSetMute() { - // Construct request - const request = { - name, - mute, - }; - - // Run request - const response = await securitycenterClient.setMute(request); - console.log(response); - } - - callSetMute(); - // [END securitycenter_v1_generated_SecurityCenter_SetMute_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 eec1299c..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.test_iam_permissions.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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_big_query_export.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_big_query_export.js deleted file mode 100644 index e74d9c23..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.update_big_query_export.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(bigQueryExport) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The BigQuery export being updated. - */ - // const bigQueryExport = {} - /** - * The list of fields to be updated. - * 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 callUpdateBigQueryExport() { - // Construct request - const request = { - bigQueryExport, - }; - - // Run request - const response = await securitycenterClient.updateBigQueryExport(request); - console.log(response); - } - - callUpdateBigQueryExport(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_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_external_system.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_external_system.js deleted file mode 100644 index 0c91e772..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.update_external_system.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(externalSystem) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The external system resource to update. - */ - // const externalSystem = {} - /** - * The FieldMask to use when updating the external system 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 callUpdateExternalSystem() { - // Construct request - const request = { - externalSystem, - }; - - // Run request - const response = await securitycenterClient.updateExternalSystem(request); - console.log(response); - } - - callUpdateExternalSystem(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_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 effade31..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.update_finding.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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_mute_config.js b/owl-bot-staging/v1/samples/generated/v1/security_center.update_mute_config.js deleted file mode 100644 index e624ed19..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.update_mute_config.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(muteConfig) { - // [START securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The mute config being updated. - */ - // const muteConfig = {} - /** - * The list of fields to be updated. - * 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 callUpdateMuteConfig() { - // Construct request - const request = { - muteConfig, - }; - - // Run request - const response = await securitycenterClient.updateMuteConfig(request); - console.log(response); - } - - callUpdateMuteConfig(); - // [END securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_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 d8bc1878..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.update_notification_config.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 31b890d1..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.update_organization_settings.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 3f19fca7..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.update_security_marks.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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. Must be - * earlier or equal to the server 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 03c19de4..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/security_center.update_source.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json deleted file mode 100644 index a1cbd617..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.securitycenter.v1.json +++ /dev/null @@ -1,1699 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-securitycenter", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.securitycenter.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async", - "title": "SecurityCenter bulkMuteFindings Sample", - "origin": "API_DEFINITION", - "description": " Kicks off an LRO to bulk mute findings for a parent based on a filter. The parent can be either an organization, folder or project. The findings matched by the filter will be muted after the LRO is done.", - "canonical": true, - "file": "security_center.bulk_mute_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BulkMuteFindings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.BulkMuteFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "mute_annotation", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "BulkMuteFindings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.BulkMuteFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateSource_async", - "title": "SecurityCenter createSource Sample", - "origin": "API_DEFINITION", - "description": " Creates a source.", - "canonical": true, - "file": "security_center.create_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSource", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateSource", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "source", - "type": ".google.cloud.securitycenter.v1.Source" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateSource", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateFinding_async", - "title": "SecurityCenter createFinding Sample", - "origin": "API_DEFINITION", - "description": " Creates a finding. The corresponding source must exist for finding creation to succeed.", - "canonical": true, - "file": "security_center.create_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFinding", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateFinding", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "finding_id", - "type": "TYPE_STRING" - }, - { - "name": "finding", - "type": ".google.cloud.securitycenter.v1.Finding" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateFinding", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateFinding", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async", - "title": "SecurityCenter createMuteConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a mute config.", - "canonical": true, - "file": "security_center.create_mute_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateMuteConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "mute_config", - "type": ".google.cloud.securitycenter.v1.MuteConfig" - }, - { - "name": "mute_config_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.MuteConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateMuteConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateNotificationConfig_async", - "title": "SecurityCenter createNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a notification config.", - "canonical": true, - "file": "security_center.create_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateNotificationConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "config_id", - "type": "TYPE_STRING" - }, - { - "name": "notification_config", - "type": ".google.cloud.securitycenter.v1.NotificationConfig" - } - ], - "resultType": ".google.cloud.securitycenter.v1.NotificationConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async", - "title": "SecurityCenter deleteMuteConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing mute config.", - "canonical": true, - "file": "security_center.delete_mute_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteMuteConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "DeleteMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteMuteConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteNotificationConfig_async", - "title": "SecurityCenter deleteNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes a notification config.", - "canonical": true, - "file": "security_center.delete_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteNotificationConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "DeleteNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async", - "title": "SecurityCenter getBigQueryExport Sample", - "origin": "API_DEFINITION", - "description": " Gets a big query export.", - "canonical": true, - "file": "security_center.get_big_query_export.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetBigQueryExport", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.BigQueryExport", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetBigQueryExport", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetIamPolicy_async", - "title": "SecurityCenter getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy on the specified Source.", - "canonical": true, - "file": "security_center.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetIamPolicy", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async", - "title": "SecurityCenter getMuteConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a mute config.", - "canonical": true, - "file": "security_center.get_mute_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetMuteConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.MuteConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetMuteConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetNotificationConfig_async", - "title": "SecurityCenter getNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a notification config.", - "canonical": true, - "file": "security_center.get_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetNotificationConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.NotificationConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetOrganizationSettings_async", - "title": "SecurityCenter getOrganizationSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the settings for an organization.", - "canonical": true, - "file": "security_center.get_organization_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetOrganizationSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.OrganizationSettings", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetOrganizationSettings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GetSource_async", - "title": "SecurityCenter getSource Sample", - "origin": "API_DEFINITION", - "description": " Gets a source.", - "canonical": true, - "file": "security_center.get_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSource", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetSource", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GetSource", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GetSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GroupAssets_async", - "title": "SecurityCenter groupAssets Sample", - "origin": "API_DEFINITION", - "description": " Filters an organization's assets and groups them by their specified properties.", - "canonical": true, - "file": "security_center.group_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 165, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GroupAssets", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "group_by", - "type": "TYPE_STRING" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1.GroupAssetsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GroupAssets", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupAssets", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_GroupFindings_async", - "title": "SecurityCenter groupFindings Sample", - "origin": "API_DEFINITION", - "description": " 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", - "canonical": true, - "file": "security_center.group_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 169, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GroupFindings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "group_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1.GroupFindingsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "GroupFindings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.GroupFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListAssets_async", - "title": "SecurityCenter listAssets Sample", - "origin": "API_DEFINITION", - "description": " Lists an organization's assets.", - "canonical": true, - "file": "security_center.list_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 174, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAssets", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListAssetsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListAssets", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListAssets", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListFindings_async", - "title": "SecurityCenter listFindings Sample", - "origin": "API_DEFINITION", - "description": " 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", - "canonical": true, - "file": "security_center.list_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 180, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListFindingsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListFindings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async", - "title": "SecurityCenter listMuteConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists mute configs.", - "canonical": true, - "file": "security_center.list_mute_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMuteConfigs", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListMuteConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListMuteConfigsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListMuteConfigs", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListMuteConfigs", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListNotificationConfigs_async", - "title": "SecurityCenter listNotificationConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists notification configs.", - "canonical": true, - "file": "security_center.list_notification_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNotificationConfigs", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListNotificationConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListNotificationConfigsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListNotificationConfigs", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListNotificationConfigs", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListSources_async", - "title": "SecurityCenter listSources Sample", - "origin": "API_DEFINITION", - "description": " Lists all sources belonging to an organization.", - "canonical": true, - "file": "security_center.list_sources.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSources", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListSources", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListSourcesResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListSources", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListSources", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_RunAssetDiscovery_async", - "title": "SecurityCenter runAssetDiscovery Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "security_center.run_asset_discovery.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunAssetDiscovery", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.RunAssetDiscovery", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "RunAssetDiscovery", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.RunAssetDiscovery", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_SetFindingState_async", - "title": "SecurityCenter setFindingState Sample", - "origin": "API_DEFINITION", - "description": " Updates the state of a finding.", - "canonical": true, - "file": "security_center.set_finding_state.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetFindingState", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetFindingState", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "state", - "type": ".google.cloud.securitycenter.v1.Finding.State" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "SetFindingState", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetFindingState", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_SetMute_async", - "title": "SecurityCenter setMute Sample", - "origin": "API_DEFINITION", - "description": " Updates the mute state of a finding.", - "canonical": true, - "file": "security_center.set_mute.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetMute", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetMute", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "mute", - "type": ".google.cloud.securitycenter.v1.Finding.Mute" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "SetMute", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetMute", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_SetIamPolicy_async", - "title": "SecurityCenter setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy on the specified Source.", - "canonical": true, - "file": "security_center.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.SetIamPolicy", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_TestIamPermissions_async", - "title": "SecurityCenter testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns the permissions that a caller has on the specified source.", - "canonical": true, - "file": "security_center.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.TestIamPermissions", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async", - "title": "SecurityCenter updateExternalSystem Sample", - "origin": "API_DEFINITION", - "description": " Updates external system. This is for a given finding.", - "canonical": true, - "file": "security_center.update_external_system.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateExternalSystem", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateExternalSystem", - "async": true, - "parameters": [ - { - "name": "external_system", - "type": ".google.cloud.securitycenter.v1.ExternalSystem" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ExternalSystem", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateExternalSystem", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateExternalSystem", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateFinding_async", - "title": "SecurityCenter updateFinding Sample", - "origin": "API_DEFINITION", - "description": " Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.", - "canonical": true, - "file": "security_center.update_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFinding", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateFinding", - "async": true, - "parameters": [ - { - "name": "finding", - "type": ".google.cloud.securitycenter.v1.Finding" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateFinding", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateFinding", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async", - "title": "SecurityCenter updateMuteConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a mute config.", - "canonical": true, - "file": "security_center.update_mute_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateMuteConfig", - "async": true, - "parameters": [ - { - "name": "mute_config", - "type": ".google.cloud.securitycenter.v1.MuteConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.MuteConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateMuteConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateMuteConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateNotificationConfig_async", - "title": "SecurityCenter updateNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a notification config. The following update fields are allowed: description, pubsub_topic, streaming_config.filter", - "canonical": true, - "file": "security_center.update_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateNotificationConfig", - "async": true, - "parameters": [ - { - "name": "notification_config", - "type": ".google.cloud.securitycenter.v1.NotificationConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.NotificationConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateOrganizationSettings_async", - "title": "SecurityCenter updateOrganizationSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates an organization's settings.", - "canonical": true, - "file": "security_center.update_organization_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateOrganizationSettings", - "async": true, - "parameters": [ - { - "name": "organization_settings", - "type": ".google.cloud.securitycenter.v1.OrganizationSettings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.OrganizationSettings", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateOrganizationSettings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateSource_async", - "title": "SecurityCenter updateSource Sample", - "origin": "API_DEFINITION", - "description": " Updates a source.", - "canonical": true, - "file": "security_center.update_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSource", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSource", - "async": true, - "parameters": [ - { - "name": "source", - "type": ".google.cloud.securitycenter.v1.Source" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateSource", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateSecurityMarks_async", - "title": "SecurityCenter updateSecurityMarks Sample", - "origin": "API_DEFINITION", - "description": " Updates security marks.", - "canonical": true, - "file": "security_center.update_security_marks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSecurityMarks", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSecurityMarks", - "async": true, - "parameters": [ - { - "name": "security_marks", - "type": ".google.cloud.securitycenter.v1.SecurityMarks" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.securitycenter.v1.SecurityMarks", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateSecurityMarks", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateSecurityMarks", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async", - "title": "SecurityCenter createBigQueryExport Sample", - "origin": "API_DEFINITION", - "description": " Creates a big query export.", - "canonical": true, - "file": "security_center.create_big_query_export.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateBigQueryExport", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "big_query_export", - "type": ".google.cloud.securitycenter.v1.BigQueryExport" - }, - { - "name": "big_query_export_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.BigQueryExport", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.CreateBigQueryExport", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async", - "title": "SecurityCenter deleteBigQueryExport Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing big query export.", - "canonical": true, - "file": "security_center.delete_big_query_export.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteBigQueryExport", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "DeleteBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.DeleteBigQueryExport", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async", - "title": "SecurityCenter updateBigQueryExport Sample", - "origin": "API_DEFINITION", - "description": " Updates a BigQuery export.", - "canonical": true, - "file": "security_center.update_big_query_export.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateBigQueryExport", - "async": true, - "parameters": [ - { - "name": "big_query_export", - "type": ".google.cloud.securitycenter.v1.BigQueryExport" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1.BigQueryExport", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateBigQueryExport", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.UpdateBigQueryExport", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async", - "title": "SecurityCenter listBigQueryExports Sample", - "origin": "API_DEFINITION", - "description": " Lists BigQuery exports. Note that when requesting BigQuery exports at a given level all exports under that level are also returned e.g. if requesting BigQuery exports under a folder, then all BigQuery exports immediately under the folder plus the ones created under the projects within the folder are returned.", - "canonical": true, - "file": "security_center.list_big_query_exports.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBigQueryExports", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListBigQueryExports", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1.ListBigQueryExportsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1.SecurityCenterClient" - }, - "method": { - "shortName": "ListBigQueryExports", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter.ListBigQueryExports", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1.SecurityCenter" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index dfd6be93..00000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1 from './v1'; -const 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 adec8cae..00000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,415 +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" - ] - }, - "CreateMuteConfig": { - "methods": [ - "createMuteConfig" - ] - }, - "CreateNotificationConfig": { - "methods": [ - "createNotificationConfig" - ] - }, - "DeleteMuteConfig": { - "methods": [ - "deleteMuteConfig" - ] - }, - "DeleteNotificationConfig": { - "methods": [ - "deleteNotificationConfig" - ] - }, - "GetBigQueryExport": { - "methods": [ - "getBigQueryExport" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetMuteConfig": { - "methods": [ - "getMuteConfig" - ] - }, - "GetNotificationConfig": { - "methods": [ - "getNotificationConfig" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetMute": { - "methods": [ - "setMute" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateExternalSystem": { - "methods": [ - "updateExternalSystem" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateMuteConfig": { - "methods": [ - "updateMuteConfig" - ] - }, - "UpdateNotificationConfig": { - "methods": [ - "updateNotificationConfig" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "CreateBigQueryExport": { - "methods": [ - "createBigQueryExport" - ] - }, - "DeleteBigQueryExport": { - "methods": [ - "deleteBigQueryExport" - ] - }, - "UpdateBigQueryExport": { - "methods": [ - "updateBigQueryExport" - ] - }, - "BulkMuteFindings": { - "methods": [ - "bulkMuteFindings" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListMuteConfigs": { - "methods": [ - "listMuteConfigs", - "listMuteConfigsStream", - "listMuteConfigsAsync" - ] - }, - "ListNotificationConfigs": { - "methods": [ - "listNotificationConfigs", - "listNotificationConfigsStream", - "listNotificationConfigsAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - }, - "ListBigQueryExports": { - "methods": [ - "listBigQueryExports", - "listBigQueryExportsStream", - "listBigQueryExportsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SecurityCenterClient", - "rpcs": { - "CreateSource": { - "methods": [ - "createSource" - ] - }, - "CreateFinding": { - "methods": [ - "createFinding" - ] - }, - "CreateMuteConfig": { - "methods": [ - "createMuteConfig" - ] - }, - "CreateNotificationConfig": { - "methods": [ - "createNotificationConfig" - ] - }, - "DeleteMuteConfig": { - "methods": [ - "deleteMuteConfig" - ] - }, - "DeleteNotificationConfig": { - "methods": [ - "deleteNotificationConfig" - ] - }, - "GetBigQueryExport": { - "methods": [ - "getBigQueryExport" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "GetMuteConfig": { - "methods": [ - "getMuteConfig" - ] - }, - "GetNotificationConfig": { - "methods": [ - "getNotificationConfig" - ] - }, - "GetOrganizationSettings": { - "methods": [ - "getOrganizationSettings" - ] - }, - "GetSource": { - "methods": [ - "getSource" - ] - }, - "SetFindingState": { - "methods": [ - "setFindingState" - ] - }, - "SetMute": { - "methods": [ - "setMute" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateExternalSystem": { - "methods": [ - "updateExternalSystem" - ] - }, - "UpdateFinding": { - "methods": [ - "updateFinding" - ] - }, - "UpdateMuteConfig": { - "methods": [ - "updateMuteConfig" - ] - }, - "UpdateNotificationConfig": { - "methods": [ - "updateNotificationConfig" - ] - }, - "UpdateOrganizationSettings": { - "methods": [ - "updateOrganizationSettings" - ] - }, - "UpdateSource": { - "methods": [ - "updateSource" - ] - }, - "UpdateSecurityMarks": { - "methods": [ - "updateSecurityMarks" - ] - }, - "CreateBigQueryExport": { - "methods": [ - "createBigQueryExport" - ] - }, - "DeleteBigQueryExport": { - "methods": [ - "deleteBigQueryExport" - ] - }, - "UpdateBigQueryExport": { - "methods": [ - "updateBigQueryExport" - ] - }, - "BulkMuteFindings": { - "methods": [ - "bulkMuteFindings" - ] - }, - "RunAssetDiscovery": { - "methods": [ - "runAssetDiscovery" - ] - }, - "GroupAssets": { - "methods": [ - "groupAssets", - "groupAssetsStream", - "groupAssetsAsync" - ] - }, - "GroupFindings": { - "methods": [ - "groupFindings", - "groupFindingsStream", - "groupFindingsAsync" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - }, - "ListMuteConfigs": { - "methods": [ - "listMuteConfigs", - "listMuteConfigsStream", - "listMuteConfigsAsync" - ] - }, - "ListNotificationConfigs": { - "methods": [ - "listNotificationConfigs", - "listNotificationConfigsStream", - "listNotificationConfigsAsync" - ] - }, - "ListSources": { - "methods": [ - "listSources", - "listSourcesStream", - "listSourcesAsync" - ] - }, - "ListBigQueryExports": { - "methods": [ - "listBigQueryExports", - "listBigQueryExportsStream", - "listBigQueryExportsAsync" - ] - } - } - } - } - } - } -} 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 d7817680..00000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {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 e7baa596..00000000 --- a/owl-bot-staging/v1/src/v1/security_center_client.ts +++ /dev/null @@ -1,6712 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, 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' - ), - folderExportPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/bigQueryExports/{export}' - ), - folderMuteConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/muteConfigs/{mute_config}' - ), - folderSourcePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}' - ), - folderSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}/findings/{finding}' - ), - folderSourceFindingExternalsystemPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}' - ), - 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' - ), - organizationExportPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/bigQueryExports/{export}' - ), - organizationMuteConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/muteConfigs/{mute_config}' - ), - 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}' - ), - organizationSourceFindingExternalsystemPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}' - ), - 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' - ), - projectExportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/bigQueryExports/{export}' - ), - projectMuteConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/muteConfigs/{mute_config}' - ), - projectSourcePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}' - ), - projectSourceFindingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}/findings/{finding}' - ), - projectSourceFindingExternalsystemPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}' - ), - 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'), - listMuteConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'muteConfigs'), - listNotificationConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notificationConfigs'), - listSources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources'), - listBigQueryExports: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'bigQueryExports') - }; - - 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 bulkMuteFindingsResponse = protoFilesRoot.lookup( - '.google.cloud.securitycenter.v1.BulkMuteFindingsResponse') as gax.protobuf.Type; - const bulkMuteFindingsMetadata = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - 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 = { - bulkMuteFindings: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - bulkMuteFindingsResponse.decode.bind(bulkMuteFindingsResponse), - bulkMuteFindingsMetadata.decode.bind(bulkMuteFindingsMetadata)), - 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 = - ['bulkMuteFindings', 'createSource', 'createFinding', 'createMuteConfig', 'createNotificationConfig', 'deleteMuteConfig', 'deleteNotificationConfig', 'getBigQueryExport', 'getIamPolicy', 'getMuteConfig', 'getNotificationConfig', 'getOrganizationSettings', 'getSource', 'groupAssets', 'groupFindings', 'listAssets', 'listFindings', 'listMuteConfigs', 'listNotificationConfigs', 'listSources', 'runAssetDiscovery', 'setFindingState', 'setMute', 'setIamPolicy', 'testIamPermissions', 'updateExternalSystem', 'updateFinding', 'updateMuteConfig', 'updateNotificationConfig', 'updateOrganizationSettings', 'updateSource', 'updateSecurityMarks', 'createBigQueryExport', 'deleteBigQueryExport', 'updateBigQueryExport', 'listBigQueryExports']; - 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 mute config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new mute configs's parent. Its format is - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {google.cloud.securitycenter.v1.MuteConfig} request.muteConfig - * Required. The mute config being created. - * @param {string} request.muteConfigId - * Required. Unique identifier provided by the client within the parent scope. - * It must consist of lower case letters, numbers, and hyphen, with the first - * character a letter, the last a letter or a number, and a 63 character - * maximum. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [MuteConfig]{@link google.cloud.securitycenter.v1.MuteConfig}. - * 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_mute_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_CreateMuteConfig_async - */ - createMuteConfig( - request?: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|undefined, {}|undefined - ]>; - createMuteConfig( - request: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - createMuteConfig( - request: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - createMuteConfig( - request?: protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.ICreateMuteConfigRequest|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.createMuteConfig(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 an existing mute config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the mute config to delete. Its format is - * organizations/{organization}/muteConfigs/{config_id}, - * folders/{folder}/muteConfigs/{config_id}, or - * projects/{project}/muteConfigs/{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_mute_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteMuteConfig_async - */ - deleteMuteConfig( - request?: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|undefined, {}|undefined - ]>; - deleteMuteConfig( - request: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteMuteConfig( - request: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteMuteConfig( - request?: protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteMuteConfigRequest|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.deleteMuteConfig(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 a big query export. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the big query export to retrieve. Its format is - * organizations/{organization}/bigQueryExports/{export_id}, - * folders/{folder}/bigQueryExports/{export_id}, or - * projects/{project}/bigQueryExports/{export_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 [BigQueryExport]{@link google.cloud.securitycenter.v1.BigQueryExport}. - * 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_big_query_export.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetBigQueryExport_async - */ - getBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|undefined, {}|undefined - ]>; - getBigQueryExport( - request: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - getBigQueryExport( - request: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - getBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IGetBigQueryExportRequest|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.getBigQueryExport(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`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 mute config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the mute config to retrieve. Its format is - * organizations/{organization}/muteConfigs/{config_id}, - * folders/{folder}/muteConfigs/{config_id}, or - * projects/{project}/muteConfigs/{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 [MuteConfig]{@link google.cloud.securitycenter.v1.MuteConfig}. - * 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_mute_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_GetMuteConfig_async - */ - getMuteConfig( - request?: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|undefined, {}|undefined - ]>; - getMuteConfig( - request: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - getMuteConfig( - request: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - getMuteConfig( - request?: protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IGetMuteConfigRequest|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.getMuteConfig(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); - } -/** - * Updates the mute 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}", - * "folders/{folder_id}/sources/{source_id}/finding/{finding_id}", - * "projects/{project_id}/sources/{source_id}/finding/{finding_id}". - * @param {google.cloud.securitycenter.v1.Finding.Mute} request.mute - * Required. The desired state of the Mute. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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_mute.js - * region_tag:securitycenter_v1_generated_SecurityCenter_SetMute_async - */ - setMute( - request?: protos.google.cloud.securitycenter.v1.ISetMuteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetMuteRequest|undefined, {}|undefined - ]>; - setMute( - request: protos.google.cloud.securitycenter.v1.ISetMuteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, - {}|null|undefined>): void; - setMute( - request: protos.google.cloud.securitycenter.v1.ISetMuteRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, - {}|null|undefined>): void; - setMute( - request?: protos.google.cloud.securitycenter.v1.ISetMuteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetMuteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IFinding, - protos.google.cloud.securitycenter.v1.ISetMuteRequest|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.setMute(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 {google.protobuf.FieldMask} request.updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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); - } -/** - * Updates external system. This is for a given finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.ExternalSystem} request.externalSystem - * Required. The external system resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The FieldMask to use when updating the external system 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 [ExternalSystem]{@link google.cloud.securitycenter.v1.ExternalSystem}. - * 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_external_system.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateExternalSystem_async - */ - updateExternalSystem( - request?: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IExternalSystem, - protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|undefined, {}|undefined - ]>; - updateExternalSystem( - request: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IExternalSystem, - protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, - {}|null|undefined>): void; - updateExternalSystem( - request: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IExternalSystem, - protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, - {}|null|undefined>): void; - updateExternalSystem( - request?: protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IExternalSystem, - protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IExternalSystem, - protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IExternalSystem, - protos.google.cloud.securitycenter.v1.IUpdateExternalSystemRequest|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({ - 'external_system.name': request.externalSystem!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateExternalSystem(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 mute config. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.MuteConfig} request.muteConfig - * Required. The mute config being updated. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to 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. - * The first element of the array is an object representing [MuteConfig]{@link google.cloud.securitycenter.v1.MuteConfig}. - * 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_mute_config.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateMuteConfig_async - */ - updateMuteConfig( - request?: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|undefined, {}|undefined - ]>; - updateMuteConfig( - request: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - updateMuteConfig( - request: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, - {}|null|undefined>): void; - updateMuteConfig( - request?: protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig, - protos.google.cloud.securitycenter.v1.IUpdateMuteConfigRequest|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({ - 'mute_config.name': request.muteConfig!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateMuteConfig(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. Must be - * earlier or equal to the server 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); - } -/** - * Creates a big query export. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the new big query export's parent. Its format is - * "organizations/[organization_id]", "folders/[folder_id]", or - * "projects/[project_id]". - * @param {google.cloud.securitycenter.v1.BigQueryExport} request.bigQueryExport - * Required. The big query export being created. - * @param {string} request.bigQueryExportId - * Required. Unique identifier provided by the client within the parent scope. - * It must consist of lower case letters, numbers, and hyphen, with the first - * character a letter, the last a letter or a number, and a 63 character - * maximum. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [BigQueryExport]{@link google.cloud.securitycenter.v1.BigQueryExport}. - * 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_big_query_export.js - * region_tag:securitycenter_v1_generated_SecurityCenter_CreateBigQueryExport_async - */ - createBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|undefined, {}|undefined - ]>; - createBigQueryExport( - request: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - createBigQueryExport( - request: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - createBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.ICreateBigQueryExportRequest|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.createBigQueryExport(request, options, callback); - } -/** - * Deletes an existing big query export. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the big query export to delete. Its format is - * organizations/{organization}/bigQueryExports/{export_id}, - * folders/{folder}/bigQueryExports/{export_id}, or - * projects/{project}/bigQueryExports/{export_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_big_query_export.js - * region_tag:securitycenter_v1_generated_SecurityCenter_DeleteBigQueryExport_async - */ - deleteBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|undefined, {}|undefined - ]>; - deleteBigQueryExport( - request: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - deleteBigQueryExport( - request: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - deleteBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.securitycenter.v1.IDeleteBigQueryExportRequest|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.deleteBigQueryExport(request, options, callback); - } -/** - * Updates a BigQuery export. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.securitycenter.v1.BigQueryExport} request.bigQueryExport - * Required. The BigQuery export being updated. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to 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. - * The first element of the array is an object representing [BigQueryExport]{@link google.cloud.securitycenter.v1.BigQueryExport}. - * 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_big_query_export.js - * region_tag:securitycenter_v1_generated_SecurityCenter_UpdateBigQueryExport_async - */ - updateBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|undefined, {}|undefined - ]>; - updateBigQueryExport( - request: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - updateBigQueryExport( - request: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, - callback: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, - {}|null|undefined>): void; - updateBigQueryExport( - request?: protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport, - protos.google.cloud.securitycenter.v1.IUpdateBigQueryExportRequest|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({ - 'big_query_export.name': request.bigQueryExport!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateBigQueryExport(request, options, callback); - } - -/** - * Kicks off an LRO to bulk mute findings for a parent based on a filter. The - * parent can be either an organization, folder or project. The findings - * matched by the filter will be muted after the LRO is done. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, at which bulk action needs to be applied. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {string} request.filter - * Expression that identifies findings that should be updated. - * 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. - * @param {string} request.muteAnnotation - * This can be a mute configuration name or any identifier for mute/unmute - * of findings based on the filter. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.bulk_mute_findings.js - * region_tag:securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async - */ - bulkMuteFindings( - request?: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - bulkMuteFindings( - request: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - bulkMuteFindings( - request: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - bulkMuteFindings( - request?: protos.google.cloud.securitycenter.v1.IBulkMuteFindingsRequest, - 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.bulkMuteFindings(request, options, callback); - } -/** - * Check the status of the long running operation returned by `bulkMuteFindings()`. - * @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.bulk_mute_findings.js - * region_tag:securitycenter_v1_generated_SecurityCenter_BulkMuteFindings_async - */ - async checkBulkMuteFindingsProgress(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.bulkMuteFindings, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * 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 mute configs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns the collection of mute configs. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {number} request.pageSize - * The maximum number of configs to return. The service may return fewer than - * this value. - * If unspecified, at most 10 configs will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListMuteConfigs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListMuteConfigs` must - * match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [MuteConfig]{@link google.cloud.securitycenter.v1.MuteConfig}. - * 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 `listMuteConfigsAsync()` - * 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. - */ - listMuteConfigs( - request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig[], - protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest|null, - protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse - ]>; - listMuteConfigs( - request: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IMuteConfig>): void; - listMuteConfigs( - request: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IMuteConfig>): void; - listMuteConfigs( - request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IMuteConfig>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IMuteConfig>): - Promise<[ - protos.google.cloud.securitycenter.v1.IMuteConfig[], - protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest|null, - protos.google.cloud.securitycenter.v1.IListMuteConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listMuteConfigs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns the collection of mute configs. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {number} request.pageSize - * The maximum number of configs to return. The service may return fewer than - * this value. - * If unspecified, at most 10 configs will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListMuteConfigs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListMuteConfigs` must - * match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [MuteConfig]{@link google.cloud.securitycenter.v1.MuteConfig} 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 `listMuteConfigsAsync()` - * 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. - */ - listMuteConfigsStream( - request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - 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['listMuteConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMuteConfigs.createStream( - this.innerApiCalls.listMuteConfigs as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMuteConfigs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns the collection of mute configs. Its format - * is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {number} request.pageSize - * The maximum number of configs to return. The service may return fewer than - * this value. - * If unspecified, at most 10 configs will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListMuteConfigs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListMuteConfigs` must - * match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [MuteConfig]{@link google.cloud.securitycenter.v1.MuteConfig}. 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_mute_configs.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListMuteConfigs_async - */ - listMuteConfigsAsync( - request?: protos.google.cloud.securitycenter.v1.IListMuteConfigsRequest, - 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['listMuteConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listMuteConfigs.asyncIterate( - this.innerApiCalls['listMuteConfigs'] 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; - } - /** - * Lists BigQuery exports. Note that when requesting BigQuery exports at a - * given level all exports under that level are also returned e.g. if - * requesting BigQuery exports under a folder, then all BigQuery exports - * immediately under the folder plus the ones created under the projects - * within the folder are returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns the collection of BigQuery exports. Its - * format is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {number} request.pageSize - * The maximum number of configs to return. The service may return fewer than - * this value. - * If unspecified, at most 10 configs will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBigQueryExports` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListBigQueryExports` - * must match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [BigQueryExport]{@link google.cloud.securitycenter.v1.BigQueryExport}. - * 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 `listBigQueryExportsAsync()` - * 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. - */ - listBigQueryExports( - request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport[], - protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest|null, - protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse - ]>; - listBigQueryExports( - request: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IBigQueryExport>): void; - listBigQueryExports( - request: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - callback: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IBigQueryExport>): void; - listBigQueryExports( - request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IBigQueryExport>, - callback?: PaginationCallback< - protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse|null|undefined, - protos.google.cloud.securitycenter.v1.IBigQueryExport>): - Promise<[ - protos.google.cloud.securitycenter.v1.IBigQueryExport[], - protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest|null, - protos.google.cloud.securitycenter.v1.IListBigQueryExportsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listBigQueryExports(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns the collection of BigQuery exports. Its - * format is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {number} request.pageSize - * The maximum number of configs to return. The service may return fewer than - * this value. - * If unspecified, at most 10 configs will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBigQueryExports` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListBigQueryExports` - * must match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [BigQueryExport]{@link google.cloud.securitycenter.v1.BigQueryExport} 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 `listBigQueryExportsAsync()` - * 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. - */ - listBigQueryExportsStream( - request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - 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['listBigQueryExports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBigQueryExports.createStream( - this.innerApiCalls.listBigQueryExports as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBigQueryExports`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns the collection of BigQuery exports. Its - * format is "organizations/[organization_id]", "folders/[folder_id]", - * "projects/[project_id]". - * @param {number} request.pageSize - * The maximum number of configs to return. The service may return fewer than - * this value. - * If unspecified, at most 10 configs will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBigQueryExports` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListBigQueryExports` - * must match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [BigQueryExport]{@link google.cloud.securitycenter.v1.BigQueryExport}. 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_big_query_exports.js - * region_tag:securitycenter_v1_generated_SecurityCenter_ListBigQueryExports_async - */ - listBigQueryExportsAsync( - request?: protos.google.cloud.securitycenter.v1.IListBigQueryExportsRequest, - 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['listBigQueryExports']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listBigQueryExports.asyncIterate( - this.innerApiCalls['listBigQueryExports'] 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 folderExport resource name string. - * - * @param {string} folder - * @param {string} exportParam - * @returns {string} Resource name string. - */ - folderExportPath(folder:string,exportParam:string) { - return this.pathTemplates.folderExportPathTemplate.render({ - folder: folder, - export: exportParam, - }); - } - - /** - * Parse the folder from FolderExport resource. - * - * @param {string} folderExportName - * A fully-qualified path representing folder_export resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExportName(folderExportName: string) { - return this.pathTemplates.folderExportPathTemplate.match(folderExportName).folder; - } - - /** - * Parse the export from FolderExport resource. - * - * @param {string} folderExportName - * A fully-qualified path representing folder_export resource. - * @returns {string} A string representing the export. - */ - matchExportFromFolderExportName(folderExportName: string) { - return this.pathTemplates.folderExportPathTemplate.match(folderExportName).export; - } - - /** - * Return a fully-qualified folderMuteConfig resource name string. - * - * @param {string} folder - * @param {string} mute_config - * @returns {string} Resource name string. - */ - folderMuteConfigPath(folder:string,muteConfig:string) { - return this.pathTemplates.folderMuteConfigPathTemplate.render({ - folder: folder, - mute_config: muteConfig, - }); - } - - /** - * Parse the folder from FolderMuteConfig resource. - * - * @param {string} folderMuteConfigName - * A fully-qualified path representing folder_mute_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderMuteConfigName(folderMuteConfigName: string) { - return this.pathTemplates.folderMuteConfigPathTemplate.match(folderMuteConfigName).folder; - } - - /** - * Parse the mute_config from FolderMuteConfig resource. - * - * @param {string} folderMuteConfigName - * A fully-qualified path representing folder_mute_config resource. - * @returns {string} A string representing the mute_config. - */ - matchMuteConfigFromFolderMuteConfigName(folderMuteConfigName: string) { - return this.pathTemplates.folderMuteConfigPathTemplate.match(folderMuteConfigName).mute_config; - } - - /** - * 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 folderSourceFindingExternalsystem resource name string. - * - * @param {string} folder - * @param {string} source - * @param {string} finding - * @param {string} externalsystem - * @returns {string} Resource name string. - */ - folderSourceFindingExternalsystemPath(folder:string,source:string,finding:string,externalsystem:string) { - return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.render({ - folder: folder, - source: source, - finding: finding, - externalsystem: externalsystem, - }); - } - - /** - * Parse the folder from FolderSourceFindingExternalsystem resource. - * - * @param {string} folderSourceFindingExternalsystemName - * A fully-qualified path representing folder_source_finding_externalsystem resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { - return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).folder; - } - - /** - * Parse the source from FolderSourceFindingExternalsystem resource. - * - * @param {string} folderSourceFindingExternalsystemName - * A fully-qualified path representing folder_source_finding_externalsystem resource. - * @returns {string} A string representing the source. - */ - matchSourceFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { - return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).source; - } - - /** - * Parse the finding from FolderSourceFindingExternalsystem resource. - * - * @param {string} folderSourceFindingExternalsystemName - * A fully-qualified path representing folder_source_finding_externalsystem resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { - return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).finding; - } - - /** - * Parse the externalsystem from FolderSourceFindingExternalsystem resource. - * - * @param {string} folderSourceFindingExternalsystemName - * A fully-qualified path representing folder_source_finding_externalsystem resource. - * @returns {string} A string representing the externalsystem. - */ - matchExternalsystemFromFolderSourceFindingExternalsystemName(folderSourceFindingExternalsystemName: string) { - return this.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match(folderSourceFindingExternalsystemName).externalsystem; - } - - /** - * 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 organizationExport resource name string. - * - * @param {string} organization - * @param {string} exportParam - * @returns {string} Resource name string. - */ - organizationExportPath(organization:string,exportParam:string) { - return this.pathTemplates.organizationExportPathTemplate.render({ - organization: organization, - export: exportParam, - }); - } - - /** - * Parse the organization from OrganizationExport resource. - * - * @param {string} organizationExportName - * A fully-qualified path representing organization_export resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExportName(organizationExportName: string) { - return this.pathTemplates.organizationExportPathTemplate.match(organizationExportName).organization; - } - - /** - * Parse the export from OrganizationExport resource. - * - * @param {string} organizationExportName - * A fully-qualified path representing organization_export resource. - * @returns {string} A string representing the export. - */ - matchExportFromOrganizationExportName(organizationExportName: string) { - return this.pathTemplates.organizationExportPathTemplate.match(organizationExportName).export; - } - - /** - * Return a fully-qualified organizationMuteConfig resource name string. - * - * @param {string} organization - * @param {string} mute_config - * @returns {string} Resource name string. - */ - organizationMuteConfigPath(organization:string,muteConfig:string) { - return this.pathTemplates.organizationMuteConfigPathTemplate.render({ - organization: organization, - mute_config: muteConfig, - }); - } - - /** - * Parse the organization from OrganizationMuteConfig resource. - * - * @param {string} organizationMuteConfigName - * A fully-qualified path representing organization_mute_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationMuteConfigName(organizationMuteConfigName: string) { - return this.pathTemplates.organizationMuteConfigPathTemplate.match(organizationMuteConfigName).organization; - } - - /** - * Parse the mute_config from OrganizationMuteConfig resource. - * - * @param {string} organizationMuteConfigName - * A fully-qualified path representing organization_mute_config resource. - * @returns {string} A string representing the mute_config. - */ - matchMuteConfigFromOrganizationMuteConfigName(organizationMuteConfigName: string) { - return this.pathTemplates.organizationMuteConfigPathTemplate.match(organizationMuteConfigName).mute_config; - } - - /** - * 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 organizationSourceFindingExternalsystem resource name string. - * - * @param {string} organization - * @param {string} source - * @param {string} finding - * @param {string} externalsystem - * @returns {string} Resource name string. - */ - organizationSourceFindingExternalsystemPath(organization:string,source:string,finding:string,externalsystem:string) { - return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.render({ - organization: organization, - source: source, - finding: finding, - externalsystem: externalsystem, - }); - } - - /** - * Parse the organization from OrganizationSourceFindingExternalsystem resource. - * - * @param {string} organizationSourceFindingExternalsystemName - * A fully-qualified path representing organization_source_finding_externalsystem resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { - return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).organization; - } - - /** - * Parse the source from OrganizationSourceFindingExternalsystem resource. - * - * @param {string} organizationSourceFindingExternalsystemName - * A fully-qualified path representing organization_source_finding_externalsystem resource. - * @returns {string} A string representing the source. - */ - matchSourceFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { - return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).source; - } - - /** - * Parse the finding from OrganizationSourceFindingExternalsystem resource. - * - * @param {string} organizationSourceFindingExternalsystemName - * A fully-qualified path representing organization_source_finding_externalsystem resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { - return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).finding; - } - - /** - * Parse the externalsystem from OrganizationSourceFindingExternalsystem resource. - * - * @param {string} organizationSourceFindingExternalsystemName - * A fully-qualified path representing organization_source_finding_externalsystem resource. - * @returns {string} A string representing the externalsystem. - */ - matchExternalsystemFromOrganizationSourceFindingExternalsystemName(organizationSourceFindingExternalsystemName: string) { - return this.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match(organizationSourceFindingExternalsystemName).externalsystem; - } - - /** - * 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 projectExport resource name string. - * - * @param {string} project - * @param {string} exportParam - * @returns {string} Resource name string. - */ - projectExportPath(project:string,exportParam:string) { - return this.pathTemplates.projectExportPathTemplate.render({ - project: project, - export: exportParam, - }); - } - - /** - * Parse the project from ProjectExport resource. - * - * @param {string} projectExportName - * A fully-qualified path representing project_export resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExportName(projectExportName: string) { - return this.pathTemplates.projectExportPathTemplate.match(projectExportName).project; - } - - /** - * Parse the export from ProjectExport resource. - * - * @param {string} projectExportName - * A fully-qualified path representing project_export resource. - * @returns {string} A string representing the export. - */ - matchExportFromProjectExportName(projectExportName: string) { - return this.pathTemplates.projectExportPathTemplate.match(projectExportName).export; - } - - /** - * Return a fully-qualified projectMuteConfig resource name string. - * - * @param {string} project - * @param {string} mute_config - * @returns {string} Resource name string. - */ - projectMuteConfigPath(project:string,muteConfig:string) { - return this.pathTemplates.projectMuteConfigPathTemplate.render({ - project: project, - mute_config: muteConfig, - }); - } - - /** - * Parse the project from ProjectMuteConfig resource. - * - * @param {string} projectMuteConfigName - * A fully-qualified path representing project_mute_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectMuteConfigName(projectMuteConfigName: string) { - return this.pathTemplates.projectMuteConfigPathTemplate.match(projectMuteConfigName).project; - } - - /** - * Parse the mute_config from ProjectMuteConfig resource. - * - * @param {string} projectMuteConfigName - * A fully-qualified path representing project_mute_config resource. - * @returns {string} A string representing the mute_config. - */ - matchMuteConfigFromProjectMuteConfigName(projectMuteConfigName: string) { - return this.pathTemplates.projectMuteConfigPathTemplate.match(projectMuteConfigName).mute_config; - } - - /** - * 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 projectSourceFindingExternalsystem resource name string. - * - * @param {string} project - * @param {string} source - * @param {string} finding - * @param {string} externalsystem - * @returns {string} Resource name string. - */ - projectSourceFindingExternalsystemPath(project:string,source:string,finding:string,externalsystem:string) { - return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.render({ - project: project, - source: source, - finding: finding, - externalsystem: externalsystem, - }); - } - - /** - * Parse the project from ProjectSourceFindingExternalsystem resource. - * - * @param {string} projectSourceFindingExternalsystemName - * A fully-qualified path representing project_source_finding_externalsystem resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { - return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).project; - } - - /** - * Parse the source from ProjectSourceFindingExternalsystem resource. - * - * @param {string} projectSourceFindingExternalsystemName - * A fully-qualified path representing project_source_finding_externalsystem resource. - * @returns {string} A string representing the source. - */ - matchSourceFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { - return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).source; - } - - /** - * Parse the finding from ProjectSourceFindingExternalsystem resource. - * - * @param {string} projectSourceFindingExternalsystemName - * A fully-qualified path representing project_source_finding_externalsystem resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { - return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).finding; - } - - /** - * Parse the externalsystem from ProjectSourceFindingExternalsystem resource. - * - * @param {string} projectSourceFindingExternalsystemName - * A fully-qualified path representing project_source_finding_externalsystem resource. - * @returns {string} A string representing the externalsystem. - */ - matchExternalsystemFromProjectSourceFindingExternalsystemName(projectSourceFindingExternalsystemName: string) { - return this.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match(projectSourceFindingExternalsystemName).externalsystem; - } - - /** - * 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 { - if (this.securityCenterStub && !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 149e8338..00000000 --- a/owl-bot-staging/v1/src/v1/security_center_client_config.json +++ /dev/null @@ -1,193 +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": { - "BulkMuteFindings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "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" - }, - "CreateMuteConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteMuteConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNotificationConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBigQueryExport": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetMuteConfig": { - "retry_codes_name": "non_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" - }, - "ListMuteConfigs": { - "retry_codes_name": "non_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" - }, - "SetMute": { - "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" - }, - "UpdateExternalSystem": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFinding": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateMuteConfig": { - "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" - }, - "CreateBigQueryExport": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBigQueryExport": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBigQueryExport": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBigQueryExports": { - "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 db5193d0..00000000 --- a/owl-bot-staging/v1/src/v1/security_center_proto_list.json +++ /dev/null @@ -1,21 +0,0 @@ -[ - "../../protos/google/cloud/securitycenter/v1/access.proto", - "../../protos/google/cloud/securitycenter/v1/asset.proto", - "../../protos/google/cloud/securitycenter/v1/bigquery_export.proto", - "../../protos/google/cloud/securitycenter/v1/external_system.proto", - "../../protos/google/cloud/securitycenter/v1/finding.proto", - "../../protos/google/cloud/securitycenter/v1/folder.proto", - "../../protos/google/cloud/securitycenter/v1/iam_binding.proto", - "../../protos/google/cloud/securitycenter/v1/indicator.proto", - "../../protos/google/cloud/securitycenter/v1/mitre_attack.proto", - "../../protos/google/cloud/securitycenter/v1/mute_config.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 842e41d5..00000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const 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 1e7b0783..00000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {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 8ec45222..00000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1/test/gapic_security_center_v1.ts b/owl-bot-staging/v1/test/gapic_security_center_v1.ts deleted file mode 100644 index 1e6fb642..00000000 --- a/owl-bot-staging/v1/test/gapic_security_center_v1.ts +++ /dev/null @@ -1,5933 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as 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 for the initialized client', done => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.securityCenterStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.securityCenterStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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)); - }); - - it('invokes createSource with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSource(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes createFinding with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createFinding(request), expectedError); - }); - }); - - describe('createMuteConfig', () => { - it('invokes createMuteConfig 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.CreateMuteConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()); - client.innerApiCalls.createMuteConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createMuteConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createMuteConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createMuteConfig 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.CreateMuteConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()); - client.innerApiCalls.createMuteConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMuteConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createMuteConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createMuteConfig 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.CreateMuteConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createMuteConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createMuteConfig(request), expectedError); - assert((client.innerApiCalls.createMuteConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createMuteConfig with closed client', 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.CreateMuteConfigRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createMuteConfig(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes createNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createNotificationConfig(request), expectedError); - }); - }); - - describe('deleteMuteConfig', () => { - it('invokes deleteMuteConfig 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.DeleteMuteConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteMuteConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteMuteConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteMuteConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteMuteConfig 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.DeleteMuteConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteMuteConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMuteConfig( - 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.deleteMuteConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteMuteConfig 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.DeleteMuteConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMuteConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteMuteConfig(request), expectedError); - assert((client.innerApiCalls.deleteMuteConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteMuteConfig with closed client', 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.DeleteMuteConfigRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteMuteConfig(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes deleteNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteNotificationConfig(request), expectedError); - }); - }); - - describe('getBigQueryExport', () => { - it('invokes getBigQueryExport 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.GetBigQueryExportRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()); - client.innerApiCalls.getBigQueryExport = stubSimpleCall(expectedResponse); - const [response] = await client.getBigQueryExport(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBigQueryExport as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getBigQueryExport 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.GetBigQueryExportRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()); - client.innerApiCalls.getBigQueryExport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBigQueryExport( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBigQueryExport as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getBigQueryExport 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.GetBigQueryExportRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getBigQueryExport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBigQueryExport(request), expectedError); - assert((client.innerApiCalls.getBigQueryExport as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getBigQueryExport with closed client', 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.GetBigQueryExportRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getBigQueryExport(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes getIamPolicy with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('getMuteConfig', () => { - it('invokes getMuteConfig 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.GetMuteConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()); - client.innerApiCalls.getMuteConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getMuteConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getMuteConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getMuteConfig 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.GetMuteConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()); - client.innerApiCalls.getMuteConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMuteConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getMuteConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getMuteConfig 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.GetMuteConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getMuteConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMuteConfig(request), expectedError); - assert((client.innerApiCalls.getMuteConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getMuteConfig with closed client', 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.GetMuteConfigRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getMuteConfig(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes getNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNotificationConfig(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes getOrganizationSettings with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getOrganizationSettings(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes getSource with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSource(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes setFindingState with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setFindingState(request), expectedError); - }); - }); - - describe('setMute', () => { - it('invokes setMute 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.SetMuteRequest()); - 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.setMute = stubSimpleCall(expectedResponse); - const [response] = await client.setMute(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setMute as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setMute 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.SetMuteRequest()); - 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.setMute = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setMute( - 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.setMute as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes setMute 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.SetMuteRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setMute = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setMute(request), expectedError); - assert((client.innerApiCalls.setMute as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setMute with closed client', 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.SetMuteRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setMute(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes setIamPolicy with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes testIamPermissions with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - describe('updateExternalSystem', () => { - it('invokes updateExternalSystem 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.UpdateExternalSystemRequest()); - request.externalSystem = {}; - request.externalSystem.name = ''; - const expectedHeaderRequestParams = "external_system.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ExternalSystem()); - client.innerApiCalls.updateExternalSystem = stubSimpleCall(expectedResponse); - const [response] = await client.updateExternalSystem(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateExternalSystem as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateExternalSystem 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.UpdateExternalSystemRequest()); - request.externalSystem = {}; - request.externalSystem.name = ''; - const expectedHeaderRequestParams = "external_system.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.ExternalSystem()); - client.innerApiCalls.updateExternalSystem = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateExternalSystem( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IExternalSystem|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateExternalSystem as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateExternalSystem 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.UpdateExternalSystemRequest()); - request.externalSystem = {}; - request.externalSystem.name = ''; - const expectedHeaderRequestParams = "external_system.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateExternalSystem = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateExternalSystem(request), expectedError); - assert((client.innerApiCalls.updateExternalSystem as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateExternalSystem with closed client', 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.UpdateExternalSystemRequest()); - request.externalSystem = {}; - request.externalSystem.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateExternalSystem(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateFinding with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateFinding(request), expectedError); - }); - }); - - describe('updateMuteConfig', () => { - it('invokes updateMuteConfig 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.UpdateMuteConfigRequest()); - request.muteConfig = {}; - request.muteConfig.name = ''; - const expectedHeaderRequestParams = "mute_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()); - client.innerApiCalls.updateMuteConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateMuteConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateMuteConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateMuteConfig 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.UpdateMuteConfigRequest()); - request.muteConfig = {}; - request.muteConfig.name = ''; - const expectedHeaderRequestParams = "mute_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()); - client.innerApiCalls.updateMuteConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMuteConfig( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateMuteConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateMuteConfig 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.UpdateMuteConfigRequest()); - request.muteConfig = {}; - request.muteConfig.name = ''; - const expectedHeaderRequestParams = "mute_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMuteConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateMuteConfig(request), expectedError); - assert((client.innerApiCalls.updateMuteConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateMuteConfig with closed client', 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.UpdateMuteConfigRequest()); - request.muteConfig = {}; - request.muteConfig.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateMuteConfig(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateNotificationConfig(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateOrganizationSettings with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateOrganizationSettings(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateSource with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSource(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateSecurityMarks with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSecurityMarks(request), expectedError); - }); - }); - - describe('createBigQueryExport', () => { - it('invokes createBigQueryExport 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.CreateBigQueryExportRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()); - client.innerApiCalls.createBigQueryExport = stubSimpleCall(expectedResponse); - const [response] = await client.createBigQueryExport(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBigQueryExport as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createBigQueryExport 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.CreateBigQueryExportRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()); - client.innerApiCalls.createBigQueryExport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBigQueryExport( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBigQueryExport as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createBigQueryExport 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.CreateBigQueryExportRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createBigQueryExport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBigQueryExport(request), expectedError); - assert((client.innerApiCalls.createBigQueryExport as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createBigQueryExport with closed client', 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.CreateBigQueryExportRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createBigQueryExport(request), expectedError); - }); - }); - - describe('deleteBigQueryExport', () => { - it('invokes deleteBigQueryExport 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.DeleteBigQueryExportRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteBigQueryExport = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBigQueryExport(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteBigQueryExport as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteBigQueryExport 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.DeleteBigQueryExportRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteBigQueryExport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBigQueryExport( - 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.deleteBigQueryExport as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteBigQueryExport 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.DeleteBigQueryExportRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBigQueryExport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBigQueryExport(request), expectedError); - assert((client.innerApiCalls.deleteBigQueryExport as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteBigQueryExport with closed client', 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.DeleteBigQueryExportRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteBigQueryExport(request), expectedError); - }); - }); - - describe('updateBigQueryExport', () => { - it('invokes updateBigQueryExport 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.UpdateBigQueryExportRequest()); - request.bigQueryExport = {}; - request.bigQueryExport.name = ''; - const expectedHeaderRequestParams = "big_query_export.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()); - client.innerApiCalls.updateBigQueryExport = stubSimpleCall(expectedResponse); - const [response] = await client.updateBigQueryExport(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateBigQueryExport as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateBigQueryExport 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.UpdateBigQueryExportRequest()); - request.bigQueryExport = {}; - request.bigQueryExport.name = ''; - const expectedHeaderRequestParams = "big_query_export.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()); - client.innerApiCalls.updateBigQueryExport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBigQueryExport( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateBigQueryExport as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateBigQueryExport 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.UpdateBigQueryExportRequest()); - request.bigQueryExport = {}; - request.bigQueryExport.name = ''; - const expectedHeaderRequestParams = "big_query_export.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBigQueryExport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBigQueryExport(request), expectedError); - assert((client.innerApiCalls.updateBigQueryExport as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateBigQueryExport with closed client', 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.UpdateBigQueryExportRequest()); - request.bigQueryExport = {}; - request.bigQueryExport.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateBigQueryExport(request), expectedError); - }); - }); - - describe('bulkMuteFindings', () => { - it('invokes bulkMuteFindings 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.BulkMuteFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.bulkMuteFindings = stubLongRunningCall(expectedResponse); - const [operation] = await client.bulkMuteFindings(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.bulkMuteFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes bulkMuteFindings 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.BulkMuteFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.bulkMuteFindings = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.bulkMuteFindings( - 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.bulkMuteFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes bulkMuteFindings 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.BulkMuteFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.bulkMuteFindings = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.bulkMuteFindings(request), expectedError); - assert((client.innerApiCalls.bulkMuteFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes bulkMuteFindings 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.BulkMuteFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.bulkMuteFindings = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.bulkMuteFindings(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.bulkMuteFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkBulkMuteFindingsProgress 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.checkBulkMuteFindingsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBulkMuteFindingsProgress 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.checkBulkMuteFindingsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - 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('listMuteConfigs', () => { - it('invokes listMuteConfigs 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.ListMuteConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - ]; - client.innerApiCalls.listMuteConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listMuteConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listMuteConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listMuteConfigs 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.ListMuteConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - ]; - client.innerApiCalls.listMuteConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMuteConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IMuteConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listMuteConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listMuteConfigs 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.ListMuteConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listMuteConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMuteConfigs(request), expectedError); - assert((client.innerApiCalls.listMuteConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listMuteConfigsStream 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.ListMuteConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - ]; - client.descriptors.page.listMuteConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMuteConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.MuteConfig[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.MuteConfig) => { - 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.listMuteConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMuteConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listMuteConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listMuteConfigsStream 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.ListMuteConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listMuteConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMuteConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.MuteConfig[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.MuteConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMuteConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMuteConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listMuteConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listMuteConfigs 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.ListMuteConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.MuteConfig()), - ]; - client.descriptors.page.listMuteConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.IMuteConfig[] = []; - const iterable = client.listMuteConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listMuteConfigs 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.ListMuteConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listMuteConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMuteConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.IMuteConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMuteConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listMuteConfigs.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('listBigQueryExports', () => { - it('invokes listBigQueryExports 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.ListBigQueryExportsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - ]; - client.innerApiCalls.listBigQueryExports = stubSimpleCall(expectedResponse); - const [response] = await client.listBigQueryExports(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBigQueryExports as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listBigQueryExports 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.ListBigQueryExportsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - ]; - client.innerApiCalls.listBigQueryExports = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBigQueryExports( - request, - (err?: Error|null, result?: protos.google.cloud.securitycenter.v1.IBigQueryExport[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBigQueryExports as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listBigQueryExports 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.ListBigQueryExportsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listBigQueryExports = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBigQueryExports(request), expectedError); - assert((client.innerApiCalls.listBigQueryExports as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listBigQueryExportsStream 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.ListBigQueryExportsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - ]; - client.descriptors.page.listBigQueryExports.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBigQueryExportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.BigQueryExport[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.BigQueryExport) => { - 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.listBigQueryExports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBigQueryExports, request)); - assert.strictEqual( - (client.descriptors.page.listBigQueryExports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listBigQueryExportsStream 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.ListBigQueryExportsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listBigQueryExports.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBigQueryExportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.securitycenter.v1.BigQueryExport[] = []; - stream.on('data', (response: protos.google.cloud.securitycenter.v1.BigQueryExport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBigQueryExports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBigQueryExports, request)); - assert.strictEqual( - (client.descriptors.page.listBigQueryExports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listBigQueryExports 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.ListBigQueryExportsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - generateSampleMessage(new protos.google.cloud.securitycenter.v1.BigQueryExport()), - ]; - client.descriptors.page.listBigQueryExports.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.securitycenter.v1.IBigQueryExport[] = []; - const iterable = client.listBigQueryExportsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listBigQueryExports 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.ListBigQueryExportsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listBigQueryExports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBigQueryExportsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.securitycenter.v1.IBigQueryExport[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBigQueryExports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listBigQueryExports.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('folderExport', () => { - const fakePath = "/rendered/path/folderExport"; - const expectedParameters = { - folder: "folderValue", - export: "exportValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderExportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExportPath', () => { - const result = client.folderExportPath("folderValue", "exportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExportName', () => { - const result = client.matchFolderFromFolderExportName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExportFromFolderExportName', () => { - const result = client.matchExportFromFolderExportName(fakePath); - assert.strictEqual(result, "exportValue"); - assert((client.pathTemplates.folderExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderMuteConfig', () => { - const fakePath = "/rendered/path/folderMuteConfig"; - const expectedParameters = { - folder: "folderValue", - mute_config: "muteConfigValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderMuteConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderMuteConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderMuteConfigPath', () => { - const result = client.folderMuteConfigPath("folderValue", "muteConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderMuteConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderMuteConfigName', () => { - const result = client.matchFolderFromFolderMuteConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderMuteConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMuteConfigFromFolderMuteConfigName', () => { - const result = client.matchMuteConfigFromFolderMuteConfigName(fakePath); - assert.strictEqual(result, "muteConfigValue"); - assert((client.pathTemplates.folderMuteConfigPathTemplate.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('folderSourceFindingExternalsystem', () => { - const fakePath = "/rendered/path/folderSourceFindingExternalsystem"; - const expectedParameters = { - folder: "folderValue", - source: "sourceValue", - finding: "findingValue", - externalsystem: "externalsystemValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSourceFindingExternalsystemPath', () => { - const result = client.folderSourceFindingExternalsystemPath("folderValue", "sourceValue", "findingValue", "externalsystemValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSourceFindingExternalsystemName', () => { - const result = client.matchFolderFromFolderSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromFolderSourceFindingExternalsystemName', () => { - const result = client.matchSourceFromFolderSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFolderSourceFindingExternalsystemName', () => { - const result = client.matchFindingFromFolderSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExternalsystemFromFolderSourceFindingExternalsystemName', () => { - const result = client.matchExternalsystemFromFolderSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "externalsystemValue"); - assert((client.pathTemplates.folderSourceFindingExternalsystemPathTemplate.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('organizationExport', () => { - const fakePath = "/rendered/path/organizationExport"; - const expectedParameters = { - organization: "organizationValue", - export: "exportValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationExportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExportPath', () => { - const result = client.organizationExportPath("organizationValue", "exportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExportName', () => { - const result = client.matchOrganizationFromOrganizationExportName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExportFromOrganizationExportName', () => { - const result = client.matchExportFromOrganizationExportName(fakePath); - assert.strictEqual(result, "exportValue"); - assert((client.pathTemplates.organizationExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationMuteConfig', () => { - const fakePath = "/rendered/path/organizationMuteConfig"; - const expectedParameters = { - organization: "organizationValue", - mute_config: "muteConfigValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationMuteConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationMuteConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationMuteConfigPath', () => { - const result = client.organizationMuteConfigPath("organizationValue", "muteConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationMuteConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationMuteConfigName', () => { - const result = client.matchOrganizationFromOrganizationMuteConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationMuteConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMuteConfigFromOrganizationMuteConfigName', () => { - const result = client.matchMuteConfigFromOrganizationMuteConfigName(fakePath); - assert.strictEqual(result, "muteConfigValue"); - assert((client.pathTemplates.organizationMuteConfigPathTemplate.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('organizationSourceFindingExternalsystem', () => { - const fakePath = "/rendered/path/organizationSourceFindingExternalsystem"; - const expectedParameters = { - organization: "organizationValue", - source: "sourceValue", - finding: "findingValue", - externalsystem: "externalsystemValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSourceFindingExternalsystemPath', () => { - const result = client.organizationSourceFindingExternalsystemPath("organizationValue", "sourceValue", "findingValue", "externalsystemValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSourceFindingExternalsystemName', () => { - const result = client.matchOrganizationFromOrganizationSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromOrganizationSourceFindingExternalsystemName', () => { - const result = client.matchSourceFromOrganizationSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromOrganizationSourceFindingExternalsystemName', () => { - const result = client.matchFindingFromOrganizationSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExternalsystemFromOrganizationSourceFindingExternalsystemName', () => { - const result = client.matchExternalsystemFromOrganizationSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "externalsystemValue"); - assert((client.pathTemplates.organizationSourceFindingExternalsystemPathTemplate.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('projectExport', () => { - const fakePath = "/rendered/path/projectExport"; - const expectedParameters = { - project: "projectValue", - export: "exportValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectExportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExportPath', () => { - const result = client.projectExportPath("projectValue", "exportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExportName', () => { - const result = client.matchProjectFromProjectExportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExportFromProjectExportName', () => { - const result = client.matchExportFromProjectExportName(fakePath); - assert.strictEqual(result, "exportValue"); - assert((client.pathTemplates.projectExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectMuteConfig', () => { - const fakePath = "/rendered/path/projectMuteConfig"; - const expectedParameters = { - project: "projectValue", - mute_config: "muteConfigValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectMuteConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectMuteConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectMuteConfigPath', () => { - const result = client.projectMuteConfigPath("projectValue", "muteConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectMuteConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectMuteConfigName', () => { - const result = client.matchProjectFromProjectMuteConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectMuteConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMuteConfigFromProjectMuteConfigName', () => { - const result = client.matchMuteConfigFromProjectMuteConfigName(fakePath); - assert.strictEqual(result, "muteConfigValue"); - assert((client.pathTemplates.projectMuteConfigPathTemplate.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('projectSourceFindingExternalsystem', () => { - const fakePath = "/rendered/path/projectSourceFindingExternalsystem"; - const expectedParameters = { - project: "projectValue", - source: "sourceValue", - finding: "findingValue", - externalsystem: "externalsystemValue", - }; - const client = new securitycenterModule.v1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSourceFindingExternalsystemPath', () => { - const result = client.projectSourceFindingExternalsystemPath("projectValue", "sourceValue", "findingValue", "externalsystemValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSourceFindingExternalsystemName', () => { - const result = client.matchProjectFromProjectSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromProjectSourceFindingExternalsystemName', () => { - const result = client.matchSourceFromProjectSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromProjectSourceFindingExternalsystemName', () => { - const result = client.matchFindingFromProjectSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExternalsystemFromProjectSourceFindingExternalsystemName', () => { - const result = client.matchExternalsystemFromProjectSourceFindingExternalsystemName(fakePath); - assert.strictEqual(result, "externalsystemValue"); - assert((client.pathTemplates.projectSourceFindingExternalsystemPathTemplate.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 3f4fcde5..00000000 --- a/owl-bot-staging/v1beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/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 481c522b..00000000 --- a/owl-bot-staging/v1beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1beta1/.prettierrc.js b/owl-bot-staging/v1beta1/.prettierrc.js deleted file mode 100644 index 494e1478..00000000 --- a/owl-bot-staging/v1beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/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 befd23c8..00000000 --- a/owl-bot-staging/v1beta1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/v1beta1/package.json b/owl-bot-staging/v1beta1/package.json deleted file mode 100644 index 5a98ee64..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.29.4" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=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 b6d02d23..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_finding.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 89b1fb7d..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.create_source.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 c8f862f8..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_iam_policy.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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`. - */ - // 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 3844f406..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_organization_settings.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START 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 fa59cdbd..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.get_source.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START 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 f1094ea2..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_assets.js +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, 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 3eb12bb9..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.group_findings.js +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, 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 187079e5..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_assets.js +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START 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 49e6b81d..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_findings.js +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START 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 6a6a4c3e..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.list_sources.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 8cc9e964..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.run_asset_discovery.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START 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 c135e7f5..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_finding_state.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 f9bb09e4..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.set_iam_policy.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 = {} - /** - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * `paths: "bindings, etag"` - */ - // const updateMask = {} - - // 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 2920bddb..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.test_iam_permissions.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 1c305269..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_finding.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 cea471f4..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_organization_settings.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 d1aaced7..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_security_marks.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 01f4c9f4..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/security_center.update_source.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json b/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json deleted file mode 100644 index 93228556..00000000 --- a/owl-bot-staging/v1beta1/samples/generated/v1beta1/snippet_metadata.google.cloud.securitycenter.v1beta1.json +++ /dev/null @@ -1,895 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-securitycenter", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.securitycenter.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_CreateSource_async", - "title": "SecurityCenter createSource Sample", - "origin": "API_DEFINITION", - "description": " Creates a source.", - "canonical": true, - "file": "security_center.create_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSource", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateSource", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "source", - "type": ".google.cloud.securitycenter.v1beta1.Source" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateSource", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_CreateFinding_async", - "title": "SecurityCenter createFinding Sample", - "origin": "API_DEFINITION", - "description": " Creates a finding. The corresponding source must exist for finding creation to succeed.", - "canonical": true, - "file": "security_center.create_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFinding", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateFinding", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "finding_id", - "type": "TYPE_STRING" - }, - { - "name": "finding", - "type": ".google.cloud.securitycenter.v1beta1.Finding" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateFinding", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.CreateFinding", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GetIamPolicy_async", - "title": "SecurityCenter getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy on the specified Source.", - "canonical": true, - "file": "security_center.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetIamPolicy", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GetOrganizationSettings_async", - "title": "SecurityCenter getOrganizationSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the settings for an organization.", - "canonical": true, - "file": "security_center.get_organization_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetOrganizationSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.OrganizationSettings", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetOrganizationSettings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GetSource_async", - "title": "SecurityCenter getSource Sample", - "origin": "API_DEFINITION", - "description": " Gets a source.", - "canonical": true, - "file": "security_center.get_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSource", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetSource", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetSource", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GetSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GroupAssets_async", - "title": "SecurityCenter groupAssets Sample", - "origin": "API_DEFINITION", - "description": " Filters an organization's assets and groups them by their specified properties.", - "canonical": true, - "file": "security_center.group_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 128, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GroupAssets", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "group_by", - "type": "TYPE_STRING" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.GroupAssetsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GroupAssets", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupAssets", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_GroupFindings_async", - "title": "SecurityCenter groupFindings Sample", - "origin": "API_DEFINITION", - "description": " 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", - "canonical": true, - "file": "security_center.group_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 107, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GroupFindings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "group_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.GroupFindingsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GroupFindings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.GroupFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_ListAssets_async", - "title": "SecurityCenter listAssets Sample", - "origin": "API_DEFINITION", - "description": " Lists an organization's assets.", - "canonical": true, - "file": "security_center.list_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 133, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAssets", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.ListAssetsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListAssets", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListAssets", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_ListFindings_async", - "title": "SecurityCenter listFindings Sample", - "origin": "API_DEFINITION", - "description": " 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", - "canonical": true, - "file": "security_center.list_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 110, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.ListFindingsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListFindings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_ListSources_async", - "title": "SecurityCenter listSources Sample", - "origin": "API_DEFINITION", - "description": " Lists all sources belonging to an organization.", - "canonical": true, - "file": "security_center.list_sources.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSources", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListSources", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.ListSourcesResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListSources", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.ListSources", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_RunAssetDiscovery_async", - "title": "SecurityCenter runAssetDiscovery Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "security_center.run_asset_discovery.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunAssetDiscovery", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.RunAssetDiscovery", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "RunAssetDiscovery", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.RunAssetDiscovery", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_SetFindingState_async", - "title": "SecurityCenter setFindingState Sample", - "origin": "API_DEFINITION", - "description": " Updates the state of a finding.", - "canonical": true, - "file": "security_center.set_finding_state.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetFindingState", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetFindingState", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "state", - "type": ".google.cloud.securitycenter.v1beta1.Finding.State" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "SetFindingState", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetFindingState", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_SetIamPolicy_async", - "title": "SecurityCenter setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy on the specified Source.", - "canonical": true, - "file": "security_center.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.SetIamPolicy", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_TestIamPermissions_async", - "title": "SecurityCenter testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns the permissions that a caller has on the specified source.", - "canonical": true, - "file": "security_center.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.TestIamPermissions", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateFinding_async", - "title": "SecurityCenter updateFinding Sample", - "origin": "API_DEFINITION", - "description": " Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.", - "canonical": true, - "file": "security_center.update_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFinding", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateFinding", - "async": true, - "parameters": [ - { - "name": "finding", - "type": ".google.cloud.securitycenter.v1beta1.Finding" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateFinding", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateFinding", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async", - "title": "SecurityCenter updateOrganizationSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates an organization's settings.", - "canonical": true, - "file": "security_center.update_organization_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateOrganizationSettings", - "async": true, - "parameters": [ - { - "name": "organization_settings", - "type": ".google.cloud.securitycenter.v1beta1.OrganizationSettings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.OrganizationSettings", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateOrganizationSettings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateSource_async", - "title": "SecurityCenter updateSource Sample", - "origin": "API_DEFINITION", - "description": " Updates a source.", - "canonical": true, - "file": "security_center.update_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSource", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSource", - "async": true, - "parameters": [ - { - "name": "source", - "type": ".google.cloud.securitycenter.v1beta1.Source" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateSource", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1beta1_generated_SecurityCenter_UpdateSecurityMarks_async", - "title": "SecurityCenter updateSecurityMarks Sample", - "origin": "API_DEFINITION", - "description": " Updates security marks.", - "canonical": true, - "file": "security_center.update_security_marks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSecurityMarks", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSecurityMarks", - "async": true, - "parameters": [ - { - "name": "security_marks", - "type": ".google.cloud.securitycenter.v1beta1.SecurityMarks" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.securitycenter.v1beta1.SecurityMarks", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateSecurityMarks", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter.UpdateSecurityMarks", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1beta1.SecurityCenter" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1beta1/src/index.ts b/owl-bot-staging/v1beta1/src/index.ts deleted file mode 100644 index 5fb87a6e..00000000 --- a/owl-bot-staging/v1beta1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as 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 d7817680..00000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {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 c18318be..00000000 --- a/owl-bot-staging/v1beta1/src/v1beta1/security_center_client.ts +++ /dev/null @@ -1,3253 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, 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`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {google.protobuf.FieldMask} request.updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 { - if (this.securityCenterStub && !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 842e41d5..00000000 --- a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const 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 1e7b0783..00000000 --- a/owl-bot-staging/v1beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {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 8ec45222..00000000 --- a/owl-bot-staging/v1beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1beta1/test/gapic_security_center_v1beta1.ts b/owl-bot-staging/v1beta1/test/gapic_security_center_v1beta1.ts deleted file mode 100644 index b71d839a..00000000 --- a/owl-bot-staging/v1beta1/test/gapic_security_center_v1beta1.ts +++ /dev/null @@ -1,2906 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as 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 for the initialized client', done => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.securityCenterStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new securitycenterModule.v1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.securityCenterStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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)); - }); - - it('invokes createSource with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSource(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes createFinding with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createFinding(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes getIamPolicy with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes getOrganizationSettings with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getOrganizationSettings(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes getSource with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSource(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes setFindingState with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setFindingState(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes setIamPolicy with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes testIamPermissions with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateFinding with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateFinding(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateOrganizationSettings with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateOrganizationSettings(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateSource with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSource(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateSecurityMarks with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSecurityMarks(request), expectedError); - }); - }); - - 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 3f4fcde5..00000000 --- a/owl-bot-staging/v1p1beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/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 481c522b..00000000 --- a/owl-bot-staging/v1p1beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1p1beta1/.prettierrc.js b/owl-bot-staging/v1p1beta1/.prettierrc.js deleted file mode 100644 index 494e1478..00000000 --- a/owl-bot-staging/v1p1beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1p1beta1/README.md b/owl-bot-staging/v1p1beta1/README.md deleted file mode 100644 index 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 befd23c8..00000000 --- a/owl-bot-staging/v1p1beta1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/v1p1beta1/package.json b/owl-bot-staging/v1p1beta1/package.json deleted file mode 100644 index 5a98ee64..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.29.4" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=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 aac99ed7..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_finding.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, 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 b6f6d561..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_notification_config.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 b9efa166..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.create_source.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 4eb4bcec..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.delete_notification_config.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START 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 712e4fe1..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_iam_policy.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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`. - */ - // 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 8f87ffe5..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_notification_config.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START 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 e96b8b4e..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_organization_settings.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START 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 988cb631..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.get_source.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START 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 6f364214..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_assets.js +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, 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 949e649f..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.group_findings.js +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, 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 29b0abc6..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_assets.js +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START 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 2e5ce81c..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_findings.js +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START 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 d67cbdb7..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_notification_configs.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 78951b70..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.list_sources.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START 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 b53e6a02..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.run_asset_discovery.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START 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 f10874bd..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_finding_state.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 637a16ea..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.set_iam_policy.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 = {} - /** - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * `paths: "bindings, etag"` - */ - // const updateMask = {} - - // 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 808a5c07..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.test_iam_permissions.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 0b7e0ca3..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_finding.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 d36a254b..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_notification_config.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 73d291ae..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_organization_settings.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 c4c73bcd..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_security_marks.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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 89e55925..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/security_center.update_source.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(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/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json deleted file mode 100644 index 27a6b4e3..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.securitycenter.v1p1beta1.json +++ /dev/null @@ -1,1123 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-securitycenter", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.securitycenter.v1p1beta1", - "version": "v1p1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_CreateSource_async", - "title": "SecurityCenter createSource Sample", - "origin": "API_DEFINITION", - "description": " Creates a source.", - "canonical": true, - "file": "security_center.create_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSource", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateSource", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "source", - "type": ".google.cloud.securitycenter.v1p1beta1.Source" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateSource", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_CreateFinding_async", - "title": "SecurityCenter createFinding Sample", - "origin": "API_DEFINITION", - "description": " Creates a finding. The corresponding source must exist for finding creation to succeed.", - "canonical": true, - "file": "security_center.create_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFinding", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateFinding", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "finding_id", - "type": "TYPE_STRING" - }, - { - "name": "finding", - "type": ".google.cloud.securitycenter.v1p1beta1.Finding" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateFinding", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateFinding", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_CreateNotificationConfig_async", - "title": "SecurityCenter createNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a notification config.", - "canonical": true, - "file": "security_center.create_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateNotificationConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "config_id", - "type": "TYPE_STRING" - }, - { - "name": "notification_config", - "type": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "CreateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.CreateNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_DeleteNotificationConfig_async", - "title": "SecurityCenter deleteNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes a notification config.", - "canonical": true, - "file": "security_center.delete_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.DeleteNotificationConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "DeleteNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.DeleteNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetIamPolicy_async", - "title": "SecurityCenter getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy on the specified Source.", - "canonical": true, - "file": "security_center.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetIamPolicy", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetNotificationConfig_async", - "title": "SecurityCenter getNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a notification config.", - "canonical": true, - "file": "security_center.get_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetNotificationConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetOrganizationSettings_async", - "title": "SecurityCenter getOrganizationSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the settings for an organization.", - "canonical": true, - "file": "security_center.get_organization_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetOrganizationSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.OrganizationSettings", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetOrganizationSettings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GetSource_async", - "title": "SecurityCenter getSource Sample", - "origin": "API_DEFINITION", - "description": " Gets a source.", - "canonical": true, - "file": "security_center.get_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSource", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetSource", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GetSource", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GetSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GroupAssets_async", - "title": "SecurityCenter groupAssets Sample", - "origin": "API_DEFINITION", - "description": " Filters an organization's assets and groups them by their specified properties.", - "canonical": true, - "file": "security_center.group_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 165, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GroupAssets", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "group_by", - "type": "TYPE_STRING" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.GroupAssetsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GroupAssets", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupAssets", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_GroupFindings_async", - "title": "SecurityCenter groupFindings Sample", - "origin": "API_DEFINITION", - "description": " 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", - "canonical": true, - "file": "security_center.group_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 161, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GroupFindings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "group_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.GroupFindingsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "GroupFindings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.GroupFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListAssets_async", - "title": "SecurityCenter listAssets Sample", - "origin": "API_DEFINITION", - "description": " Lists an organization's assets.", - "canonical": true, - "file": "security_center.list_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 174, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAssets", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.ListAssetsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListAssets", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListAssets", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_async", - "title": "SecurityCenter listFindings Sample", - "origin": "API_DEFINITION", - "description": " 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", - "canonical": true, - "file": "security_center.list_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 170, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "compare_duration", - "type": ".google.protobuf.Duration" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.ListFindingsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListFindings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListFindings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListNotificationConfigs_async", - "title": "SecurityCenter listNotificationConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists notification configs.", - "canonical": true, - "file": "security_center.list_notification_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNotificationConfigs", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListNotificationConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.ListNotificationConfigsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListNotificationConfigs", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListNotificationConfigs", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_ListSources_async", - "title": "SecurityCenter listSources Sample", - "origin": "API_DEFINITION", - "description": " Lists all sources belonging to an organization.", - "canonical": true, - "file": "security_center.list_sources.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSources", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListSources", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.ListSourcesResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "ListSources", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.ListSources", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_RunAssetDiscovery_async", - "title": "SecurityCenter runAssetDiscovery Sample", - "origin": "API_DEFINITION", - "description": " 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.", - "canonical": true, - "file": "security_center.run_asset_discovery.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunAssetDiscovery", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.RunAssetDiscovery", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "RunAssetDiscovery", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.RunAssetDiscovery", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_SetFindingState_async", - "title": "SecurityCenter setFindingState Sample", - "origin": "API_DEFINITION", - "description": " Updates the state of a finding.", - "canonical": true, - "file": "security_center.set_finding_state.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetFindingState", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetFindingState", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "state", - "type": ".google.cloud.securitycenter.v1p1beta1.Finding.State" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "SetFindingState", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetFindingState", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_SetIamPolicy_async", - "title": "SecurityCenter setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy on the specified Source.", - "canonical": true, - "file": "security_center.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.SetIamPolicy", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_TestIamPermissions_async", - "title": "SecurityCenter testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns the permissions that a caller has on the specified source.", - "canonical": true, - "file": "security_center.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.TestIamPermissions", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateFinding_async", - "title": "SecurityCenter updateFinding Sample", - "origin": "API_DEFINITION", - "description": " Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.", - "canonical": true, - "file": "security_center.update_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFinding", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateFinding", - "async": true, - "parameters": [ - { - "name": "finding", - "type": ".google.cloud.securitycenter.v1p1beta1.Finding" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.Finding", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateFinding", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateFinding", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateNotificationConfig_async", - "title": "SecurityCenter updateNotificationConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a notification config. The following update fields are allowed: description, pubsub_topic, streaming_config.filter", - "canonical": true, - "file": "security_center.update_notification_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateNotificationConfig", - "async": true, - "parameters": [ - { - "name": "notification_config", - "type": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.NotificationConfig", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateNotificationConfig", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateNotificationConfig", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateOrganizationSettings_async", - "title": "SecurityCenter updateOrganizationSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates an organization's settings.", - "canonical": true, - "file": "security_center.update_organization_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateOrganizationSettings", - "async": true, - "parameters": [ - { - "name": "organization_settings", - "type": ".google.cloud.securitycenter.v1p1beta1.OrganizationSettings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.OrganizationSettings", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateOrganizationSettings", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateOrganizationSettings", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSource_async", - "title": "SecurityCenter updateSource Sample", - "origin": "API_DEFINITION", - "description": " Updates a source.", - "canonical": true, - "file": "security_center.update_source.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSource", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSource", - "async": true, - "parameters": [ - { - "name": "source", - "type": ".google.cloud.securitycenter.v1p1beta1.Source" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.Source", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateSource", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSource", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - }, - { - "regionTag": "securitycenter_v1p1beta1_generated_SecurityCenter_UpdateSecurityMarks_async", - "title": "SecurityCenter updateSecurityMarks Sample", - "origin": "API_DEFINITION", - "description": " Updates security marks.", - "canonical": true, - "file": "security_center.update_security_marks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSecurityMarks", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSecurityMarks", - "async": true, - "parameters": [ - { - "name": "security_marks", - "type": ".google.cloud.securitycenter.v1p1beta1.SecurityMarks" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.securitycenter.v1p1beta1.SecurityMarks", - "client": { - "shortName": "SecurityCenterClient", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenterClient" - }, - "method": { - "shortName": "UpdateSecurityMarks", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter.UpdateSecurityMarks", - "service": { - "shortName": "SecurityCenter", - "fullName": "google.cloud.securitycenter.v1p1beta1.SecurityCenter" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1p1beta1/src/index.ts b/owl-bot-staging/v1p1beta1/src/index.ts deleted file mode 100644 index d9e0d0aa..00000000 --- a/owl-bot-staging/v1p1beta1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1p1beta1 from './v1p1beta1'; -const 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 d7817680..00000000 --- a/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {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 0508bf06..00000000 --- a/owl-bot-staging/v1p1beta1/src/v1p1beta1/security_center_client.ts +++ /dev/null @@ -1,4928 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, 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`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 {google.protobuf.FieldMask} request.updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 { - if (this.securityCenterStub && !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 842e41d5..00000000 --- a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const 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 1e7b0783..00000000 --- a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {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 8ec45222..00000000 --- a/owl-bot-staging/v1p1beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts b/owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts deleted file mode 100644 index a9c27a39..00000000 --- a/owl-bot-staging/v1p1beta1/test/gapic_security_center_v1p1beta1.ts +++ /dev/null @@ -1,3971 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as 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 for the initialized client', done => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.securityCenterStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new securitycenterModule.v1p1beta1.SecurityCenterClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.securityCenterStub, undefined); - client.close().then(() => { - done(); - }); - }); - - 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)); - }); - - it('invokes createSource with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSource(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes createFinding with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createFinding(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes createNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createNotificationConfig(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes deleteNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteNotificationConfig(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes getIamPolicy with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes getNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getNotificationConfig(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes getOrganizationSettings with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getOrganizationSettings(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes getSource with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSource(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes setFindingState with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setFindingState(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes setIamPolicy with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes testIamPermissions with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateFinding with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateFinding(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateNotificationConfig with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateNotificationConfig(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateOrganizationSettings with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateOrganizationSettings(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateSource with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSource(request), expectedError); - }); - }); - - 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)); - }); - - it('invokes updateSecurityMarks with closed client', 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 expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSecurityMarks(request), expectedError); - }); - }); - - 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/v1/access.proto b/protos/google/cloud/securitycenter/v1/access.proto index 85c8d729..e1b57247 100644 --- a/protos/google/cloud/securitycenter/v1/access.proto +++ b/protos/google/cloud/securitycenter/v1/access.proto @@ -16,11 +16,11 @@ syntax = "proto3"; package google.cloud.securitycenter.v1; +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 = "AccessProto"; 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"; diff --git a/protos/google/cloud/securitycenter/v1/bigquery_export.proto b/protos/google/cloud/securitycenter/v1/bigquery_export.proto index 51bf353b..850c66e5 100644 --- a/protos/google/cloud/securitycenter/v1/bigquery_export.proto +++ b/protos/google/cloud/securitycenter/v1/bigquery_export.proto @@ -81,21 +81,19 @@ message BigQueryExport { // Output only. The time at which the big query export was created. // This field is set by the server and will be ignored if provided on export // on creation. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The most recent time at which the big export was updated. // This field is set by the server and will be ignored if provided on export // creation or update. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. Email address of the user who last edited the big query - // export. This field is set by the server and will be ignored if provided on - // export creation or update. + // Output only. Email address of the user who last edited the big query export. + // This field is set by the server and will be ignored if provided on export + // creation or update. string most_recent_editor = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. The service account that needs permission to create table, - // upload data to the big query dataset. + // Output only. The service account that needs permission to create table, upload data to + // the big query dataset. string principal = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; } diff --git a/protos/google/cloud/securitycenter/v1/external_system.proto b/protos/google/cloud/securitycenter/v1/external_system.proto index 78a7d65f..8ba69813 100644 --- a/protos/google/cloud/securitycenter/v1/external_system.proto +++ b/protos/google/cloud/securitycenter/v1/external_system.proto @@ -37,7 +37,8 @@ message ExternalSystem { }; // External System Name e.g. jira, demisto, etc. - // e.g.: `organizations/1234/sources/5678/findings/123456/externalSystems/jira` + // e.g.: + // `organizations/1234/sources/5678/findings/123456/externalSystems/jira` // `folders/1234/sources/5678/findings/123456/externalSystems/jira` // `projects/1234/sources/5678/findings/123456/externalSystems/jira` string name = 1; diff --git a/protos/google/cloud/securitycenter/v1/finding.proto b/protos/google/cloud/securitycenter/v1/finding.proto index 105b4d04..c3154ae1 100644 --- a/protos/google/cloud/securitycenter/v1/finding.proto +++ b/protos/google/cloud/securitycenter/v1/finding.proto @@ -20,6 +20,7 @@ import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/securitycenter/v1/access.proto"; import "google/cloud/securitycenter/v1/external_system.proto"; +import "google/cloud/securitycenter/v1/iam_binding.proto"; import "google/cloud/securitycenter/v1/indicator.proto"; import "google/cloud/securitycenter/v1/mitre_attack.proto"; import "google/cloud/securitycenter/v1/security_marks.proto"; @@ -110,7 +111,7 @@ message Finding { MEDIUM = 3; // Vulnerability: - // A low risk vulnerability hampers a security organization’s ability to + // 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. @@ -228,7 +229,7 @@ message Finding { // finding. string canonical_name = 14; - // Indicates the mute state of a finding (either unspecified, muted, unmuted + // Indicates the mute state of a finding (either muted, unmuted // or undefined). Unlike other attributes of a finding, a finding provider // shouldn't set the value of mute. Mute mute = 15; @@ -249,13 +250,11 @@ message Finding { Vulnerability vulnerability = 20; // Output only. The most recent time this finding was muted or unmuted. - google.protobuf.Timestamp mute_update_time = 21 - [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp mute_update_time = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. Third party SIEM/SOAR fields within SCC, contains external - // system information and external system finding fields. - map external_systems = 22 - [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. Third party SIEM/SOAR fields within SCC, contains external system + // information and external system finding fields. + map external_systems = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; // MITRE ATT&CK tactics and techniques related to this finding. // See: https://attack.mitre.org @@ -270,4 +269,7 @@ message Finding { // finding, etc. Unlike other attributes of a finding, a finding provider // shouldn't set the value of mute. string mute_initiator = 28; + + // Represents IAM bindings associated with the Finding. + repeated IamBinding iam_bindings = 39; } diff --git a/owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/iam_binding.proto b/protos/google/cloud/securitycenter/v1/iam_binding.proto similarity index 100% rename from owl-bot-staging/v1/protos/google/cloud/securitycenter/v1/iam_binding.proto rename to protos/google/cloud/securitycenter/v1/iam_binding.proto diff --git a/protos/google/cloud/securitycenter/v1/indicator.proto b/protos/google/cloud/securitycenter/v1/indicator.proto index 067ddb16..92234776 100644 --- a/protos/google/cloud/securitycenter/v1/indicator.proto +++ b/protos/google/cloud/securitycenter/v1/indicator.proto @@ -16,15 +16,14 @@ syntax = "proto3"; package google.cloud.securitycenter.v1; +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 = "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. diff --git a/protos/google/cloud/securitycenter/v1/mitre_attack.proto b/protos/google/cloud/securitycenter/v1/mitre_attack.proto index 03767cac..547f6f69 100644 --- a/protos/google/cloud/securitycenter/v1/mitre_attack.proto +++ b/protos/google/cloud/securitycenter/v1/mitre_attack.proto @@ -78,6 +78,7 @@ message MitreAttack { // MITRE ATT&CK techniques that can be referenced by SCC findings. // See: https://attack.mitre.org/techniques/enterprise/ + // Next ID: 30 enum Technique { // Unspecified value. TECHNIQUE_UNSPECIFIED = 0; @@ -165,6 +166,9 @@ message MitreAttack { // T1556 MODIFY_AUTHENTICATION_PROCESS = 28; + + // T1485 + DATA_DESTRUCTION = 29; } // The MITRE ATT&CK tactic most closely represented by this finding, if any. diff --git a/protos/google/cloud/securitycenter/v1/resource.proto b/protos/google/cloud/securitycenter/v1/resource.proto index 46b8372f..ab241d8b 100644 --- a/protos/google/cloud/securitycenter/v1/resource.proto +++ b/protos/google/cloud/securitycenter/v1/resource.proto @@ -33,10 +33,16 @@ message Resource { // https://cloud.google.com/apis/design/resource_names#full_resource_name string name = 1; + // The human readable name of the resource. + string display_name = 8; + + // The full resource type of the resource. + string type = 6; + // The full resource name of project that the resource belongs to. string project = 2; - // The project id that the resource belongs to. + // The project ID that the resource belongs to. string project_display_name = 3; // The full resource name of resource's parent. @@ -45,14 +51,8 @@ message Resource { // 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/protos/google/cloud/securitycenter/v1/securitycenter_service.proto b/protos/google/cloud/securitycenter/v1/securitycenter_service.proto index 99aa8ada..a95f5c03 100644 --- a/protos/google/cloud/securitycenter/v1/securitycenter_service.proto +++ b/protos/google/cloud/securitycenter/v1/securitycenter_service.proto @@ -1574,10 +1574,16 @@ message ListFindingsResponse { // https://cloud.google.com/apis/design/resource_names#full_resource_name string name = 1; + // The human readable name of the resource. + string display_name = 8; + + // The full resource type of the resource. + string type = 6; + // The full resource name of project that the resource belongs to. string project_name = 2; - // The project id that the resource belongs to. + // The project ID that the resource belongs to. string project_display_name = 3; // The full resource name of resource's parent. @@ -1586,16 +1592,10 @@ message ListFindingsResponse { // 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; } // Finding matching the search request. @@ -1765,7 +1765,7 @@ message UpdateSecurityMarksRequest { // 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. Must be - // smaller or equal to the server time. + // earlier or equal to the server time. google.protobuf.Timestamp start_time = 3; } diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 3848123a..47725c3e 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -1108,6 +1108,9 @@ export namespace google { /** Finding muteInitiator */ muteInitiator?: (string|null); + + /** Finding iamBindings */ + iamBindings?: (google.cloud.securitycenter.v1.IIamBinding[]|null); } /** Represents a Finding. */ @@ -1182,6 +1185,9 @@ export namespace google { /** Finding muteInitiator. */ public muteInitiator: string; + /** Finding iamBindings. */ + public iamBindings: google.cloud.securitycenter.v1.IIamBinding[]; + /** * Creates a new Finding instance using the specified properties. * @param [properties] Properties to set @@ -1290,6 +1296,118 @@ export namespace google { } } + /** Properties of an IamBinding. */ + interface IIamBinding { + + /** IamBinding action */ + action?: (google.cloud.securitycenter.v1.IamBinding.Action|keyof typeof google.cloud.securitycenter.v1.IamBinding.Action|null); + + /** IamBinding role */ + role?: (string|null); + + /** IamBinding member */ + member?: (string|null); + } + + /** Represents an IamBinding. */ + class IamBinding implements IIamBinding { + + /** + * Constructs a new IamBinding. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.securitycenter.v1.IIamBinding); + + /** IamBinding action. */ + public action: (google.cloud.securitycenter.v1.IamBinding.Action|keyof typeof google.cloud.securitycenter.v1.IamBinding.Action); + + /** IamBinding role. */ + public role: string; + + /** IamBinding member. */ + public member: string; + + /** + * Creates a new IamBinding instance using the specified properties. + * @param [properties] Properties to set + * @returns IamBinding instance + */ + public static create(properties?: google.cloud.securitycenter.v1.IIamBinding): google.cloud.securitycenter.v1.IamBinding; + + /** + * Encodes the specified IamBinding message. Does not implicitly {@link google.cloud.securitycenter.v1.IamBinding.verify|verify} messages. + * @param message IamBinding message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.securitycenter.v1.IIamBinding, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IamBinding message, length delimited. Does not implicitly {@link google.cloud.securitycenter.v1.IamBinding.verify|verify} messages. + * @param message IamBinding message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.securitycenter.v1.IIamBinding, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IamBinding message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IamBinding + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.securitycenter.v1.IamBinding; + + /** + * Decodes an IamBinding message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IamBinding + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.securitycenter.v1.IamBinding; + + /** + * Verifies an IamBinding message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IamBinding message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IamBinding + */ + public static fromObject(object: { [k: string]: any }): google.cloud.securitycenter.v1.IamBinding; + + /** + * Creates a plain object from an IamBinding message. Also converts values to other types if specified. + * @param message IamBinding + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.securitycenter.v1.IamBinding, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IamBinding to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace IamBinding { + + /** Action enum. */ + enum Action { + ACTION_UNSPECIFIED = 0, + ADD = 1, + REMOVE = 2 + } + } + /** Properties of an Indicator. */ interface IIndicator { @@ -1551,7 +1669,8 @@ export namespace google { STEAL_WEB_SESSION_COOKIE = 25, MODIFY_CLOUD_COMPUTE_INFRASTRUCTURE = 26, EXPLOIT_PUBLIC_FACING_APPLICATION = 27, - MODIFY_AUTHENTICATION_PROCESS = 28 + MODIFY_AUTHENTICATION_PROCESS = 28, + DATA_DESTRUCTION = 29 } } @@ -2483,6 +2602,12 @@ export namespace google { /** Resource name */ name?: (string|null); + /** Resource displayName */ + displayName?: (string|null); + + /** Resource type */ + type?: (string|null); + /** Resource project */ project?: (string|null); @@ -2495,14 +2620,8 @@ export namespace google { /** Resource parentDisplayName */ parentDisplayName?: (string|null); - /** Resource type */ - type?: (string|null); - /** Resource folders */ folders?: (google.cloud.securitycenter.v1.IFolder[]|null); - - /** Resource displayName */ - displayName?: (string|null); } /** Represents a Resource. */ @@ -2517,6 +2636,12 @@ export namespace google { /** Resource name. */ public name: string; + /** Resource displayName. */ + public displayName: string; + + /** Resource type. */ + public type: string; + /** Resource project. */ public project: string; @@ -2529,15 +2654,9 @@ export namespace google { /** Resource parentDisplayName. */ public parentDisplayName: string; - /** Resource type. */ - public type: string; - /** Resource folders. */ public folders: google.cloud.securitycenter.v1.IFolder[]; - /** Resource displayName. */ - public displayName: string; - /** * Creates a new Resource instance using the specified properties. * @param [properties] Properties to set @@ -6800,6 +6919,12 @@ export namespace google { /** Resource name */ name?: (string|null); + /** Resource displayName */ + displayName?: (string|null); + + /** Resource type */ + type?: (string|null); + /** Resource projectName */ projectName?: (string|null); @@ -6812,14 +6937,8 @@ export namespace google { /** Resource parentDisplayName */ parentDisplayName?: (string|null); - /** Resource type */ - type?: (string|null); - /** Resource folders */ folders?: (google.cloud.securitycenter.v1.IFolder[]|null); - - /** Resource displayName */ - displayName?: (string|null); } /** Represents a Resource. */ @@ -6834,6 +6953,12 @@ export namespace google { /** Resource name. */ public name: string; + /** Resource displayName. */ + public displayName: string; + + /** Resource type. */ + public type: string; + /** Resource projectName. */ public projectName: string; @@ -6846,15 +6971,9 @@ export namespace google { /** Resource parentDisplayName. */ public parentDisplayName: string; - /** Resource type. */ - public type: string; - /** Resource folders. */ public folders: google.cloud.securitycenter.v1.IFolder[]; - /** Resource displayName. */ - public displayName: string; - /** * Creates a new Resource instance using the specified properties. * @param [properties] Properties to set diff --git a/protos/protos.js b/protos/protos.js index bd202f7f..93a50762 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -2711,6 +2711,7 @@ * @property {google.cloud.securitycenter.v1.IMitreAttack|null} [mitreAttack] Finding mitreAttack * @property {google.cloud.securitycenter.v1.IAccess|null} [access] Finding access * @property {string|null} [muteInitiator] Finding muteInitiator + * @property {Array.|null} [iamBindings] Finding iamBindings */ /** @@ -2724,6 +2725,7 @@ function Finding(properties) { this.sourceProperties = {}; this.externalSystems = {}; + this.iamBindings = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2898,6 +2900,14 @@ */ Finding.prototype.muteInitiator = ""; + /** + * Finding iamBindings. + * @member {Array.} iamBindings + * @memberof google.cloud.securitycenter.v1.Finding + * @instance + */ + Finding.prototype.iamBindings = $util.emptyArray; + /** * Creates a new Finding instance using the specified properties. * @function create @@ -2970,6 +2980,9 @@ $root.google.cloud.securitycenter.v1.Access.encode(message.access, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); if (message.muteInitiator != null && Object.hasOwnProperty.call(message, "muteInitiator")) writer.uint32(/* id 28, wireType 2 =*/226).string(message.muteInitiator); + if (message.iamBindings != null && message.iamBindings.length) + for (var i = 0; i < message.iamBindings.length; ++i) + $root.google.cloud.securitycenter.v1.IamBinding.encode(message.iamBindings[i], writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); return writer; }; @@ -3105,6 +3118,11 @@ case 28: message.muteInitiator = reader.string(); break; + case 39: + if (!(message.iamBindings && message.iamBindings.length)) + message.iamBindings = []; + message.iamBindings.push($root.google.cloud.securitycenter.v1.IamBinding.decode(reader, reader.uint32())); + break; default: reader.skipType(tag & 7); break; @@ -3263,6 +3281,15 @@ if (message.muteInitiator != null && message.hasOwnProperty("muteInitiator")) if (!$util.isString(message.muteInitiator)) return "muteInitiator: string expected"; + if (message.iamBindings != null && message.hasOwnProperty("iamBindings")) { + if (!Array.isArray(message.iamBindings)) + return "iamBindings: array expected"; + for (var i = 0; i < message.iamBindings.length; ++i) { + var error = $root.google.cloud.securitycenter.v1.IamBinding.verify(message.iamBindings[i]); + if (error) + return "iamBindings." + error; + } + } return null; }; @@ -3432,6 +3459,16 @@ } if (object.muteInitiator != null) message.muteInitiator = String(object.muteInitiator); + if (object.iamBindings) { + if (!Array.isArray(object.iamBindings)) + throw TypeError(".google.cloud.securitycenter.v1.Finding.iamBindings: array expected"); + message.iamBindings = []; + for (var i = 0; i < object.iamBindings.length; ++i) { + if (typeof object.iamBindings[i] !== "object") + throw TypeError(".google.cloud.securitycenter.v1.Finding.iamBindings: object expected"); + message.iamBindings[i] = $root.google.cloud.securitycenter.v1.IamBinding.fromObject(object.iamBindings[i]); + } + } return message; }; @@ -3448,6 +3485,8 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.iamBindings = []; if (options.objects || options.defaults) { object.sourceProperties = {}; object.externalSystems = {}; @@ -3522,6 +3561,11 @@ object.access = $root.google.cloud.securitycenter.v1.Access.toObject(message.access, options); if (message.muteInitiator != null && message.hasOwnProperty("muteInitiator")) object.muteInitiator = message.muteInitiator; + if (message.iamBindings && message.iamBindings.length) { + object.iamBindings = []; + for (var j = 0; j < message.iamBindings.length; ++j) + object.iamBindings[j] = $root.google.cloud.securitycenter.v1.IamBinding.toObject(message.iamBindings[j], options); + } return object; }; @@ -3615,6 +3659,272 @@ return Finding; })(); + v1.IamBinding = (function() { + + /** + * Properties of an IamBinding. + * @memberof google.cloud.securitycenter.v1 + * @interface IIamBinding + * @property {google.cloud.securitycenter.v1.IamBinding.Action|null} [action] IamBinding action + * @property {string|null} [role] IamBinding role + * @property {string|null} [member] IamBinding member + */ + + /** + * Constructs a new IamBinding. + * @memberof google.cloud.securitycenter.v1 + * @classdesc Represents an IamBinding. + * @implements IIamBinding + * @constructor + * @param {google.cloud.securitycenter.v1.IIamBinding=} [properties] Properties to set + */ + function IamBinding(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IamBinding action. + * @member {google.cloud.securitycenter.v1.IamBinding.Action} action + * @memberof google.cloud.securitycenter.v1.IamBinding + * @instance + */ + IamBinding.prototype.action = 0; + + /** + * IamBinding role. + * @member {string} role + * @memberof google.cloud.securitycenter.v1.IamBinding + * @instance + */ + IamBinding.prototype.role = ""; + + /** + * IamBinding member. + * @member {string} member + * @memberof google.cloud.securitycenter.v1.IamBinding + * @instance + */ + IamBinding.prototype.member = ""; + + /** + * Creates a new IamBinding instance using the specified properties. + * @function create + * @memberof google.cloud.securitycenter.v1.IamBinding + * @static + * @param {google.cloud.securitycenter.v1.IIamBinding=} [properties] Properties to set + * @returns {google.cloud.securitycenter.v1.IamBinding} IamBinding instance + */ + IamBinding.create = function create(properties) { + return new IamBinding(properties); + }; + + /** + * Encodes the specified IamBinding message. Does not implicitly {@link google.cloud.securitycenter.v1.IamBinding.verify|verify} messages. + * @function encode + * @memberof google.cloud.securitycenter.v1.IamBinding + * @static + * @param {google.cloud.securitycenter.v1.IIamBinding} message IamBinding message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IamBinding.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.action != null && Object.hasOwnProperty.call(message, "action")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.action); + if (message.role != null && Object.hasOwnProperty.call(message, "role")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.role); + if (message.member != null && Object.hasOwnProperty.call(message, "member")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.member); + return writer; + }; + + /** + * Encodes the specified IamBinding message, length delimited. Does not implicitly {@link google.cloud.securitycenter.v1.IamBinding.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.securitycenter.v1.IamBinding + * @static + * @param {google.cloud.securitycenter.v1.IIamBinding} message IamBinding message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IamBinding.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IamBinding message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.securitycenter.v1.IamBinding + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.securitycenter.v1.IamBinding} IamBinding + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IamBinding.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.securitycenter.v1.IamBinding(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.action = reader.int32(); + break; + case 2: + message.role = reader.string(); + break; + case 3: + message.member = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IamBinding message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.securitycenter.v1.IamBinding + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.securitycenter.v1.IamBinding} IamBinding + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IamBinding.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IamBinding message. + * @function verify + * @memberof google.cloud.securitycenter.v1.IamBinding + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IamBinding.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.action != null && message.hasOwnProperty("action")) + switch (message.action) { + default: + return "action: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.role != null && message.hasOwnProperty("role")) + if (!$util.isString(message.role)) + return "role: string expected"; + if (message.member != null && message.hasOwnProperty("member")) + if (!$util.isString(message.member)) + return "member: string expected"; + return null; + }; + + /** + * Creates an IamBinding message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.securitycenter.v1.IamBinding + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.securitycenter.v1.IamBinding} IamBinding + */ + IamBinding.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.securitycenter.v1.IamBinding) + return object; + var message = new $root.google.cloud.securitycenter.v1.IamBinding(); + switch (object.action) { + case "ACTION_UNSPECIFIED": + case 0: + message.action = 0; + break; + case "ADD": + case 1: + message.action = 1; + break; + case "REMOVE": + case 2: + message.action = 2; + break; + } + if (object.role != null) + message.role = String(object.role); + if (object.member != null) + message.member = String(object.member); + return message; + }; + + /** + * Creates a plain object from an IamBinding message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.securitycenter.v1.IamBinding + * @static + * @param {google.cloud.securitycenter.v1.IamBinding} message IamBinding + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IamBinding.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.action = options.enums === String ? "ACTION_UNSPECIFIED" : 0; + object.role = ""; + object.member = ""; + } + if (message.action != null && message.hasOwnProperty("action")) + object.action = options.enums === String ? $root.google.cloud.securitycenter.v1.IamBinding.Action[message.action] : message.action; + if (message.role != null && message.hasOwnProperty("role")) + object.role = message.role; + if (message.member != null && message.hasOwnProperty("member")) + object.member = message.member; + return object; + }; + + /** + * Converts this IamBinding to JSON. + * @function toJSON + * @memberof google.cloud.securitycenter.v1.IamBinding + * @instance + * @returns {Object.} JSON object + */ + IamBinding.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Action enum. + * @name google.cloud.securitycenter.v1.IamBinding.Action + * @enum {number} + * @property {number} ACTION_UNSPECIFIED=0 ACTION_UNSPECIFIED value + * @property {number} ADD=1 ADD value + * @property {number} REMOVE=2 REMOVE value + */ + IamBinding.Action = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ACTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "ADD"] = 1; + values[valuesById[2] = "REMOVE"] = 2; + return values; + })(); + + return IamBinding; + })(); + v1.Indicator = (function() { /** @@ -4136,6 +4446,7 @@ case 26: case 27: case 28: + case 29: break; } } @@ -4200,6 +4511,7 @@ case 26: case 27: case 28: + case 29: break; } } @@ -4406,6 +4718,10 @@ case 28: message.primaryTechniques[i] = 28; break; + case "DATA_DESTRUCTION": + case 29: + message.primaryTechniques[i] = 29; + break; } } if (object.additionalTactics) { @@ -4600,6 +4916,10 @@ case 28: message.additionalTechniques[i] = 28; break; + case "DATA_DESTRUCTION": + case 29: + message.additionalTechniques[i] = 29; + break; } } if (object.version != null) @@ -4735,6 +5055,7 @@ * @property {number} MODIFY_CLOUD_COMPUTE_INFRASTRUCTURE=26 MODIFY_CLOUD_COMPUTE_INFRASTRUCTURE value * @property {number} EXPLOIT_PUBLIC_FACING_APPLICATION=27 EXPLOIT_PUBLIC_FACING_APPLICATION value * @property {number} MODIFY_AUTHENTICATION_PROCESS=28 MODIFY_AUTHENTICATION_PROCESS value + * @property {number} DATA_DESTRUCTION=29 DATA_DESTRUCTION value */ MitreAttack.Technique = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -4767,6 +5088,7 @@ values[valuesById[26] = "MODIFY_CLOUD_COMPUTE_INFRASTRUCTURE"] = 26; values[valuesById[27] = "EXPLOIT_PUBLIC_FACING_APPLICATION"] = 27; values[valuesById[28] = "MODIFY_AUTHENTICATION_PROCESS"] = 28; + values[valuesById[29] = "DATA_DESTRUCTION"] = 29; return values; })(); @@ -7185,13 +7507,13 @@ * @memberof google.cloud.securitycenter.v1 * @interface IResource * @property {string|null} [name] Resource name + * @property {string|null} [displayName] Resource displayName + * @property {string|null} [type] Resource type * @property {string|null} [project] Resource project * @property {string|null} [projectDisplayName] Resource projectDisplayName * @property {string|null} [parent] Resource parent * @property {string|null} [parentDisplayName] Resource parentDisplayName - * @property {string|null} [type] Resource type * @property {Array.|null} [folders] Resource folders - * @property {string|null} [displayName] Resource displayName */ /** @@ -7218,6 +7540,22 @@ */ Resource.prototype.name = ""; + /** + * Resource displayName. + * @member {string} displayName + * @memberof google.cloud.securitycenter.v1.Resource + * @instance + */ + Resource.prototype.displayName = ""; + + /** + * Resource type. + * @member {string} type + * @memberof google.cloud.securitycenter.v1.Resource + * @instance + */ + Resource.prototype.type = ""; + /** * Resource project. * @member {string} project @@ -7250,14 +7588,6 @@ */ Resource.prototype.parentDisplayName = ""; - /** - * Resource type. - * @member {string} type - * @memberof google.cloud.securitycenter.v1.Resource - * @instance - */ - Resource.prototype.type = ""; - /** * Resource folders. * @member {Array.} folders @@ -7266,14 +7596,6 @@ */ Resource.prototype.folders = $util.emptyArray; - /** - * Resource displayName. - * @member {string} displayName - * @memberof google.cloud.securitycenter.v1.Resource - * @instance - */ - Resource.prototype.displayName = ""; - /** * Creates a new Resource instance using the specified properties. * @function create @@ -7352,6 +7674,12 @@ case 1: message.name = reader.string(); break; + case 8: + message.displayName = reader.string(); + break; + case 6: + message.type = reader.string(); + break; case 2: message.project = reader.string(); break; @@ -7364,17 +7692,11 @@ case 5: message.parentDisplayName = reader.string(); break; - case 6: - message.type = reader.string(); - break; case 7: if (!(message.folders && message.folders.length)) message.folders = []; message.folders.push($root.google.cloud.securitycenter.v1.Folder.decode(reader, reader.uint32())); break; - case 8: - message.displayName = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -7413,6 +7735,12 @@ if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; if (message.project != null && message.hasOwnProperty("project")) if (!$util.isString(message.project)) return "project: string expected"; @@ -7425,9 +7753,6 @@ if (message.parentDisplayName != null && message.hasOwnProperty("parentDisplayName")) if (!$util.isString(message.parentDisplayName)) return "parentDisplayName: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; if (message.folders != null && message.hasOwnProperty("folders")) { if (!Array.isArray(message.folders)) return "folders: array expected"; @@ -7437,9 +7762,6 @@ return "folders." + error; } } - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; return null; }; @@ -7457,6 +7779,10 @@ var message = new $root.google.cloud.securitycenter.v1.Resource(); if (object.name != null) message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.type != null) + message.type = String(object.type); if (object.project != null) message.project = String(object.project); if (object.projectDisplayName != null) @@ -7465,8 +7791,6 @@ message.parent = String(object.parent); if (object.parentDisplayName != null) message.parentDisplayName = String(object.parentDisplayName); - if (object.type != null) - message.type = String(object.type); if (object.folders) { if (!Array.isArray(object.folders)) throw TypeError(".google.cloud.securitycenter.v1.Resource.folders: array expected"); @@ -7477,8 +7801,6 @@ message.folders[i] = $root.google.cloud.securitycenter.v1.Folder.fromObject(object.folders[i]); } } - if (object.displayName != null) - message.displayName = String(object.displayName); return message; }; @@ -16884,13 +17206,13 @@ * @memberof google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult * @interface IResource * @property {string|null} [name] Resource name + * @property {string|null} [displayName] Resource displayName + * @property {string|null} [type] Resource type * @property {string|null} [projectName] Resource projectName * @property {string|null} [projectDisplayName] Resource projectDisplayName * @property {string|null} [parentName] Resource parentName * @property {string|null} [parentDisplayName] Resource parentDisplayName - * @property {string|null} [type] Resource type * @property {Array.|null} [folders] Resource folders - * @property {string|null} [displayName] Resource displayName */ /** @@ -16917,6 +17239,22 @@ */ Resource.prototype.name = ""; + /** + * Resource displayName. + * @member {string} displayName + * @memberof google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult.Resource + * @instance + */ + Resource.prototype.displayName = ""; + + /** + * Resource type. + * @member {string} type + * @memberof google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult.Resource + * @instance + */ + Resource.prototype.type = ""; + /** * Resource projectName. * @member {string} projectName @@ -16949,14 +17287,6 @@ */ Resource.prototype.parentDisplayName = ""; - /** - * Resource type. - * @member {string} type - * @memberof google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult.Resource - * @instance - */ - Resource.prototype.type = ""; - /** * Resource folders. * @member {Array.} folders @@ -16965,14 +17295,6 @@ */ Resource.prototype.folders = $util.emptyArray; - /** - * Resource displayName. - * @member {string} displayName - * @memberof google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult.Resource - * @instance - */ - Resource.prototype.displayName = ""; - /** * Creates a new Resource instance using the specified properties. * @function create @@ -17051,6 +17373,12 @@ case 1: message.name = reader.string(); break; + case 8: + message.displayName = reader.string(); + break; + case 6: + message.type = reader.string(); + break; case 2: message.projectName = reader.string(); break; @@ -17063,17 +17391,11 @@ case 5: message.parentDisplayName = reader.string(); break; - case 6: - message.type = reader.string(); - break; case 7: if (!(message.folders && message.folders.length)) message.folders = []; message.folders.push($root.google.cloud.securitycenter.v1.Folder.decode(reader, reader.uint32())); break; - case 8: - message.displayName = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -17112,6 +17434,12 @@ if (message.name != null && message.hasOwnProperty("name")) if (!$util.isString(message.name)) return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; if (message.projectName != null && message.hasOwnProperty("projectName")) if (!$util.isString(message.projectName)) return "projectName: string expected"; @@ -17124,9 +17452,6 @@ if (message.parentDisplayName != null && message.hasOwnProperty("parentDisplayName")) if (!$util.isString(message.parentDisplayName)) return "parentDisplayName: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; if (message.folders != null && message.hasOwnProperty("folders")) { if (!Array.isArray(message.folders)) return "folders: array expected"; @@ -17136,9 +17461,6 @@ return "folders." + error; } } - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; return null; }; @@ -17156,6 +17478,10 @@ var message = new $root.google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult.Resource(); if (object.name != null) message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.type != null) + message.type = String(object.type); if (object.projectName != null) message.projectName = String(object.projectName); if (object.projectDisplayName != null) @@ -17164,8 +17490,6 @@ message.parentName = String(object.parentName); if (object.parentDisplayName != null) message.parentDisplayName = String(object.parentDisplayName); - if (object.type != null) - message.type = String(object.type); if (object.folders) { if (!Array.isArray(object.folders)) throw TypeError(".google.cloud.securitycenter.v1.ListFindingsResponse.ListFindingsResult.Resource.folders: array expected"); @@ -17176,8 +17500,6 @@ message.folders[i] = $root.google.cloud.securitycenter.v1.Folder.fromObject(object.folders[i]); } } - if (object.displayName != null) - message.displayName = String(object.displayName); return message; }; diff --git a/protos/protos.json b/protos/protos.json index fa20a22b..0f008793 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -8,11 +8,11 @@ "nested": { "v1": { "options": { + "csharp_namespace": "Google.Cloud.SecurityCenter.V1", "go_package": "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter", "java_multiple_files": true, "java_outer_classname": "ResourceProto", "java_package": "com.google.cloud.securitycenter.v1", - "csharp_namespace": "Google.Cloud.SecurityCenter.V1", "php_namespace": "Google\\Cloud\\SecurityCenter\\V1", "ruby_package": "Google::Cloud::SecurityCenter::V1", "(google.api.resource_definition).type": "pubsub.googleapis.com/Topic", @@ -362,6 +362,11 @@ "muteInitiator": { "type": "string", "id": 28 + }, + "iamBindings": { + "rule": "repeated", + "type": "IamBinding", + "id": 39 } }, "nested": { @@ -401,6 +406,31 @@ } } }, + "IamBinding": { + "fields": { + "action": { + "type": "Action", + "id": 1 + }, + "role": { + "type": "string", + "id": 2 + }, + "member": { + "type": "string", + "id": 3 + } + }, + "nested": { + "Action": { + "values": { + "ACTION_UNSPECIFIED": 0, + "ADD": 1, + "REMOVE": 2 + } + } + } + }, "Indicator": { "fields": { "ipAddresses": { @@ -491,7 +521,8 @@ "STEAL_WEB_SESSION_COOKIE": 25, "MODIFY_CLOUD_COMPUTE_INFRASTRUCTURE": 26, "EXPLOIT_PUBLIC_FACING_APPLICATION": 27, - "MODIFY_AUTHENTICATION_PROCESS": 28 + "MODIFY_AUTHENTICATION_PROCESS": 28, + "DATA_DESTRUCTION": 29 } } } @@ -756,6 +787,14 @@ "type": "string", "id": 1 }, + "displayName": { + "type": "string", + "id": 8 + }, + "type": { + "type": "string", + "id": 6 + }, "project": { "type": "string", "id": 2 @@ -772,10 +811,6 @@ "type": "string", "id": 5 }, - "type": { - "type": "string", - "id": 6 - }, "folders": { "rule": "repeated", "type": "Folder", @@ -783,10 +818,6 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } - }, - "displayName": { - "type": "string", - "id": 8 } } }, @@ -2430,6 +2461,14 @@ "type": "string", "id": 1 }, + "displayName": { + "type": "string", + "id": 8 + }, + "type": { + "type": "string", + "id": 6 + }, "projectName": { "type": "string", "id": 2 @@ -2446,18 +2485,10 @@ "type": "string", "id": 5 }, - "type": { - "type": "string", - "id": 6 - }, "folders": { "rule": "repeated", "type": "Folder", "id": 7 - }, - "displayName": { - "type": "string", - "id": 8 } } } diff --git a/samples/generated/v1/security_center.update_security_marks.js b/samples/generated/v1/security_center.update_security_marks.js index 9827fb86..3f19fca7 100644 --- a/samples/generated/v1/security_center.update_security_marks.js +++ b/samples/generated/v1/security_center.update_security_marks.js @@ -40,7 +40,7 @@ function main(securityMarks) { * 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. Must be - * smaller or equal to the server time. + * earlier or equal to the server time. */ // const startTime = {} diff --git a/src/v1/security_center_client.ts b/src/v1/security_center_client.ts index 10ad8b68..85e45f8e 100644 --- a/src/v1/security_center_client.ts +++ b/src/v1/security_center_client.ts @@ -2702,7 +2702,7 @@ export class SecurityCenterClient { * 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. Must be - * smaller or equal to the server time. + * earlier or equal to the server 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. diff --git a/src/v1/security_center_proto_list.json b/src/v1/security_center_proto_list.json index 380ca1bb..db5193d0 100644 --- a/src/v1/security_center_proto_list.json +++ b/src/v1/security_center_proto_list.json @@ -5,6 +5,7 @@ "../../protos/google/cloud/securitycenter/v1/external_system.proto", "../../protos/google/cloud/securitycenter/v1/finding.proto", "../../protos/google/cloud/securitycenter/v1/folder.proto", + "../../protos/google/cloud/securitycenter/v1/iam_binding.proto", "../../protos/google/cloud/securitycenter/v1/indicator.proto", "../../protos/google/cloud/securitycenter/v1/mitre_attack.proto", "../../protos/google/cloud/securitycenter/v1/mute_config.proto",