diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 8bc1c6009f33..ac543d399eba 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1234,7 +1234,7 @@ packages: dependencies: '@azure/core-auth': 1.4.0 '@azure/core-client': 1.6.1 - '@azure/core-rest-pipeline': 1.9.2 + '@azure/core-rest-pipeline': 1.10.0 '@azure/core-tracing': 1.0.1 '@azure/logger': 1.0.3 tslib: 2.4.1 @@ -2130,6 +2130,7 @@ packages: /@sinonjs/commons/1.8.4: resolution: {integrity: sha512-RpmQdHVo8hCEHDVpO39zToS9jOhR6nw+/lQAzRNq9ErrGV9IeHM71XCn68svVl/euFeVW6BWX4p35gkhbOcSIQ==} + deprecated: Breaks compatibility with ES5, use v1.8.5 dependencies: type-detect: 4.0.8 dev: false @@ -2209,7 +2210,7 @@ packages: resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==} dependencies: '@types/connect': 3.4.35 - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/chai-as-promised/7.1.5: @@ -2231,7 +2232,7 @@ packages: /@types/connect/3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/cookie/0.4.1: @@ -2266,7 +2267,7 @@ packages: /@types/express-serve-static-core/4.17.31: resolution: {integrity: sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 '@types/qs': 6.9.7 '@types/range-parser': 1.2.4 dev: false @@ -2283,20 +2284,20 @@ packages: /@types/fs-extra/8.1.2: resolution: {integrity: sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/glob/7.2.0: resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} dependencies: '@types/minimatch': 5.1.2 - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/inquirer/8.2.4: @@ -2308,7 +2309,7 @@ packages: /@types/is-buffer/2.0.0: resolution: {integrity: sha512-0f7N/e3BAz32qDYvgB4d2cqv1DqUwvGxHkXsrucICn8la1Vb6Yl6Eg8mPScGwUiqHJeE7diXlzaK+QMA9m4Gxw==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/json-schema/7.0.11: @@ -2322,13 +2323,13 @@ packages: /@types/jsonwebtoken/8.5.9: resolution: {integrity: sha512-272FMnFGzAVMGtu9tkr29hRL6bZj4Zs1KZNeHLnKqAvp06tAIcarTMwOh8/8bz4FmKRcMxZhZNeUAQsNLoiPhg==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/jws/3.2.4: resolution: {integrity: sha512-aqtH4dPw1wUjFZaeMD1ak/pf8iXlu/odFe+trJrvw0g1sTh93i+SCykg0Ek8C6B7rVK3oBORbfZAsKO7P10etg==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/md5/2.3.2: @@ -2364,13 +2365,13 @@ packages: /@types/mock-fs/4.13.1: resolution: {integrity: sha512-m6nFAJ3lBSnqbvDZioawRvpLXSaPyn52Srf7OfzjubYbYX8MTUdIgDxQl0wEapm4m/pNYSd9TXocpQ0TvZFlYA==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/mock-require/2.0.1: resolution: {integrity: sha512-O7U5DVGboY/Crueb5/huUCIRjKtRVRaLmRDbZJBlDQgJn966z3aiFDN+6AtYviu2ExwMkl34LjT/IiC0OPtKuQ==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/ms/0.7.31: @@ -2388,7 +2389,7 @@ packages: /@types/node-fetch/2.6.2: resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 form-data: 3.0.1 dev: false @@ -2443,7 +2444,7 @@ packages: /@types/resolve/1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/semaphore/1.1.1: @@ -2454,7 +2455,7 @@ packages: resolution: {integrity: sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==} dependencies: '@types/mime': 3.0.1 - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/sinon/10.0.13: @@ -2476,13 +2477,13 @@ packages: /@types/stoppable/1.1.1: resolution: {integrity: sha512-b8N+fCADRIYYrGZOcmOR8ZNBOqhktWTB/bMUl5LvGtT201QKJZOOH5UsFyI3qtteM6ZAJbJqZoBcLqqxKIwjhw==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/through/0.0.30: resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/tough-cookie/4.0.2: @@ -2496,13 +2497,13 @@ packages: /@types/tunnel/0.0.1: resolution: {integrity: sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/tunnel/0.0.3: resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/underscore/1.11.4: @@ -2520,19 +2521,19 @@ packages: /@types/ws/7.4.7: resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/ws/8.5.3: resolution: {integrity: sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/xml2js/0.4.11: resolution: {integrity: sha512-JdigeAKmCyoJUiQljjr7tQG3if9NkqGUgwEUqBvV0N7LM4HyQk7UXCnusRa1lnvXAEYJ8mw8GtZWioagNztOwA==} dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false /@types/yargs-parser/21.0.0: @@ -2549,7 +2550,7 @@ packages: resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==} requiresBuild: true dependencies: - '@types/node': 14.18.33 + '@types/node': 18.11.9 dev: false optional: true @@ -3618,7 +3619,7 @@ packages: resolution: {integrity: sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==} deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) dependencies: - ms: 2.1.1 + ms: 2.1.3 dev: false /debug/3.2.7: @@ -3839,7 +3840,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 4.6.4 + typescript: 4.8.4 dev: false /ecdsa-sig-formatter/1.0.11: @@ -3890,7 +3891,7 @@ packages: dependencies: '@types/cookie': 0.4.1 '@types/cors': 2.8.12 - '@types/node': 14.18.33 + '@types/node': 18.11.9 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.4.2 @@ -4901,7 +4902,7 @@ packages: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.0.4 + minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 dev: false @@ -14335,7 +14336,7 @@ packages: dev: false file:projects/arm-security.tgz: - resolution: {integrity: sha512-/UbMfk2WVmA8zvVsvFzSxDSRCW4uyyXe6az1pJPOMpdsuJLsTwE9Vi3xrbBNva6+5RKwi73JppKH3H5UD9pFNA==, tarball: file:projects/arm-security.tgz} + resolution: {integrity: sha512-VEHphyt2xd+/r/JHQP/0tjrMUQKdcMYccID626Cg8KRbT6RLEHEX37pftbqVigpDsCNxdsE9mlcqnT1X2qgsJA==, tarball: file:projects/arm-security.tgz} name: '@rush-temp/arm-security' version: 0.0.0 dependencies: @@ -14346,18 +14347,18 @@ packages: '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 '@types/chai': 4.3.3 + '@types/node': 14.18.33 chai: 4.3.6 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 - rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.1 + rollup-plugin-sourcemaps: 0.6.3_1225c068d0546e507df7db46196a6444 tslib: 2.4.1 typescript: 4.6.4 uglify-js: 3.17.4 transitivePeerDependencies: - - '@types/node' - supports-color dev: false @@ -17240,7 +17241,7 @@ packages: dev: false file:projects/keyvault-admin.tgz: - resolution: {integrity: sha512-9AdSE6mAhgBug4+H/fztaInMQdm+ganESX31eqPsHje34Dm4hfo0Caa2ypdEBcTrUOIG99i6M5XUxrhWEb37mQ==, tarball: file:projects/keyvault-admin.tgz} + resolution: {integrity: sha512-hW9yN/ZH5rhLsDyngPRQEP2GwVprO95oKpLJoRjAxt+3g3s0liiCpNhsuvv1TkNM6sfzvAeZnENboeA/OtHO4g==, tarball: file:projects/keyvault-admin.tgz} name: '@rush-temp/keyvault-admin' version: 0.0.0 dependencies: @@ -18909,7 +18910,7 @@ packages: dev: false file:projects/storage-blob.tgz: - resolution: {integrity: sha512-s54hiuhDzRVOEjfW1UpeybQaGgyva8odSDGeX18mpsMrNykqgvv8QCKV2ZDIN2I1KL1GrldwJtJ/pSdSmx9qDA==, tarball: file:projects/storage-blob.tgz} + resolution: {integrity: sha512-gSRlGWebNmHQ0pm27D14SFCHKT2g6vgaRSwL/qho4Me/2wW2NJEG3WLOEq3G7LXivOUKhsHVug8sJlJVmtnOjA==, tarball: file:projects/storage-blob.tgz} name: '@rush-temp/storage-blob' version: 0.0.0 dependencies: diff --git a/sdk/security/arm-security/CHANGELOG.md b/sdk/security/arm-security/CHANGELOG.md index 57cda3d881dd..a8cf96a361be 100644 --- a/sdk/security/arm-security/CHANGELOG.md +++ b/sdk/security/arm-security/CHANGELOG.md @@ -1,16 +1,6 @@ # Release History - -## 6.0.0-beta.2 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 6.0.0-beta.1 (2022-09-14) + +## 6.0.0-beta.2 (2022-11-08) **Features** @@ -66,7 +56,7 @@ - Added Interface AutoProvisioningSetting - Added Interface AwAssumeRoleAuthenticationDetailsProperties - Added Interface AwsCredsAuthenticationDetailsProperties - - Added Interface AWSEnvironmentData + - Added Interface AwsEnvironmentData - Added Interface AwsOrganizationalData - Added Interface AwsOrganizationalDataMaster - Added Interface AwsOrganizationalDataMember @@ -91,9 +81,13 @@ - Added Interface CustomAssessmentAutomationRequest - Added Interface CustomEntityStoreAssignment - Added Interface DataExportSettings + - Added Interface DefenderCspmAwsOffering + - Added Interface DefenderCspmAwsOfferingVmScanners + - Added Interface DefenderCspmAwsOfferingVmScannersConfiguration + - Added Interface DefenderCspmGcpOffering - Added Interface DefenderFoDatabasesAwsOffering - Added Interface DefenderFoDatabasesAwsOfferingArcAutoProvisioning - - Added Interface DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata + - Added Interface DefenderFoDatabasesAwsOfferingRds - Added Interface DefenderForContainersAwsOffering - Added Interface DefenderForContainersAwsOfferingContainerVulnerabilityAssessment - Added Interface DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask @@ -102,8 +96,9 @@ - Added Interface DefenderForContainersGcpOfferingNativeCloudConnection - Added Interface DefenderForDatabasesGcpOffering - Added Interface DefenderForDatabasesGcpOfferingArcAutoProvisioning - - Added Interface DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration - Added Interface DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning + - Added Interface DefenderForDevOpsAzureDevOpsOffering + - Added Interface DefenderForDevOpsGithubOffering - Added Interface DefenderForServersAwsOffering - Added Interface DefenderForServersAwsOfferingMdeAutoProvisioning - Added Interface DefenderForServersAwsOfferingSubPlan @@ -113,7 +108,6 @@ - Added Interface DefenderForServersAwsOfferingVmScannersConfiguration - Added Interface DefenderForServersGcpOffering - Added Interface DefenderForServersGcpOfferingArcAutoProvisioning - - Added Interface DefenderForServersGcpOfferingArcAutoProvisioningConfiguration - Added Interface DefenderForServersGcpOfferingDefenderForServers - Added Interface DefenderForServersGcpOfferingMdeAutoProvisioning - Added Interface DefenderForServersGcpOfferingSubPlan @@ -240,6 +234,7 @@ - Added Type Alias ApplicationsListResponse - Added Type Alias ApplicationSourceResourceType - Added Type Alias AwsOrganizationalDataUnion + - Added Type Alias ConnectionType - Added Type Alias EnvironmentDataUnion - Added Type Alias EnvironmentType - Added Type Alias GcpOrganizationalDataUnion @@ -305,9 +300,13 @@ - Enum KnownOfferingType has a new value CspmMonitorAzureDevOps - Enum KnownOfferingType has a new value CspmMonitorGcp - Enum KnownOfferingType has a new value CspmMonitorGithub + - Enum KnownOfferingType has a new value DefenderCspmAws + - Enum KnownOfferingType has a new value DefenderCspmGcp - Enum KnownOfferingType has a new value DefenderForContainersGcp - Enum KnownOfferingType has a new value DefenderForDatabasesAws - Enum KnownOfferingType has a new value DefenderForDatabasesGcp + - Enum KnownOfferingType has a new value DefenderForDevOpsAzureDevOps + - Enum KnownOfferingType has a new value DefenderForDevOpsGithub - Enum KnownOfferingType has a new value DefenderForServersGcp - Enum KnownSettingName has a new value WdatpUnifiedSolution @@ -315,6 +314,8 @@ - Removed operation Alerts.simulate - Removed operation SecurityContacts.update + - Operation AllowedConnections.get has a new signature + - Interface DefenderForServersAwsOfferingArcAutoProvisioning no longer has parameter servicePrincipalSecretMetadata - Removed Enum KnownAlertNotifications - Removed Enum KnownAlertsToAdmins diff --git a/sdk/security/arm-security/README.md b/sdk/security/arm-security/README.md index bca29e8e2d37..c7e9e7c191b4 100644 --- a/sdk/security/arm-security/README.md +++ b/sdk/security/arm-security/README.md @@ -1,6 +1,6 @@ -# Azure Service client library for JavaScript +# Azure SecurityCenter client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Service client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure SecurityCenter client. API spec for Microsoft.Security (Azure Security Center) resource provider @@ -24,7 +24,7 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@azure/arm-security` package -Install the Azure Service client library for JavaScript with `npm`: +Install the Azure SecurityCenter client library for JavaScript with `npm`: ```bash npm install @azure/arm-security @@ -32,8 +32,8 @@ npm install @azure/arm-security ### Create and authenticate a `SecurityCenter` -To create a client object to access the Azure Service API, you will need the `endpoint` of your Azure Service resource and a `credential`. The Azure Service client can use Azure Active Directory credentials to authenticate. -You can find the endpoint for your Azure Service resource in the [Azure Portal][azure_portal]. +To create a client object to access the Azure SecurityCenter API, you will need the `endpoint` of your Azure SecurityCenter resource and a `credential`. The Azure SecurityCenter client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure SecurityCenter resource in the [Azure Portal][azure_portal]. You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). @@ -43,7 +43,7 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below npm install @azure/identity ``` -You will also need to **register a new AAD application and grant access to Azure Service** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +You will also need to **register a new AAD application and grant access to Azure SecurityCenter** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). @@ -72,7 +72,7 @@ To use this client library in the browser, first you need to use a bundler. For ### SecurityCenter -`SecurityCenter` is the primary interface for developers using the Azure Service client library. Explore the methods on this client object to understand the different features of the Azure Service service that you can access. +`SecurityCenter` is the primary interface for developers using the Azure SecurityCenter client library. Explore the methods on this client object to understand the different features of the Azure SecurityCenter service that you can access. ## Troubleshooting diff --git a/sdk/security/arm-security/_meta.json b/sdk/security/arm-security/_meta.json index 128c276cb60e..ec6877a686ed 100644 --- a/sdk/security/arm-security/_meta.json +++ b/sdk/security/arm-security/_meta.json @@ -1,8 +1,8 @@ { - "commit": "af1be2677e619e483210064ff658e62ec25053aa", + "commit": "ae9cb5a65ff4dba1d626ed0a1bb4e94dd17583e8", "readme": "specification/security/resource-manager/readme.md", - "autorest_command": "autorest --version=3.8.4 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\security\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.1.20220727.1 --generate-sample=true", + "autorest_command": "autorest --version=3.8.4 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\security\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.3.20221103.1 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", "release_tool": "@azure-tools/js-sdk-release-tools@2.4.2", - "use": "@autorest/typescript@6.0.0-rc.1.20220727.1" + "use": "@autorest/typescript@6.0.0-rc.3.20221103.1" } \ No newline at end of file diff --git a/sdk/security/arm-security/package.json b/sdk/security/arm-security/package.json index f9c00e5b0838..6785953ce5aa 100644 --- a/sdk/security/arm-security/package.json +++ b/sdk/security/arm-security/package.json @@ -11,7 +11,7 @@ "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.5.0", + "@azure/core-client": "^1.6.1", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -46,6 +46,7 @@ "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", + "@types/node": "^14.0.0", "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/security/arm-security", @@ -118,4 +119,4 @@ "disableDocsMs": true, "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-security?view=azure-node-preview" } -} +} \ No newline at end of file diff --git a/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_create_test.json b/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_create_test.json index 8ea4dd9e6dce..47a5c5bab9c4 100644 --- a/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_create_test.json +++ b/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_create_test.json @@ -10,8 +10,8 @@ "Connection": "keep-alive", "Content-Length": "199", "Content-Type": "application/json", - "User-Agent": "azsdk-js-arm-security/6.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)", - "x-ms-client-request-id": "dc4db5da-64f0-4643-a15a-5041ed88eca7" + "User-Agent": "azsdk-js-arm-security/6.0.0-beta.2 core-rest-pipeline/1.10.1 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "bc01fe6b-76d0-497d-b20a-1b02bcb1a541" }, "RequestBody": { "properties": { @@ -29,22 +29,24 @@ } } }, - "StatusCode": 201, + "StatusCode": 200, "ResponseHeaders": { "api-supported-versions": "2020-01-01-preview", "Cache-Control": "no-cache", - "Content-Length": "434", + "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 14 Sep 2022 09:41:11 GMT", + "Date": "Tue, 08 Nov 2022 06:47:25 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "232e0d06-66e4-4878-ab41-58610fe1290d", + "x-ms-correlation-request-id": "dc07ff90-7561-45ee-ba9d-3a2dace589ca", "x-ms-ratelimit-remaining-subscription-resource-requests": "249", - "x-ms-request-id": "232e0d06-66e4-4878-ab41-58610fe1290d", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220914T094111Z:232e0d06-66e4-4878-ab41-58610fe1290d" + "x-ms-request-id": "dc07ff90-7561-45ee-ba9d-3a2dace589ca", + "x-ms-routing-request-id": "SOUTHEASTASIA:20221108T064726Z:dc07ff90-7561-45ee-ba9d-3a2dace589ca" }, "ResponseBody": { "properties": { @@ -64,7 +66,7 @@ "id": "/subscriptions/azure_subscription_id/providers/Microsoft.Security/securityContacts/default", "name": "default", "type": "Microsoft.Security/securityContacts", - "etag": "\u00220900df2a-0000-0d00-0000-6321a1b70000\u0022", + "etag": "\u002253020247-0000-0d00-0000-6369fb7e0000\u0022", "location": "West Europe" } } diff --git a/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_delete_test.json b/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_delete_test.json index d0ecca7d3fce..08b32eee5cb5 100644 --- a/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_delete_test.json +++ b/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_delete_test.json @@ -8,8 +8,8 @@ "Accept-Encoding": "gzip,deflate", "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-js-arm-security/6.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)", - "x-ms-client-request-id": "cec790b2-3434-4362-bd23-2ce8f668fb90" + "User-Agent": "azsdk-js-arm-security/6.0.0-beta.2 core-rest-pipeline/1.10.1 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "762ab02e-ed09-4799-8661-0b0846e721a0" }, "RequestBody": null, "StatusCode": 200, @@ -18,7 +18,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 14 Sep 2022 09:41:14 GMT", + "Date": "Tue, 08 Nov 2022 06:47:31 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -26,10 +26,10 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d2272970-3401-43d8-91b3-1b5baebf0f35", + "x-ms-correlation-request-id": "7cad5fef-6e92-4acb-9ad0-403f76b71a13", "x-ms-ratelimit-remaining-subscription-deletes": "14999", - "x-ms-request-id": "d2272970-3401-43d8-91b3-1b5baebf0f35", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220914T094114Z:d2272970-3401-43d8-91b3-1b5baebf0f35" + "x-ms-request-id": "7cad5fef-6e92-4acb-9ad0-403f76b71a13", + "x-ms-routing-request-id": "SOUTHEASTASIA:20221108T064731Z:7cad5fef-6e92-4acb-9ad0-403f76b71a13" }, "ResponseBody": {} }, @@ -41,8 +41,8 @@ "Accept-Encoding": "gzip,deflate", "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-js-arm-security/6.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)", - "x-ms-client-request-id": "16e1b3c2-2f35-478c-9550-35417c3fef52" + "User-Agent": "azsdk-js-arm-security/6.0.0-beta.2 core-rest-pipeline/1.10.1 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "e9757249-6bd6-4b73-87ee-3e8ebd5d74f2" }, "RequestBody": null, "StatusCode": 200, @@ -51,7 +51,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 14 Sep 2022 09:41:14 GMT", + "Date": "Tue, 08 Nov 2022 06:47:31 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -59,10 +59,10 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "35b21ac2-43f3-42ff-8089-f22bcf511042", + "x-ms-correlation-request-id": "2924b920-7fb2-4ad9-af03-698b06e3b9dc", "x-ms-ratelimit-remaining-subscription-resource-requests": "747", - "x-ms-request-id": "35b21ac2-43f3-42ff-8089-f22bcf511042", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220914T094115Z:35b21ac2-43f3-42ff-8089-f22bcf511042" + "x-ms-request-id": "2924b920-7fb2-4ad9-af03-698b06e3b9dc", + "x-ms-routing-request-id": "SOUTHEASTASIA:20221108T064732Z:2924b920-7fb2-4ad9-af03-698b06e3b9dc" }, "ResponseBody": { "value": [] diff --git a/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_get_test.json b/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_get_test.json index 92bacff60bbd..8c4c8e748666 100644 --- a/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_get_test.json +++ b/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_get_test.json @@ -8,8 +8,8 @@ "Accept-Encoding": "gzip,deflate", "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-js-arm-security/6.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)", - "x-ms-client-request-id": "dcbf9094-a1e9-4aec-8ead-57cae402b9b3" + "User-Agent": "azsdk-js-arm-security/6.0.0-beta.2 core-rest-pipeline/1.10.1 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "6b72d0a0-077f-447e-9887-0725356c4bc8" }, "RequestBody": null, "StatusCode": 200, @@ -18,7 +18,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 14 Sep 2022 09:41:11 GMT", + "Date": "Tue, 08 Nov 2022 06:47:27 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -26,10 +26,10 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "28164812-fa01-403e-bb3b-ec03bd44eb99", + "x-ms-correlation-request-id": "76210a05-aecb-452b-9fea-36577636f47f", "x-ms-ratelimit-remaining-subscription-resource-requests": "749", - "x-ms-request-id": "28164812-fa01-403e-bb3b-ec03bd44eb99", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220914T094112Z:28164812-fa01-403e-bb3b-ec03bd44eb99" + "x-ms-request-id": "76210a05-aecb-452b-9fea-36577636f47f", + "x-ms-routing-request-id": "SOUTHEASTASIA:20221108T064728Z:76210a05-aecb-452b-9fea-36577636f47f" }, "ResponseBody": { "properties": { @@ -49,7 +49,7 @@ "id": "/subscriptions/azure_subscription_id/providers/Microsoft.Security/securityContacts/default", "name": "default", "type": "Microsoft.Security/securityContacts", - "etag": "\u00220900df2a-0000-0d00-0000-6321a1b70000\u0022", + "etag": "\u002253020247-0000-0d00-0000-6369fb7e0000\u0022", "location": "West Europe" } } diff --git a/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_list_test.json b/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_list_test.json index d4da20483a75..08fb0d46b52f 100644 --- a/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_list_test.json +++ b/sdk/security/arm-security/recordings/node/security_test/recording_securitycontact_list_test.json @@ -8,8 +8,8 @@ "Accept-Encoding": "gzip,deflate", "Authorization": "Sanitized", "Connection": "keep-alive", - "User-Agent": "azsdk-js-arm-security/6.0.0-beta.1 core-rest-pipeline/1.9.3 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22000)", - "x-ms-client-request-id": "9eadafd3-84f4-4368-8292-3c53747f8767" + "User-Agent": "azsdk-js-arm-security/6.0.0-beta.2 core-rest-pipeline/1.10.1 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "4eef06e9-e8db-4b59-9e0f-adb9afc81bdb" }, "RequestBody": null, "StatusCode": 200, @@ -18,7 +18,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 14 Sep 2022 09:41:12 GMT", + "Date": "Tue, 08 Nov 2022 06:47:28 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Kestrel", @@ -26,12 +26,12 @@ "Transfer-Encoding": "chunked", "Vary": "Accept-Encoding", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "e4825fd1-ecc7-46f6-865b-4aa19b5bcbad", + "x-ms-correlation-request-id": "1ec3aedb-de01-454a-913d-d45ceeadb38b", "x-ms-ratelimit-remaining-subscription-resource-requests": "748", - "x-ms-request-id": "e4825fd1-ecc7-46f6-865b-4aa19b5bcbad", - "x-ms-routing-request-id": "SOUTHEASTASIA:20220914T094112Z:e4825fd1-ecc7-46f6-865b-4aa19b5bcbad" + "x-ms-request-id": "1ec3aedb-de01-454a-913d-d45ceeadb38b", + "x-ms-routing-request-id": "SOUTHEASTASIA:20221108T064729Z:1ec3aedb-de01-454a-913d-d45ceeadb38b" }, - "ResponseBody": "[{\u0022properties\u0022:{\u0022notificationsByRole\u0022:{\u0022state\u0022:\u0022On\u0022,\u0022roles\u0022:[\u0022Owner\u0022]},\u0022emails\u0022:\u0022john@contoso.com;jane@contoso.com\u0022,\u0022phone\u0022:\u0022\u002B214-2754038\u0022,\u0022alertNotifications\u0022:{\u0022state\u0022:\u0022On\u0022,\u0022minimalSeverity\u0022:\u0022Low\u0022}},\u0022id\u0022:\u0022/subscriptions/azure_subscription_id/providers/Microsoft.Security/securityContacts/default\u0022,\u0022name\u0022:\u0022default\u0022,\u0022type\u0022:\u0022Microsoft.Security/securityContacts\u0022,\u0022etag\u0022:\u0022\\\u00220900df2a-0000-0d00-0000-6321a1b70000\\\u0022\u0022,\u0022location\u0022:\u0022West Europe\u0022}]" + "ResponseBody": "[{\u0022properties\u0022:{\u0022notificationsByRole\u0022:{\u0022state\u0022:\u0022On\u0022,\u0022roles\u0022:[\u0022Owner\u0022]},\u0022emails\u0022:\u0022john@contoso.com;jane@contoso.com\u0022,\u0022phone\u0022:\u0022\u002B214-2754038\u0022,\u0022alertNotifications\u0022:{\u0022state\u0022:\u0022On\u0022,\u0022minimalSeverity\u0022:\u0022Low\u0022}},\u0022id\u0022:\u0022/subscriptions/azure_subscription_id/providers/Microsoft.Security/securityContacts/default\u0022,\u0022name\u0022:\u0022default\u0022,\u0022type\u0022:\u0022Microsoft.Security/securityContacts\u0022,\u0022etag\u0022:\u0022\\\u002253020247-0000-0d00-0000-6369fb7e0000\\\u0022\u0022,\u0022location\u0022:\u0022West Europe\u0022}]" } ], "Variables": {} diff --git a/sdk/security/arm-security/review/arm-security.api.md b/sdk/security/arm-security/review/arm-security.api.md index d5a8bf0090ee..1357b0b8e8a0 100644 --- a/sdk/security/arm-security/review/arm-security.api.md +++ b/sdk/security/arm-security/review/arm-security.api.md @@ -995,7 +995,7 @@ export interface AwsCredsAuthenticationDetailsProperties extends AuthenticationD } // @public -export interface AWSEnvironmentData extends EnvironmentData { +export interface AwsEnvironmentData extends EnvironmentData { environmentType: "AwsAccount"; organizationalData?: AwsOrganizationalDataUnion; } @@ -1113,11 +1113,11 @@ export type CloudName = string; // @public export interface CloudOffering { readonly description?: string; - offeringType: "CspmMonitorAws" | "DefenderForContainersAws" | "DefenderForServersAws" | "DefenderForDatabasesAws" | "InformationProtectionAws" | "CspmMonitorGcp" | "DefenderForServersGcp" | "DefenderForDatabasesGcp" | "DefenderForContainersGcp" | "CspmMonitorGithub" | "CspmMonitorAzureDevOps"; + offeringType: "CspmMonitorAws" | "DefenderForContainersAws" | "DefenderForServersAws" | "DefenderForDatabasesAws" | "InformationProtectionAws" | "CspmMonitorGcp" | "DefenderForServersGcp" | "DefenderForDatabasesGcp" | "DefenderForContainersGcp" | "CspmMonitorGithub" | "CspmMonitorAzureDevOps" | "DefenderCspmAws" | "DefenderCspmGcp" | "DefenderForDevOpsGithub" | "DefenderForDevOpsAzureDevOps"; } // @public (undocumented) -export type CloudOfferingUnion = CloudOffering | CspmMonitorAwsOffering | DefenderForContainersAwsOffering | DefenderForServersAwsOffering | DefenderFoDatabasesAwsOffering | InformationProtectionAwsOffering | CspmMonitorGcpOffering | DefenderForServersGcpOffering | DefenderForDatabasesGcpOffering | DefenderForContainersGcpOffering | CspmMonitorGithubOffering | CspmMonitorAzureDevOpsOffering; +export type CloudOfferingUnion = CloudOffering | CspmMonitorAwsOffering | DefenderForContainersAwsOffering | DefenderForServersAwsOffering | DefenderFoDatabasesAwsOffering | InformationProtectionAwsOffering | CspmMonitorGcpOffering | DefenderForServersGcpOffering | DefenderForDatabasesGcpOffering | DefenderForContainersGcpOffering | CspmMonitorGithubOffering | CspmMonitorAzureDevOpsOffering | DefenderCspmAwsOffering | DefenderCspmGcpOffering | DefenderForDevOpsGithubOffering | DefenderForDevOpsAzureDevOpsOffering; // @public export interface Compliance extends Resource { @@ -1543,24 +1543,49 @@ export interface DataExportSettings extends Setting { // @public export type DataSource = string; +// @public +export interface DefenderCspmAwsOffering extends CloudOffering { + offeringType: "DefenderCspmAws"; + vmScanners?: DefenderCspmAwsOfferingVmScanners; +} + +// @public +export interface DefenderCspmAwsOfferingVmScanners { + configuration?: DefenderCspmAwsOfferingVmScannersConfiguration; + enabled?: boolean; +} + +// @public +export interface DefenderCspmAwsOfferingVmScannersConfiguration { + cloudRoleArn?: string; + exclusionTags?: { + [propertyName: string]: string; + }; + scanningMode?: ScanningMode; +} + +// @public +export interface DefenderCspmGcpOffering extends CloudOffering { + offeringType: "DefenderCspmGcp"; +} + // @public export interface DefenderFoDatabasesAwsOffering extends CloudOffering { arcAutoProvisioning?: DefenderFoDatabasesAwsOfferingArcAutoProvisioning; offeringType: "DefenderForDatabasesAws"; + rds?: DefenderFoDatabasesAwsOfferingRds; } // @public export interface DefenderFoDatabasesAwsOfferingArcAutoProvisioning { cloudRoleArn?: string; enabled?: boolean; - servicePrincipalSecretMetadata?: DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata; } // @public -export interface DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata { - expiryDate?: Date; - parameterNameInStore?: string; - parameterStoreRegion?: string; +export interface DefenderFoDatabasesAwsOfferingRds { + cloudRoleArn?: string; + enabled?: boolean; } // @public @@ -1639,22 +1664,25 @@ export interface DefenderForDatabasesGcpOffering extends CloudOffering { // @public export interface DefenderForDatabasesGcpOfferingArcAutoProvisioning { - configuration?: DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration; enabled?: boolean; } -// @public -export interface DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration { - agentOnboardingServiceAccountNumericId?: string; - clientId?: string; -} - // @public export interface DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning { serviceAccountEmailAddress?: string; workloadIdentityProviderId?: string; } +// @public +export interface DefenderForDevOpsAzureDevOpsOffering extends CloudOffering { + offeringType: "DefenderForDevOpsAzureDevOps"; +} + +// @public +export interface DefenderForDevOpsGithubOffering extends CloudOffering { + offeringType: "DefenderForDevOpsGithub"; +} + // @public export interface DefenderForServersAwsOffering extends CloudOffering { arcAutoProvisioning?: DefenderForServersAwsOfferingArcAutoProvisioning; @@ -1670,14 +1698,6 @@ export interface DefenderForServersAwsOffering extends CloudOffering { export interface DefenderForServersAwsOfferingArcAutoProvisioning { cloudRoleArn?: string; enabled?: boolean; - servicePrincipalSecretMetadata?: DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata; -} - -// @public -export interface DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata { - expiryDate?: string; - parameterNameInStore?: string; - parameterStoreRegion?: string; } // @public @@ -1716,7 +1736,9 @@ export interface DefenderForServersAwsOfferingVmScanners { // @public export interface DefenderForServersAwsOfferingVmScannersConfiguration { cloudRoleArn?: string; - exclusionTags?: Record; + exclusionTags?: { + [propertyName: string]: string; + }; scanningMode?: ScanningMode; } @@ -1732,16 +1754,9 @@ export interface DefenderForServersGcpOffering extends CloudOffering { // @public export interface DefenderForServersGcpOfferingArcAutoProvisioning { - configuration?: DefenderForServersGcpOfferingArcAutoProvisioningConfiguration; enabled?: boolean; } -// @public -export interface DefenderForServersGcpOfferingArcAutoProvisioningConfiguration { - agentOnboardingServiceAccountNumericId?: string; - clientId?: string; -} - // @public export interface DefenderForServersGcpOfferingDefenderForServers { serviceAccountEmailAddress?: string; @@ -1916,7 +1931,7 @@ export interface EnvironmentData { } // @public (undocumented) -export type EnvironmentDataUnion = EnvironmentData | AWSEnvironmentData | GcpProjectEnvironmentData | GithubScopeEnvironmentData | AzureDevOpsScopeEnvironmentData; +export type EnvironmentDataUnion = EnvironmentData | AwsEnvironmentData | GcpProjectEnvironmentData | GithubScopeEnvironmentData | AzureDevOpsScopeEnvironmentData; // @public export type EnvironmentType = string; @@ -2092,6 +2107,9 @@ export interface GcpProjectEnvironmentData extends EnvironmentData { projectDetails?: GcpProjectDetails; } +// @public +export function getContinuationToken(page: unknown): string | undefined; + // @public export interface GithubScopeEnvironmentData extends EnvironmentData { environmentType: "GithubScope"; @@ -2994,6 +3012,7 @@ export enum KnownAlertStatus { // @public export enum KnownApplicationConditionOperator { Contains = "Contains", + Equals = "Equals", In = "In" } @@ -3276,10 +3295,14 @@ export enum KnownOfferingType { CspmMonitorAzureDevOps = "CspmMonitorAzureDevOps", CspmMonitorGcp = "CspmMonitorGcp", CspmMonitorGithub = "CspmMonitorGithub", + DefenderCspmAws = "DefenderCspmAws", + DefenderCspmGcp = "DefenderCspmGcp", DefenderForContainersAws = "DefenderForContainersAws", DefenderForContainersGcp = "DefenderForContainersGcp", DefenderForDatabasesAws = "DefenderForDatabasesAws", DefenderForDatabasesGcp = "DefenderForDatabasesGcp", + DefenderForDevOpsAzureDevOps = "DefenderForDevOpsAzureDevOps", + DefenderForDevOpsGithub = "DefenderForDevOpsGithub", DefenderForServersAws = "DefenderForServersAws", DefenderForServersGcp = "DefenderForServersGcp", InformationProtectionAws = "InformationProtectionAws" diff --git a/sdk/security/arm-security/samples-dev/connectorsCreateOrUpdateSample.ts b/sdk/security/arm-security/samples-dev/connectorsCreateOrUpdateSample.ts index 01f2e844633f..878eb19b9f2c 100644 --- a/sdk/security/arm-security/samples-dev/connectorsCreateOrUpdateSample.ts +++ b/sdk/security/arm-security/samples-dev/connectorsCreateOrUpdateSample.ts @@ -107,8 +107,7 @@ async function gcpCredentialsCreateACloudAccountConnectorForASubscription() { clientX509CertUrl: "https://www.googleapis.com/robot/v1/metadata/x509/asc-135%40asc-project-1234.iam.gserviceaccount.com", organizationId: "AscDemoOrg", - privateKey: - "", + privateKey: "", privateKeyId: "6efg587hra2568as34d22326b044cc20dc2af", projectId: "asc-project-1234", tokenUri: "https://oauth2.googleapis.com/token" diff --git a/sdk/security/arm-security/samples-dev/securityConnectorsCreateOrUpdateSample.ts b/sdk/security/arm-security/samples-dev/securityConnectorsCreateOrUpdateSample.ts index e94d6fab9f9a..c54aaa84b443 100644 --- a/sdk/security/arm-security/samples-dev/securityConnectorsCreateOrUpdateSample.ts +++ b/sdk/security/arm-security/samples-dev/securityConnectorsCreateOrUpdateSample.ts @@ -15,7 +15,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * This sample demonstrates how to Creates or updates a security connector. If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. * * @summary Creates or updates a security connector. If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/PutSecurityConnector_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/PutSecurityConnector_example.json */ async function createOrUpdateASecurityConnector() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; @@ -25,7 +25,7 @@ async function createOrUpdateASecurityConnector() { environmentData: { environmentType: "AwsAccount" }, environmentName: "AWS", etag: "etag value (must be supplied for update)", - hierarchyIdentifier: "HierarchyId1", + hierarchyIdentifier: "exampleHierarchyId", location: "Central US", offerings: [ { diff --git a/sdk/security/arm-security/samples-dev/securityConnectorsDeleteSample.ts b/sdk/security/arm-security/samples-dev/securityConnectorsDeleteSample.ts index da7e374ab383..4be70e4977a7 100644 --- a/sdk/security/arm-security/samples-dev/securityConnectorsDeleteSample.ts +++ b/sdk/security/arm-security/samples-dev/securityConnectorsDeleteSample.ts @@ -15,7 +15,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * This sample demonstrates how to Deletes a security connector. * * @summary Deletes a security connector. - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/DeleteSecurityConnector_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/DeleteSecurityConnector_example.json */ async function deleteASecurityConnector() { const subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; diff --git a/sdk/security/arm-security/samples-dev/securityConnectorsGetSample.ts b/sdk/security/arm-security/samples-dev/securityConnectorsGetSample.ts index 7ed113409784..3fb99c2aa933 100644 --- a/sdk/security/arm-security/samples-dev/securityConnectorsGetSample.ts +++ b/sdk/security/arm-security/samples-dev/securityConnectorsGetSample.ts @@ -15,7 +15,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * This sample demonstrates how to Retrieves details of a specific security connector * * @summary Retrieves details of a specific security connector - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorSingleResource_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorSingleResource_example.json */ async function retrieveASecurityConnector() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; diff --git a/sdk/security/arm-security/samples-dev/securityConnectorsListByResourceGroupSample.ts b/sdk/security/arm-security/samples-dev/securityConnectorsListByResourceGroupSample.ts index 103ab454a4c4..5de4fbfc6422 100644 --- a/sdk/security/arm-security/samples-dev/securityConnectorsListByResourceGroupSample.ts +++ b/sdk/security/arm-security/samples-dev/securityConnectorsListByResourceGroupSample.ts @@ -15,7 +15,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * This sample demonstrates how to Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get the next page of security connectors for the specified resource group. * * @summary Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get the next page of security connectors for the specified resource group. - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json */ async function listAllSecurityConnectorsOfASpecifiedResourceGroup() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; diff --git a/sdk/security/arm-security/samples-dev/securityConnectorsListSample.ts b/sdk/security/arm-security/samples-dev/securityConnectorsListSample.ts index 6db8ee0eaae0..fc4e200a13e0 100644 --- a/sdk/security/arm-security/samples-dev/securityConnectorsListSample.ts +++ b/sdk/security/arm-security/samples-dev/securityConnectorsListSample.ts @@ -15,7 +15,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * This sample demonstrates how to Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. * * @summary Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorsSubscription_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorsSubscription_example.json */ async function listAllSecurityConnectorsOfASpecifiedSubscription() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; diff --git a/sdk/security/arm-security/samples-dev/securityConnectorsUpdateSample.ts b/sdk/security/arm-security/samples-dev/securityConnectorsUpdateSample.ts index 1259eee07d1d..fdc410e5113a 100644 --- a/sdk/security/arm-security/samples-dev/securityConnectorsUpdateSample.ts +++ b/sdk/security/arm-security/samples-dev/securityConnectorsUpdateSample.ts @@ -15,7 +15,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * This sample demonstrates how to Updates a security connector * * @summary Updates a security connector - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/PatchSecurityConnector_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/PatchSecurityConnector_example.json */ async function updateASecurityConnector() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; diff --git a/sdk/security/arm-security/samples-dev/securityContactsCreateSample.ts b/sdk/security/arm-security/samples-dev/securityContactsCreateSample.ts index d2fdb690c2d7..86797ff1fd3b 100644 --- a/sdk/security/arm-security/samples-dev/securityContactsCreateSample.ts +++ b/sdk/security/arm-security/samples-dev/securityContactsCreateSample.ts @@ -24,7 +24,7 @@ async function createSecurityContactData() { alertNotifications: { minimalSeverity: "Low", state: "On" }, emails: "john@contoso.com;jane@contoso.com", notificationsByRole: { roles: ["Owner"], state: "On" }, - phone: "+214-2754038" + phone: "(214)275-4038" }; const credential = new DefaultAzureCredential(); const client = new SecurityCenter(credential, subscriptionId); diff --git a/sdk/security/arm-security/samples/v6-beta/javascript/README.md b/sdk/security/arm-security/samples/v6-beta/javascript/README.md index 90f6bafc2462..80d9f54d5915 100644 --- a/sdk/security/arm-security/samples/v6-beta/javascript/README.md +++ b/sdk/security/arm-security/samples/v6-beta/javascript/README.md @@ -154,12 +154,12 @@ These sample programs show how to use the JavaScript client libraries for in som | [securityConnectorGovernanceRulesDeleteSample.js][securityconnectorgovernancerulesdeletesample] | Delete a GovernanceRule over a given scope x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/DeleteSecurityConnectorGovernanceRule_example.json | | [securityConnectorGovernanceRulesExecuteStatusGetSample.js][securityconnectorgovernancerulesexecutestatusgetsample] | Get a specific governanceRule execution status for the requested scope by ruleId and operationId x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetSecurityConnectorGovernanceRuleExecuteStatus_example.json | | [securityConnectorGovernanceRulesGetSample.js][securityconnectorgovernancerulesgetsample] | Get a specific governanceRule for the requested scope by ruleId x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetSecurityConnectorGovernanceRule_example.json | -| [securityConnectorsCreateOrUpdateSample.js][securityconnectorscreateorupdatesample] | Creates or updates a security connector. If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/PutSecurityConnector_example.json | -| [securityConnectorsDeleteSample.js][securityconnectorsdeletesample] | Deletes a security connector. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/DeleteSecurityConnector_example.json | -| [securityConnectorsGetSample.js][securityconnectorsgetsample] | Retrieves details of a specific security connector x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorSingleResource_example.json | -| [securityConnectorsListByResourceGroupSample.js][securityconnectorslistbyresourcegroupsample] | Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get the next page of security connectors for the specified resource group. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json | -| [securityConnectorsListSample.js][securityconnectorslistsample] | Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorsSubscription_example.json | -| [securityConnectorsUpdateSample.js][securityconnectorsupdatesample] | Updates a security connector x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/PatchSecurityConnector_example.json | +| [securityConnectorsCreateOrUpdateSample.js][securityconnectorscreateorupdatesample] | Creates or updates a security connector. If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/PutSecurityConnector_example.json | +| [securityConnectorsDeleteSample.js][securityconnectorsdeletesample] | Deletes a security connector. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/DeleteSecurityConnector_example.json | +| [securityConnectorsGetSample.js][securityconnectorsgetsample] | Retrieves details of a specific security connector x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorSingleResource_example.json | +| [securityConnectorsListByResourceGroupSample.js][securityconnectorslistbyresourcegroupsample] | Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get the next page of security connectors for the specified resource group. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json | +| [securityConnectorsListSample.js][securityconnectorslistsample] | Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorsSubscription_example.json | +| [securityConnectorsUpdateSample.js][securityconnectorsupdatesample] | Updates a security connector x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/PatchSecurityConnector_example.json | | [securityContactsCreateSample.js][securitycontactscreatesample] | Create security contact configurations for the subscription x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/SecurityContacts/CreateSecurityContact_example.json | | [securityContactsDeleteSample.js][securitycontactsdeletesample] | Delete security contact configurations for the subscription x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/SecurityContacts/DeleteSecurityContact_example.json | | [securityContactsGetSample.js][securitycontactsgetsample] | Get Default Security contact configurations for the subscription x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/SecurityContacts/GetSecurityContact_example.json | @@ -209,11 +209,7 @@ These sample programs show how to use the JavaScript client libraries for in som ## Prerequisites -<<<<<<< HEAD:sdk/security/arm-security/samples/v6-beta/javascript/README.md The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). -======= -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). ->>>>>>> main:sdk/security/arm-security/samples/v5/javascript/README.md You need [an Azure subscription][freesub] to run these sample programs. diff --git a/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsCreateOrUpdateSample.js b/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsCreateOrUpdateSample.js index 194aa851871d..1e849ba76227 100644 --- a/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsCreateOrUpdateSample.js +++ b/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsCreateOrUpdateSample.js @@ -15,7 +15,7 @@ const { DefaultAzureCredential } = require("@azure/identity"); * This sample demonstrates how to Creates or updates a security connector. If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. * * @summary Creates or updates a security connector. If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/PutSecurityConnector_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/PutSecurityConnector_example.json */ async function createOrUpdateASecurityConnector() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; @@ -25,7 +25,7 @@ async function createOrUpdateASecurityConnector() { environmentData: { environmentType: "AwsAccount" }, environmentName: "AWS", etag: "etag value (must be supplied for update)", - hierarchyIdentifier: "HierarchyId1", + hierarchyIdentifier: "exampleHierarchyId", location: "Central US", offerings: [ { diff --git a/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsDeleteSample.js b/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsDeleteSample.js index 0e2a9ccaeca4..2812082162ef 100644 --- a/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsDeleteSample.js +++ b/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsDeleteSample.js @@ -15,7 +15,7 @@ const { DefaultAzureCredential } = require("@azure/identity"); * This sample demonstrates how to Deletes a security connector. * * @summary Deletes a security connector. - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/DeleteSecurityConnector_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/DeleteSecurityConnector_example.json */ async function deleteASecurityConnector() { const subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; diff --git a/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsGetSample.js b/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsGetSample.js index 76e3fefbdbc7..587d9d5ac9e2 100644 --- a/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsGetSample.js +++ b/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsGetSample.js @@ -15,7 +15,7 @@ const { DefaultAzureCredential } = require("@azure/identity"); * This sample demonstrates how to Retrieves details of a specific security connector * * @summary Retrieves details of a specific security connector - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorSingleResource_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorSingleResource_example.json */ async function retrieveASecurityConnector() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; diff --git a/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsListByResourceGroupSample.js b/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsListByResourceGroupSample.js index 0390e6ab8e24..144c82488475 100644 --- a/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsListByResourceGroupSample.js +++ b/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsListByResourceGroupSample.js @@ -15,7 +15,7 @@ const { DefaultAzureCredential } = require("@azure/identity"); * This sample demonstrates how to Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get the next page of security connectors for the specified resource group. * * @summary Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get the next page of security connectors for the specified resource group. - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json */ async function listAllSecurityConnectorsOfASpecifiedResourceGroup() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; diff --git a/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsListSample.js b/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsListSample.js index 86343909f59e..5bed6d2f26f8 100644 --- a/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsListSample.js +++ b/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsListSample.js @@ -15,7 +15,7 @@ const { DefaultAzureCredential } = require("@azure/identity"); * This sample demonstrates how to Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. * * @summary Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorsSubscription_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorsSubscription_example.json */ async function listAllSecurityConnectorsOfASpecifiedSubscription() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; diff --git a/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsUpdateSample.js b/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsUpdateSample.js index 6f05d08c9901..c6533e3d29d7 100644 --- a/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsUpdateSample.js +++ b/sdk/security/arm-security/samples/v6-beta/javascript/securityConnectorsUpdateSample.js @@ -15,7 +15,7 @@ const { DefaultAzureCredential } = require("@azure/identity"); * This sample demonstrates how to Updates a security connector * * @summary Updates a security connector - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/PatchSecurityConnector_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/PatchSecurityConnector_example.json */ async function updateASecurityConnector() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; diff --git a/sdk/security/arm-security/samples/v6-beta/javascript/securityContactsCreateSample.js b/sdk/security/arm-security/samples/v6-beta/javascript/securityContactsCreateSample.js index 065761e5ec03..4f64c43b3b07 100644 --- a/sdk/security/arm-security/samples/v6-beta/javascript/securityContactsCreateSample.js +++ b/sdk/security/arm-security/samples/v6-beta/javascript/securityContactsCreateSample.js @@ -24,7 +24,7 @@ async function createSecurityContactData() { alertNotifications: { minimalSeverity: "Low", state: "On" }, emails: "john@contoso.com;jane@contoso.com", notificationsByRole: { roles: ["Owner"], state: "On" }, - phone: "+214-2754038", + phone: "(214)275-4038", }; const credential = new DefaultAzureCredential(); const client = new SecurityCenter(credential, subscriptionId); diff --git a/sdk/security/arm-security/samples/v6-beta/typescript/README.md b/sdk/security/arm-security/samples/v6-beta/typescript/README.md index 53d7053e3577..d1af0ef95d8d 100644 --- a/sdk/security/arm-security/samples/v6-beta/typescript/README.md +++ b/sdk/security/arm-security/samples/v6-beta/typescript/README.md @@ -154,12 +154,12 @@ These sample programs show how to use the TypeScript client libraries for in som | [securityConnectorGovernanceRulesDeleteSample.ts][securityconnectorgovernancerulesdeletesample] | Delete a GovernanceRule over a given scope x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/DeleteSecurityConnectorGovernanceRule_example.json | | [securityConnectorGovernanceRulesExecuteStatusGetSample.ts][securityconnectorgovernancerulesexecutestatusgetsample] | Get a specific governanceRule execution status for the requested scope by ruleId and operationId x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetSecurityConnectorGovernanceRuleExecuteStatus_example.json | | [securityConnectorGovernanceRulesGetSample.ts][securityconnectorgovernancerulesgetsample] | Get a specific governanceRule for the requested scope by ruleId x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetSecurityConnectorGovernanceRule_example.json | -| [securityConnectorsCreateOrUpdateSample.ts][securityconnectorscreateorupdatesample] | Creates or updates a security connector. If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/PutSecurityConnector_example.json | -| [securityConnectorsDeleteSample.ts][securityconnectorsdeletesample] | Deletes a security connector. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/DeleteSecurityConnector_example.json | -| [securityConnectorsGetSample.ts][securityconnectorsgetsample] | Retrieves details of a specific security connector x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorSingleResource_example.json | -| [securityConnectorsListByResourceGroupSample.ts][securityconnectorslistbyresourcegroupsample] | Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get the next page of security connectors for the specified resource group. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json | -| [securityConnectorsListSample.ts][securityconnectorslistsample] | Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorsSubscription_example.json | -| [securityConnectorsUpdateSample.ts][securityconnectorsupdatesample] | Updates a security connector x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/PatchSecurityConnector_example.json | +| [securityConnectorsCreateOrUpdateSample.ts][securityconnectorscreateorupdatesample] | Creates or updates a security connector. If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/PutSecurityConnector_example.json | +| [securityConnectorsDeleteSample.ts][securityconnectorsdeletesample] | Deletes a security connector. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/DeleteSecurityConnector_example.json | +| [securityConnectorsGetSample.ts][securityconnectorsgetsample] | Retrieves details of a specific security connector x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorSingleResource_example.json | +| [securityConnectorsListByResourceGroupSample.ts][securityconnectorslistbyresourcegroupsample] | Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get the next page of security connectors for the specified resource group. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json | +| [securityConnectorsListSample.ts][securityconnectorslistsample] | Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorsSubscription_example.json | +| [securityConnectorsUpdateSample.ts][securityconnectorsupdatesample] | Updates a security connector x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/PatchSecurityConnector_example.json | | [securityContactsCreateSample.ts][securitycontactscreatesample] | Create security contact configurations for the subscription x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/SecurityContacts/CreateSecurityContact_example.json | | [securityContactsDeleteSample.ts][securitycontactsdeletesample] | Delete security contact configurations for the subscription x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/SecurityContacts/DeleteSecurityContact_example.json | | [securityContactsGetSample.ts][securitycontactsgetsample] | Get Default Security contact configurations for the subscription x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/SecurityContacts/GetSecurityContact_example.json | @@ -209,11 +209,7 @@ These sample programs show how to use the TypeScript client libraries for in som ## Prerequisites -<<<<<<< HEAD:sdk/security/arm-security/samples/v6-beta/typescript/README.md The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). -======= -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). ->>>>>>> main:sdk/security/arm-security/samples/v5/typescript/README.md Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: diff --git a/sdk/security/arm-security/samples/v6-beta/typescript/package.json b/sdk/security/arm-security/samples/v6-beta/typescript/package.json index c8c7fce8b643..32d7a681f043 100644 --- a/sdk/security/arm-security/samples/v6-beta/typescript/package.json +++ b/sdk/security/arm-security/samples/v6-beta/typescript/package.json @@ -35,7 +35,7 @@ }, "devDependencies": { "@types/node": "^14.0.0", - "typescript": "~4.6.0", + "typescript": "~4.8.0", "rimraf": "latest" } } diff --git a/sdk/security/arm-security/samples/v6-beta/typescript/src/connectorsCreateOrUpdateSample.ts b/sdk/security/arm-security/samples/v6-beta/typescript/src/connectorsCreateOrUpdateSample.ts index 01f2e844633f..878eb19b9f2c 100644 --- a/sdk/security/arm-security/samples/v6-beta/typescript/src/connectorsCreateOrUpdateSample.ts +++ b/sdk/security/arm-security/samples/v6-beta/typescript/src/connectorsCreateOrUpdateSample.ts @@ -107,8 +107,7 @@ async function gcpCredentialsCreateACloudAccountConnectorForASubscription() { clientX509CertUrl: "https://www.googleapis.com/robot/v1/metadata/x509/asc-135%40asc-project-1234.iam.gserviceaccount.com", organizationId: "AscDemoOrg", - privateKey: - "", + privateKey: "", privateKeyId: "6efg587hra2568as34d22326b044cc20dc2af", projectId: "asc-project-1234", tokenUri: "https://oauth2.googleapis.com/token" diff --git a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsCreateOrUpdateSample.ts b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsCreateOrUpdateSample.ts index e94d6fab9f9a..c54aaa84b443 100644 --- a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsCreateOrUpdateSample.ts +++ b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsCreateOrUpdateSample.ts @@ -15,7 +15,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * This sample demonstrates how to Creates or updates a security connector. If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. * * @summary Creates or updates a security connector. If a security connector is already created and a subsequent request is issued for the same security connector id, then it will be updated. - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/PutSecurityConnector_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/PutSecurityConnector_example.json */ async function createOrUpdateASecurityConnector() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; @@ -25,7 +25,7 @@ async function createOrUpdateASecurityConnector() { environmentData: { environmentType: "AwsAccount" }, environmentName: "AWS", etag: "etag value (must be supplied for update)", - hierarchyIdentifier: "HierarchyId1", + hierarchyIdentifier: "exampleHierarchyId", location: "Central US", offerings: [ { diff --git a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsDeleteSample.ts b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsDeleteSample.ts index da7e374ab383..4be70e4977a7 100644 --- a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsDeleteSample.ts +++ b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsDeleteSample.ts @@ -15,7 +15,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * This sample demonstrates how to Deletes a security connector. * * @summary Deletes a security connector. - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/DeleteSecurityConnector_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/DeleteSecurityConnector_example.json */ async function deleteASecurityConnector() { const subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; diff --git a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsGetSample.ts b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsGetSample.ts index 7ed113409784..3fb99c2aa933 100644 --- a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsGetSample.ts +++ b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsGetSample.ts @@ -15,7 +15,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * This sample demonstrates how to Retrieves details of a specific security connector * * @summary Retrieves details of a specific security connector - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorSingleResource_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorSingleResource_example.json */ async function retrieveASecurityConnector() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; diff --git a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsListByResourceGroupSample.ts b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsListByResourceGroupSample.ts index 103ab454a4c4..5de4fbfc6422 100644 --- a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsListByResourceGroupSample.ts +++ b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsListByResourceGroupSample.ts @@ -15,7 +15,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * This sample demonstrates how to Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get the next page of security connectors for the specified resource group. * * @summary Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get the next page of security connectors for the specified resource group. - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json */ async function listAllSecurityConnectorsOfASpecifiedResourceGroup() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; diff --git a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsListSample.ts b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsListSample.ts index 6db8ee0eaae0..fc4e200a13e0 100644 --- a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsListSample.ts +++ b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsListSample.ts @@ -15,7 +15,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * This sample demonstrates how to Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. * * @summary Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security connectors for the specified subscription. - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/GetSecurityConnectorsSubscription_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/GetSecurityConnectorsSubscription_example.json */ async function listAllSecurityConnectorsOfASpecifiedSubscription() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; diff --git a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsUpdateSample.ts b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsUpdateSample.ts index 1259eee07d1d..fdc410e5113a 100644 --- a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsUpdateSample.ts +++ b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityConnectorsUpdateSample.ts @@ -15,7 +15,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * This sample demonstrates how to Updates a security connector * * @summary Updates a security connector - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-05-01-preview/examples/SecurityConnectors/PatchSecurityConnector_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-08-01-preview/examples/SecurityConnectors/PatchSecurityConnector_example.json */ async function updateASecurityConnector() { const subscriptionId = "a5caac9c-5c04-49af-b3d0-e204f40345d5"; diff --git a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityContactsCreateSample.ts b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityContactsCreateSample.ts index d2fdb690c2d7..86797ff1fd3b 100644 --- a/sdk/security/arm-security/samples/v6-beta/typescript/src/securityContactsCreateSample.ts +++ b/sdk/security/arm-security/samples/v6-beta/typescript/src/securityContactsCreateSample.ts @@ -24,7 +24,7 @@ async function createSecurityContactData() { alertNotifications: { minimalSeverity: "Low", state: "On" }, emails: "john@contoso.com;jane@contoso.com", notificationsByRole: { roles: ["Owner"], state: "On" }, - phone: "+214-2754038" + phone: "(214)275-4038" }; const credential = new DefaultAzureCredential(); const client = new SecurityCenter(credential, subscriptionId); diff --git a/sdk/security/arm-security/src/index.ts b/sdk/security/arm-security/src/index.ts index 82e018581ae7..bb0bd6d5357c 100644 --- a/sdk/security/arm-security/src/index.ts +++ b/sdk/security/arm-security/src/index.ts @@ -7,6 +7,7 @@ */ /// +export { getContinuationToken } from "./pagingHelper"; export * from "./models"; export { SecurityCenter } from "./securityCenter"; export * from "./operationsInterfaces"; diff --git a/sdk/security/arm-security/src/models/index.ts b/sdk/security/arm-security/src/models/index.ts index 3b0aa93b527e..aa306fb09722 100644 --- a/sdk/security/arm-security/src/models/index.ts +++ b/sdk/security/arm-security/src/models/index.ts @@ -50,10 +50,14 @@ export type CloudOfferingUnion = | DefenderForDatabasesGcpOffering | DefenderForContainersGcpOffering | CspmMonitorGithubOffering - | CspmMonitorAzureDevOpsOffering; + | CspmMonitorAzureDevOpsOffering + | DefenderCspmAwsOffering + | DefenderCspmGcpOffering + | DefenderForDevOpsGithubOffering + | DefenderForDevOpsAzureDevOpsOffering; export type EnvironmentDataUnion = | EnvironmentData - | AWSEnvironmentData + | AwsEnvironmentData | GcpProjectEnvironmentData | GithubScopeEnvironmentData | AzureDevOpsScopeEnvironmentData; @@ -1794,7 +1798,11 @@ export interface CloudOffering { | "DefenderForDatabasesGcp" | "DefenderForContainersGcp" | "CspmMonitorGithub" - | "CspmMonitorAzureDevOps"; + | "CspmMonitorAzureDevOps" + | "DefenderCspmAws" + | "DefenderCspmGcp" + | "DefenderForDevOpsGithub" + | "DefenderForDevOpsAzureDevOps"; /** * The offering description. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -2068,18 +2076,6 @@ export interface DefenderForServersAwsOfferingArcAutoProvisioning { enabled?: boolean; /** The cloud role ARN in AWS for this feature */ cloudRoleArn?: string; - /** Metadata of Service Principal secret for autoprovisioning */ - servicePrincipalSecretMetadata?: DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata; -} - -/** Metadata of Service Principal secret for autoprovisioning */ -export interface DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata { - /** expiration date of service principal secret */ - expiryDate?: string; - /** region of parameter store where secret is kept */ - parameterStoreRegion?: string; - /** name of secret resource in parameter store */ - parameterNameInStore?: string; } /** The Vulnerability Assessment autoprovisioning configuration */ @@ -2125,7 +2121,7 @@ export interface DefenderForServersAwsOfferingVmScannersConfiguration { /** The scanning mode for the vm scan. */ scanningMode?: ScanningMode; /** VM tags that indicates that VM should not be scanned */ - exclusionTags?: Record; + exclusionTags?: { [propertyName: string]: string }; } /** The ARC autoprovisioning configuration */ @@ -2134,18 +2130,14 @@ export interface DefenderFoDatabasesAwsOfferingArcAutoProvisioning { enabled?: boolean; /** The cloud role ARN in AWS for this feature */ cloudRoleArn?: string; - /** Metadata of Service Principal secret for autoprovisioning */ - servicePrincipalSecretMetadata?: DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata; } -/** Metadata of Service Principal secret for autoprovisioning */ -export interface DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata { - /** expiration date of service principal secret */ - expiryDate?: Date; - /** region of parameter store where secret is kept */ - parameterStoreRegion?: string; - /** name of secret resource in parameter store */ - parameterNameInStore?: string; +/** The RDS configuration */ +export interface DefenderFoDatabasesAwsOfferingRds { + /** Is RDS protection enabled */ + enabled?: boolean; + /** The cloud role ARN in AWS for this feature */ + cloudRoleArn?: string; } /** The native cloud connection configuration */ @@ -2174,16 +2166,6 @@ export interface DefenderForServersGcpOfferingDefenderForServers { export interface DefenderForServersGcpOfferingArcAutoProvisioning { /** Is arc auto provisioning enabled */ enabled?: boolean; - /** Configuration for ARC autoprovisioning */ - configuration?: DefenderForServersGcpOfferingArcAutoProvisioningConfiguration; -} - -/** Configuration for ARC autoprovisioning */ -export interface DefenderForServersGcpOfferingArcAutoProvisioningConfiguration { - /** The Azure service principal client id for agent onboarding */ - clientId?: string; - /** The agent onboarding service account numeric id */ - agentOnboardingServiceAccountNumericId?: string; } /** The Vulnerability Assessment autoprovisioning configuration */ @@ -2218,16 +2200,6 @@ export interface DefenderForServersGcpOfferingSubPlan { export interface DefenderForDatabasesGcpOfferingArcAutoProvisioning { /** Is arc auto provisioning enabled */ enabled?: boolean; - /** Configuration for ARC autoprovisioning */ - configuration?: DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration; -} - -/** Configuration for ARC autoprovisioning */ -export interface DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration { - /** The Azure service principal client id for agent onboarding */ - clientId?: string; - /** The agent onboarding service account numeric id */ - agentOnboardingServiceAccountNumericId?: string; } /** The native cloud connection configuration */ @@ -2254,6 +2226,24 @@ export interface DefenderForContainersGcpOfferingDataPipelineNativeCloudConnecti workloadIdentityProviderId?: string; } +/** The Microsoft Defender for Server VM scanning configuration */ +export interface DefenderCspmAwsOfferingVmScanners { + /** Is Microsoft Defender for Server VM scanning enabled */ + enabled?: boolean; + /** configuration for Microsoft Defender for Server VM scanning */ + configuration?: DefenderCspmAwsOfferingVmScannersConfiguration; +} + +/** configuration for Microsoft Defender for Server VM scanning */ +export interface DefenderCspmAwsOfferingVmScannersConfiguration { + /** The cloud role ARN in AWS for this feature */ + cloudRoleArn?: string; + /** The scanning mode for the vm scan. */ + scanningMode?: ScanningMode; + /** VM tags that indicates that VM should not be scanned */ + exclusionTags?: { [propertyName: string]: string }; +} + /** Governance rule's condition */ export interface Condition { /** The governance rule Condition's Property, e.g. Severity or AssessmentKey, see examples */ @@ -3832,6 +3822,8 @@ export interface DefenderFoDatabasesAwsOffering extends CloudOffering { offeringType: "DefenderForDatabasesAws"; /** The ARC autoprovisioning configuration */ arcAutoProvisioning?: DefenderFoDatabasesAwsOfferingArcAutoProvisioning; + /** The RDS configuration */ + rds?: DefenderFoDatabasesAwsOfferingRds; } /** The information protection for AWS offering */ @@ -3904,8 +3896,34 @@ export interface CspmMonitorAzureDevOpsOffering extends CloudOffering { offeringType: "CspmMonitorAzureDevOps"; } +/** The CSPM P1 for Aws offering */ +export interface DefenderCspmAwsOffering extends CloudOffering { + /** Polymorphic discriminator, which specifies the different types this object can be */ + offeringType: "DefenderCspmAws"; + /** The Microsoft Defender for Server VM scanning configuration */ + vmScanners?: DefenderCspmAwsOfferingVmScanners; +} + +/** The CSPM P1 for GCP offering */ +export interface DefenderCspmGcpOffering extends CloudOffering { + /** Polymorphic discriminator, which specifies the different types this object can be */ + offeringType: "DefenderCspmGcp"; +} + +/** The Defender for DevOps for Github offering */ +export interface DefenderForDevOpsGithubOffering extends CloudOffering { + /** Polymorphic discriminator, which specifies the different types this object can be */ + offeringType: "DefenderForDevOpsGithub"; +} + +/** The Defender for DevOps for Azure DevOps offering */ +export interface DefenderForDevOpsAzureDevOpsOffering extends CloudOffering { + /** Polymorphic discriminator, which specifies the different types this object can be */ + offeringType: "DefenderForDevOpsAzureDevOps"; +} + /** The aws connector environment data */ -export interface AWSEnvironmentData extends EnvironmentData { +export interface AwsEnvironmentData extends EnvironmentData { /** Polymorphic discriminator, which specifies the different types this object can be */ environmentType: "AwsAccount"; /** The AWS account's organizational data */ @@ -6406,7 +6424,15 @@ export enum KnownOfferingType { /** DefenderForContainersGcp */ DefenderForContainersGcp = "DefenderForContainersGcp", /** DefenderForDatabasesGcp */ - DefenderForDatabasesGcp = "DefenderForDatabasesGcp" + DefenderForDatabasesGcp = "DefenderForDatabasesGcp", + /** DefenderCspmAws */ + DefenderCspmAws = "DefenderCspmAws", + /** DefenderCspmGcp */ + DefenderCspmGcp = "DefenderCspmGcp", + /** DefenderForDevOpsGithub */ + DefenderForDevOpsGithub = "DefenderForDevOpsGithub", + /** DefenderForDevOpsAzureDevOps */ + DefenderForDevOpsAzureDevOps = "DefenderForDevOpsAzureDevOps" } /** @@ -6424,7 +6450,11 @@ export enum KnownOfferingType { * **CspmMonitorAzureDevOps** \ * **DefenderForServersGcp** \ * **DefenderForContainersGcp** \ - * **DefenderForDatabasesGcp** + * **DefenderForDatabasesGcp** \ + * **DefenderCspmAws** \ + * **DefenderCspmGcp** \ + * **DefenderForDevOpsGithub** \ + * **DefenderForDevOpsAzureDevOps** */ export type OfferingType = string; @@ -6669,6 +6699,8 @@ export type GovernanceRuleConditionOperator = string; export enum KnownApplicationConditionOperator { /** Checks that the string value of the data defined in Property contains the given value */ Contains = "Contains", + /** Checks that the string value of the data defined in Property equals the given value */ + Equals = "Equals", /** Checks that the string value of the data defined in Property equals any of the given values (exact fit) */ In = "In" } @@ -6679,6 +6711,7 @@ export enum KnownApplicationConditionOperator { * this enum contains the known values that the service supports. * ### Known values supported by the service * **Contains**: Checks that the string value of the data defined in Property contains the given value \ + * **Equals**: Checks that the string value of the data defined in Property equals the given value \ * **In**: Checks that the string value of the data defined in Property equals any of the given values (exact fit) */ export type ApplicationConditionOperator = string; diff --git a/sdk/security/arm-security/src/models/mappers.ts b/sdk/security/arm-security/src/models/mappers.ts index a95f3f2f349c..75aec6379647 100644 --- a/sdk/security/arm-security/src/models/mappers.ts +++ b/sdk/security/arm-security/src/models/mappers.ts @@ -5066,42 +5066,6 @@ export const DefenderForServersAwsOfferingArcAutoProvisioning: coreClient.Compos type: { name: "String" } - }, - servicePrincipalSecretMetadata: { - serializedName: "servicePrincipalSecretMetadata", - type: { - name: "Composite", - className: - "DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata" - } - } - } - } -}; - -export const DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: - "DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata", - modelProperties: { - expiryDate: { - serializedName: "expiryDate", - type: { - name: "String" - } - }, - parameterStoreRegion: { - serializedName: "parameterStoreRegion", - type: { - name: "String" - } - }, - parameterNameInStore: { - serializedName: "parameterNameInStore", - type: { - name: "String" - } } } } @@ -5225,7 +5189,7 @@ export const DefenderForServersAwsOfferingVmScannersConfiguration: coreClient.Co serializedName: "exclusionTags", type: { name: "Dictionary", - value: { type: { name: "any" } } + value: { type: { name: "String" } } } } } @@ -5248,39 +5212,24 @@ export const DefenderFoDatabasesAwsOfferingArcAutoProvisioning: coreClient.Compo type: { name: "String" } - }, - servicePrincipalSecretMetadata: { - serializedName: "servicePrincipalSecretMetadata", - type: { - name: "Composite", - className: - "DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata" - } } } } }; -export const DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata: coreClient.CompositeMapper = { +export const DefenderFoDatabasesAwsOfferingRds: coreClient.CompositeMapper = { type: { name: "Composite", - className: - "DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata", + className: "DefenderFoDatabasesAwsOfferingRds", modelProperties: { - expiryDate: { - serializedName: "expiryDate", - type: { - name: "DateTime" - } - }, - parameterStoreRegion: { - serializedName: "parameterStoreRegion", + enabled: { + serializedName: "enabled", type: { - name: "String" + name: "Boolean" } }, - parameterNameInStore: { - serializedName: "parameterNameInStore", + cloudRoleArn: { + serializedName: "cloudRoleArn", type: { name: "String" } @@ -5356,35 +5305,6 @@ export const DefenderForServersGcpOfferingArcAutoProvisioning: coreClient.Compos type: { name: "Boolean" } - }, - configuration: { - serializedName: "configuration", - type: { - name: "Composite", - className: - "DefenderForServersGcpOfferingArcAutoProvisioningConfiguration" - } - } - } - } -}; - -export const DefenderForServersGcpOfferingArcAutoProvisioningConfiguration: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DefenderForServersGcpOfferingArcAutoProvisioningConfiguration", - modelProperties: { - clientId: { - serializedName: "clientId", - type: { - name: "String" - } - }, - agentOnboardingServiceAccountNumericId: { - serializedName: "agentOnboardingServiceAccountNumericId", - type: { - name: "String" - } } } } @@ -5475,33 +5395,25 @@ export const DefenderForDatabasesGcpOfferingArcAutoProvisioning: coreClient.Comp type: { name: "Boolean" } - }, - configuration: { - serializedName: "configuration", - type: { - name: "Composite", - className: - "DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration" - } } } } }; -export const DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration: coreClient.CompositeMapper = { +export const DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning: coreClient.CompositeMapper = { type: { name: "Composite", className: - "DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration", + "DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning", modelProperties: { - clientId: { - serializedName: "clientId", + serviceAccountEmailAddress: { + serializedName: "serviceAccountEmailAddress", type: { name: "String" } }, - agentOnboardingServiceAccountNumericId: { - serializedName: "agentOnboardingServiceAccountNumericId", + workloadIdentityProviderId: { + serializedName: "workloadIdentityProviderId", type: { name: "String" } @@ -5510,11 +5422,10 @@ export const DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration: co } }; -export const DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning: coreClient.CompositeMapper = { +export const DefenderForContainersGcpOfferingNativeCloudConnection: coreClient.CompositeMapper = { type: { name: "Composite", - className: - "DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning", + className: "DefenderForContainersGcpOfferingNativeCloudConnection", modelProperties: { serviceAccountEmailAddress: { serializedName: "serviceAccountEmailAddress", @@ -5532,10 +5443,11 @@ export const DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvision } }; -export const DefenderForContainersGcpOfferingNativeCloudConnection: coreClient.CompositeMapper = { +export const DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection: coreClient.CompositeMapper = { type: { name: "Composite", - className: "DefenderForContainersGcpOfferingNativeCloudConnection", + className: + "DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection", modelProperties: { serviceAccountEmailAddress: { serializedName: "serviceAccountEmailAddress", @@ -5553,23 +5465,51 @@ export const DefenderForContainersGcpOfferingNativeCloudConnection: coreClient.C } }; -export const DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection: coreClient.CompositeMapper = { +export const DefenderCspmAwsOfferingVmScanners: coreClient.CompositeMapper = { type: { name: "Composite", - className: - "DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection", + className: "DefenderCspmAwsOfferingVmScanners", modelProperties: { - serviceAccountEmailAddress: { - serializedName: "serviceAccountEmailAddress", + enabled: { + serializedName: "enabled", + type: { + name: "Boolean" + } + }, + configuration: { + serializedName: "configuration", + type: { + name: "Composite", + className: "DefenderCspmAwsOfferingVmScannersConfiguration" + } + } + } + } +}; + +export const DefenderCspmAwsOfferingVmScannersConfiguration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DefenderCspmAwsOfferingVmScannersConfiguration", + modelProperties: { + cloudRoleArn: { + serializedName: "cloudRoleArn", type: { name: "String" } }, - workloadIdentityProviderId: { - serializedName: "workloadIdentityProviderId", + scanningMode: { + serializedName: "scanningMode", type: { name: "String" } + }, + exclusionTags: { + serializedName: "exclusionTags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } } } } @@ -9287,6 +9227,13 @@ export const DefenderFoDatabasesAwsOffering: coreClient.CompositeMapper = { name: "Composite", className: "DefenderFoDatabasesAwsOfferingArcAutoProvisioning" } + }, + rds: { + serializedName: "rds", + type: { + name: "Composite", + className: "DefenderFoDatabasesAwsOfferingRds" + } } } } @@ -9480,11 +9427,70 @@ export const CspmMonitorAzureDevOpsOffering: coreClient.CompositeMapper = { } }; -export const AWSEnvironmentData: coreClient.CompositeMapper = { +export const DefenderCspmAwsOffering: coreClient.CompositeMapper = { + serializedName: "DefenderCspmAws", + type: { + name: "Composite", + className: "DefenderCspmAwsOffering", + uberParent: "CloudOffering", + polymorphicDiscriminator: CloudOffering.type.polymorphicDiscriminator, + modelProperties: { + ...CloudOffering.type.modelProperties, + vmScanners: { + serializedName: "vmScanners", + type: { + name: "Composite", + className: "DefenderCspmAwsOfferingVmScanners" + } + } + } + } +}; + +export const DefenderCspmGcpOffering: coreClient.CompositeMapper = { + serializedName: "DefenderCspmGcp", + type: { + name: "Composite", + className: "DefenderCspmGcpOffering", + uberParent: "CloudOffering", + polymorphicDiscriminator: CloudOffering.type.polymorphicDiscriminator, + modelProperties: { + ...CloudOffering.type.modelProperties + } + } +}; + +export const DefenderForDevOpsGithubOffering: coreClient.CompositeMapper = { + serializedName: "DefenderForDevOpsGithub", + type: { + name: "Composite", + className: "DefenderForDevOpsGithubOffering", + uberParent: "CloudOffering", + polymorphicDiscriminator: CloudOffering.type.polymorphicDiscriminator, + modelProperties: { + ...CloudOffering.type.modelProperties + } + } +}; + +export const DefenderForDevOpsAzureDevOpsOffering: coreClient.CompositeMapper = { + serializedName: "DefenderForDevOpsAzureDevOps", + type: { + name: "Composite", + className: "DefenderForDevOpsAzureDevOpsOffering", + uberParent: "CloudOffering", + polymorphicDiscriminator: CloudOffering.type.polymorphicDiscriminator, + modelProperties: { + ...CloudOffering.type.modelProperties + } + } +}; + +export const AwsEnvironmentData: coreClient.CompositeMapper = { serializedName: "AwsAccount", type: { name: "Composite", - className: "AWSEnvironmentData", + className: "AwsEnvironmentData", uberParent: "EnvironmentData", polymorphicDiscriminator: EnvironmentData.type.polymorphicDiscriminator, modelProperties: { @@ -10423,7 +10429,11 @@ export let discriminators = { "CloudOffering.DefenderForContainersGcp": DefenderForContainersGcpOffering, "CloudOffering.CspmMonitorGithub": CspmMonitorGithubOffering, "CloudOffering.CspmMonitorAzureDevOps": CspmMonitorAzureDevOpsOffering, - "EnvironmentData.AwsAccount": AWSEnvironmentData, + "CloudOffering.DefenderCspmAws": DefenderCspmAwsOffering, + "CloudOffering.DefenderCspmGcp": DefenderCspmGcpOffering, + "CloudOffering.DefenderForDevOpsGithub": DefenderForDevOpsGithubOffering, + "CloudOffering.DefenderForDevOpsAzureDevOps": DefenderForDevOpsAzureDevOpsOffering, + "EnvironmentData.AwsAccount": AwsEnvironmentData, "EnvironmentData.GcpProject": GcpProjectEnvironmentData, "EnvironmentData.GithubScope": GithubScopeEnvironmentData, "EnvironmentData.AzureDevOpsScope": AzureDevOpsScopeEnvironmentData, diff --git a/sdk/security/arm-security/src/models/parameters.ts b/sdk/security/arm-security/src/models/parameters.ts index d6a320eaa07d..19de7536275b 100644 --- a/sdk/security/arm-security/src/models/parameters.ts +++ b/sdk/security/arm-security/src/models/parameters.ts @@ -1093,7 +1093,7 @@ export const softwareName: OperationURLParameter = { export const apiVersion17: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2022-05-01-preview", + defaultValue: "2022-08-01-preview", isConstant: true, serializedName: "api-version", type: { diff --git a/sdk/security/arm-security/src/operations/adaptiveNetworkHardenings.ts b/sdk/security/arm-security/src/operations/adaptiveNetworkHardenings.ts index 907199d87256..969049678fd5 100644 --- a/sdk/security/arm-security/src/operations/adaptiveNetworkHardenings.ts +++ b/sdk/security/arm-security/src/operations/adaptiveNetworkHardenings.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { AdaptiveNetworkHardenings } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -70,13 +71,17 @@ export class AdaptiveNetworkHardeningsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listByExtendedResourcePagingPage( resourceGroupName, resourceNamespace, resourceType, resourceName, - options + options, + settings ); } }; @@ -87,17 +92,24 @@ export class AdaptiveNetworkHardeningsImpl resourceNamespace: string, resourceType: string, resourceName: string, - options?: AdaptiveNetworkHardeningsListByExtendedResourceOptionalParams + options?: AdaptiveNetworkHardeningsListByExtendedResourceOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByExtendedResource( - resourceGroupName, - resourceNamespace, - resourceType, - resourceName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AdaptiveNetworkHardeningsListByExtendedResourceResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByExtendedResource( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByExtendedResourceNext( resourceGroupName, @@ -108,7 +120,9 @@ export class AdaptiveNetworkHardeningsImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/alerts.ts b/sdk/security/arm-security/src/operations/alerts.ts index 470c52268fa5..3c611b84603b 100644 --- a/sdk/security/arm-security/src/operations/alerts.ts +++ b/sdk/security/arm-security/src/operations/alerts.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Alerts } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,15 +19,15 @@ import { Alert, AlertsListNextOptionalParams, AlertsListOptionalParams, + AlertsListResponse, AlertsListByResourceGroupNextOptionalParams, AlertsListByResourceGroupOptionalParams, + AlertsListByResourceGroupResponse, AlertsListSubscriptionLevelByRegionNextOptionalParams, AlertsListSubscriptionLevelByRegionOptionalParams, + AlertsListSubscriptionLevelByRegionResponse, AlertsListResourceGroupLevelByRegionNextOptionalParams, AlertsListResourceGroupLevelByRegionOptionalParams, - AlertsListResponse, - AlertsListByResourceGroupResponse, - AlertsListSubscriptionLevelByRegionResponse, AlertsListResourceGroupLevelByRegionResponse, AlertsGetSubscriptionLevelOptionalParams, AlertsGetSubscriptionLevelResponse, @@ -76,22 +77,34 @@ export class AlertsImpl implements Alerts { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: AlertsListOptionalParams + options?: AlertsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AlertsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -121,19 +134,33 @@ export class AlertsImpl implements Alerts { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: AlertsListByResourceGroupOptionalParams + options?: AlertsListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AlertsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -141,7 +168,9 @@ export class AlertsImpl implements Alerts { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -178,10 +207,14 @@ export class AlertsImpl implements Alerts { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listSubscriptionLevelByRegionPagingPage( ascLocation, - options + options, + settings ); } }; @@ -189,14 +222,18 @@ export class AlertsImpl implements Alerts { private async *listSubscriptionLevelByRegionPagingPage( ascLocation: string, - options?: AlertsListSubscriptionLevelByRegionOptionalParams + options?: AlertsListSubscriptionLevelByRegionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listSubscriptionLevelByRegion( - ascLocation, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AlertsListSubscriptionLevelByRegionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listSubscriptionLevelByRegion(ascLocation, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listSubscriptionLevelByRegionNext( ascLocation, @@ -204,7 +241,9 @@ export class AlertsImpl implements Alerts { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -246,11 +285,15 @@ export class AlertsImpl implements Alerts { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listResourceGroupLevelByRegionPagingPage( ascLocation, resourceGroupName, - options + options, + settings ); } }; @@ -259,15 +302,22 @@ export class AlertsImpl implements Alerts { private async *listResourceGroupLevelByRegionPagingPage( ascLocation: string, resourceGroupName: string, - options?: AlertsListResourceGroupLevelByRegionOptionalParams + options?: AlertsListResourceGroupLevelByRegionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listResourceGroupLevelByRegion( - ascLocation, - resourceGroupName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AlertsListResourceGroupLevelByRegionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listResourceGroupLevelByRegion( + ascLocation, + resourceGroupName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listResourceGroupLevelByRegionNext( ascLocation, @@ -276,7 +326,9 @@ export class AlertsImpl implements Alerts { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/alertsSuppressionRules.ts b/sdk/security/arm-security/src/operations/alertsSuppressionRules.ts index 45ff0c938c6e..b90563386809 100644 --- a/sdk/security/arm-security/src/operations/alertsSuppressionRules.ts +++ b/sdk/security/arm-security/src/operations/alertsSuppressionRules.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { AlertsSuppressionRules } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -53,22 +54,34 @@ export class AlertsSuppressionRulesImpl implements AlertsSuppressionRules { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: AlertsSuppressionRulesListOptionalParams + options?: AlertsSuppressionRulesListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AlertsSuppressionRulesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/allowedConnections.ts b/sdk/security/arm-security/src/operations/allowedConnections.ts index c1c3926e0f6d..74c87b498b2d 100644 --- a/sdk/security/arm-security/src/operations/allowedConnections.ts +++ b/sdk/security/arm-security/src/operations/allowedConnections.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { AllowedConnections } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { AllowedConnectionsResource, AllowedConnectionsListNextOptionalParams, AllowedConnectionsListOptionalParams, + AllowedConnectionsListResponse, AllowedConnectionsListByHomeRegionNextOptionalParams, AllowedConnectionsListByHomeRegionOptionalParams, - AllowedConnectionsListResponse, AllowedConnectionsListByHomeRegionResponse, ConnectionType, AllowedConnectionsGetOptionalParams, @@ -55,22 +56,34 @@ export class AllowedConnectionsImpl implements AllowedConnections { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: AllowedConnectionsListOptionalParams + options?: AllowedConnectionsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AllowedConnectionsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -100,19 +113,29 @@ export class AllowedConnectionsImpl implements AllowedConnections { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByHomeRegionPagingPage(ascLocation, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByHomeRegionPagingPage(ascLocation, options, settings); } }; } private async *listByHomeRegionPagingPage( ascLocation: string, - options?: AllowedConnectionsListByHomeRegionOptionalParams + options?: AllowedConnectionsListByHomeRegionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByHomeRegion(ascLocation, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AllowedConnectionsListByHomeRegionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByHomeRegion(ascLocation, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByHomeRegionNext( ascLocation, @@ -120,7 +143,9 @@ export class AllowedConnectionsImpl implements AllowedConnections { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/applications.ts b/sdk/security/arm-security/src/operations/applications.ts index 10bb96e03553..089098026c88 100644 --- a/sdk/security/arm-security/src/operations/applications.ts +++ b/sdk/security/arm-security/src/operations/applications.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Applications } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -48,22 +49,34 @@ export class ApplicationsImpl implements Applications { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: ApplicationsListOptionalParams + options?: ApplicationsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ApplicationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/assessments.ts b/sdk/security/arm-security/src/operations/assessments.ts index b4d41a650f4a..1c9aaadd1d22 100644 --- a/sdk/security/arm-security/src/operations/assessments.ts +++ b/sdk/security/arm-security/src/operations/assessments.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Assessments } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -58,23 +59,35 @@ export class AssessmentsImpl implements Assessments { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(scope, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(scope, options, settings); } }; } private async *listPagingPage( scope: string, - options?: AssessmentsListOptionalParams + options?: AssessmentsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(scope, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AssessmentsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(scope, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(scope, continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/assessmentsMetadata.ts b/sdk/security/arm-security/src/operations/assessmentsMetadata.ts index 3376958008cf..7ba2627c3d1b 100644 --- a/sdk/security/arm-security/src/operations/assessmentsMetadata.ts +++ b/sdk/security/arm-security/src/operations/assessmentsMetadata.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { AssessmentsMetadata } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,12 +17,12 @@ import { SecurityAssessmentMetadataResponse, AssessmentsMetadataListNextOptionalParams, AssessmentsMetadataListOptionalParams, + AssessmentsMetadataListResponse, AssessmentsMetadataListBySubscriptionNextOptionalParams, AssessmentsMetadataListBySubscriptionOptionalParams, - AssessmentsMetadataListResponse, + AssessmentsMetadataListBySubscriptionResponse, AssessmentsMetadataGetOptionalParams, AssessmentsMetadataGetResponse, - AssessmentsMetadataListBySubscriptionResponse, AssessmentsMetadataGetInSubscriptionOptionalParams, AssessmentsMetadataGetInSubscriptionResponse, AssessmentsMetadataCreateInSubscriptionOptionalParams, @@ -59,22 +60,34 @@ export class AssessmentsMetadataImpl implements AssessmentsMetadata { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: AssessmentsMetadataListOptionalParams + options?: AssessmentsMetadataListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AssessmentsMetadataListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -101,22 +114,34 @@ export class AssessmentsMetadataImpl implements AssessmentsMetadata { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( - options?: AssessmentsMetadataListBySubscriptionOptionalParams + options?: AssessmentsMetadataListBySubscriptionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AssessmentsMetadataListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/autoProvisioningSettings.ts b/sdk/security/arm-security/src/operations/autoProvisioningSettings.ts index 038b34712c11..477d3951fb1b 100644 --- a/sdk/security/arm-security/src/operations/autoProvisioningSettings.ts +++ b/sdk/security/arm-security/src/operations/autoProvisioningSettings.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { AutoProvisioningSettings } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -52,22 +53,34 @@ export class AutoProvisioningSettingsImpl implements AutoProvisioningSettings { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: AutoProvisioningSettingsListOptionalParams + options?: AutoProvisioningSettingsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AutoProvisioningSettingsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/automations.ts b/sdk/security/arm-security/src/operations/automations.ts index 2d8fc989b267..68b96a1066c3 100644 --- a/sdk/security/arm-security/src/operations/automations.ts +++ b/sdk/security/arm-security/src/operations/automations.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Automations } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { Automation, AutomationsListNextOptionalParams, AutomationsListOptionalParams, + AutomationsListResponse, AutomationsListByResourceGroupNextOptionalParams, AutomationsListByResourceGroupOptionalParams, - AutomationsListResponse, AutomationsListByResourceGroupResponse, AutomationsGetOptionalParams, AutomationsGetResponse, @@ -60,22 +61,34 @@ export class AutomationsImpl implements Automations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: AutomationsListOptionalParams + options?: AutomationsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AutomationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -106,19 +119,33 @@ export class AutomationsImpl implements Automations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: AutomationsListByResourceGroupOptionalParams + options?: AutomationsListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: AutomationsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -126,7 +153,9 @@ export class AutomationsImpl implements Automations { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/complianceResults.ts b/sdk/security/arm-security/src/operations/complianceResults.ts index a854803d3bb7..658300395eed 100644 --- a/sdk/security/arm-security/src/operations/complianceResults.ts +++ b/sdk/security/arm-security/src/operations/complianceResults.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { ComplianceResults } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -54,23 +55,35 @@ export class ComplianceResultsImpl implements ComplianceResults { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(scope, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(scope, options, settings); } }; } private async *listPagingPage( scope: string, - options?: ComplianceResultsListOptionalParams + options?: ComplianceResultsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(scope, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ComplianceResultsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(scope, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(scope, continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/compliances.ts b/sdk/security/arm-security/src/operations/compliances.ts index cb826dcbfb31..3881d6b2afd0 100644 --- a/sdk/security/arm-security/src/operations/compliances.ts +++ b/sdk/security/arm-security/src/operations/compliances.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Compliances } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -54,23 +55,35 @@ export class CompliancesImpl implements Compliances { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(scope, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(scope, options, settings); } }; } private async *listPagingPage( scope: string, - options?: CompliancesListOptionalParams + options?: CompliancesListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(scope, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: CompliancesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(scope, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(scope, continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/connectors.ts b/sdk/security/arm-security/src/operations/connectors.ts index 4691220e51f7..f158339dbadc 100644 --- a/sdk/security/arm-security/src/operations/connectors.ts +++ b/sdk/security/arm-security/src/operations/connectors.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Connectors } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -53,22 +54,34 @@ export class ConnectorsImpl implements Connectors { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: ConnectorsListOptionalParams + options?: ConnectorsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ConnectorsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/customAssessmentAutomations.ts b/sdk/security/arm-security/src/operations/customAssessmentAutomations.ts index e433b773bac0..5cb27bd84b4d 100644 --- a/sdk/security/arm-security/src/operations/customAssessmentAutomations.ts +++ b/sdk/security/arm-security/src/operations/customAssessmentAutomations.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { CustomAssessmentAutomations } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,16 +17,16 @@ import { CustomAssessmentAutomation, CustomAssessmentAutomationsListByResourceGroupNextOptionalParams, CustomAssessmentAutomationsListByResourceGroupOptionalParams, + CustomAssessmentAutomationsListByResourceGroupResponse, CustomAssessmentAutomationsListBySubscriptionNextOptionalParams, CustomAssessmentAutomationsListBySubscriptionOptionalParams, + CustomAssessmentAutomationsListBySubscriptionResponse, CustomAssessmentAutomationsGetOptionalParams, CustomAssessmentAutomationsGetResponse, CustomAssessmentAutomationRequest, CustomAssessmentAutomationsCreateOptionalParams, CustomAssessmentAutomationsCreateResponse, CustomAssessmentAutomationsDeleteOptionalParams, - CustomAssessmentAutomationsListByResourceGroupResponse, - CustomAssessmentAutomationsListBySubscriptionResponse, CustomAssessmentAutomationsListByResourceGroupNextResponse, CustomAssessmentAutomationsListBySubscriptionNextResponse } from "../models"; @@ -62,19 +63,33 @@ export class CustomAssessmentAutomationsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: CustomAssessmentAutomationsListByResourceGroupOptionalParams + options?: CustomAssessmentAutomationsListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: CustomAssessmentAutomationsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -82,7 +97,9 @@ export class CustomAssessmentAutomationsImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -113,22 +130,34 @@ export class CustomAssessmentAutomationsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( - options?: CustomAssessmentAutomationsListBySubscriptionOptionalParams + options?: CustomAssessmentAutomationsListBySubscriptionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: CustomAssessmentAutomationsListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/customEntityStoreAssignments.ts b/sdk/security/arm-security/src/operations/customEntityStoreAssignments.ts index 1e938346abfa..6053f992baee 100644 --- a/sdk/security/arm-security/src/operations/customEntityStoreAssignments.ts +++ b/sdk/security/arm-security/src/operations/customEntityStoreAssignments.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { CustomEntityStoreAssignments } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,16 +17,16 @@ import { CustomEntityStoreAssignment, CustomEntityStoreAssignmentsListByResourceGroupNextOptionalParams, CustomEntityStoreAssignmentsListByResourceGroupOptionalParams, + CustomEntityStoreAssignmentsListByResourceGroupResponse, CustomEntityStoreAssignmentsListBySubscriptionNextOptionalParams, CustomEntityStoreAssignmentsListBySubscriptionOptionalParams, + CustomEntityStoreAssignmentsListBySubscriptionResponse, CustomEntityStoreAssignmentsGetOptionalParams, CustomEntityStoreAssignmentsGetResponse, CustomEntityStoreAssignmentRequest, CustomEntityStoreAssignmentsCreateOptionalParams, CustomEntityStoreAssignmentsCreateResponse, CustomEntityStoreAssignmentsDeleteOptionalParams, - CustomEntityStoreAssignmentsListByResourceGroupResponse, - CustomEntityStoreAssignmentsListBySubscriptionResponse, CustomEntityStoreAssignmentsListByResourceGroupNextResponse, CustomEntityStoreAssignmentsListBySubscriptionNextResponse } from "../models"; @@ -62,19 +63,33 @@ export class CustomEntityStoreAssignmentsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: CustomEntityStoreAssignmentsListByResourceGroupOptionalParams + options?: CustomEntityStoreAssignmentsListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: CustomEntityStoreAssignmentsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -82,7 +97,9 @@ export class CustomEntityStoreAssignmentsImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -113,22 +130,34 @@ export class CustomEntityStoreAssignmentsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( - options?: CustomEntityStoreAssignmentsListBySubscriptionOptionalParams + options?: CustomEntityStoreAssignmentsListBySubscriptionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: CustomEntityStoreAssignmentsListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/deviceSecurityGroups.ts b/sdk/security/arm-security/src/operations/deviceSecurityGroups.ts index 333d07ae91b6..1973fed41420 100644 --- a/sdk/security/arm-security/src/operations/deviceSecurityGroups.ts +++ b/sdk/security/arm-security/src/operations/deviceSecurityGroups.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { DeviceSecurityGroups } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -55,23 +56,35 @@ export class DeviceSecurityGroupsImpl implements DeviceSecurityGroups { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceId, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(resourceId, options, settings); } }; } private async *listPagingPage( resourceId: string, - options?: DeviceSecurityGroupsListOptionalParams + options?: DeviceSecurityGroupsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceId, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: DeviceSecurityGroupsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceId, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(resourceId, continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/discoveredSecuritySolutions.ts b/sdk/security/arm-security/src/operations/discoveredSecuritySolutions.ts index ec304fd3a57f..0bc7fd9e81b1 100644 --- a/sdk/security/arm-security/src/operations/discoveredSecuritySolutions.ts +++ b/sdk/security/arm-security/src/operations/discoveredSecuritySolutions.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { DiscoveredSecuritySolutions } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { DiscoveredSecuritySolution, DiscoveredSecuritySolutionsListNextOptionalParams, DiscoveredSecuritySolutionsListOptionalParams, + DiscoveredSecuritySolutionsListResponse, DiscoveredSecuritySolutionsListByHomeRegionNextOptionalParams, DiscoveredSecuritySolutionsListByHomeRegionOptionalParams, - DiscoveredSecuritySolutionsListResponse, DiscoveredSecuritySolutionsListByHomeRegionResponse, DiscoveredSecuritySolutionsGetOptionalParams, DiscoveredSecuritySolutionsGetResponse, @@ -55,22 +56,34 @@ export class DiscoveredSecuritySolutionsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: DiscoveredSecuritySolutionsListOptionalParams + options?: DiscoveredSecuritySolutionsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: DiscoveredSecuritySolutionsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -100,19 +113,29 @@ export class DiscoveredSecuritySolutionsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByHomeRegionPagingPage(ascLocation, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByHomeRegionPagingPage(ascLocation, options, settings); } }; } private async *listByHomeRegionPagingPage( ascLocation: string, - options?: DiscoveredSecuritySolutionsListByHomeRegionOptionalParams + options?: DiscoveredSecuritySolutionsListByHomeRegionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByHomeRegion(ascLocation, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: DiscoveredSecuritySolutionsListByHomeRegionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByHomeRegion(ascLocation, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByHomeRegionNext( ascLocation, @@ -120,7 +143,9 @@ export class DiscoveredSecuritySolutionsImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/externalSecuritySolutions.ts b/sdk/security/arm-security/src/operations/externalSecuritySolutions.ts index 9a0a7cc5f08d..4c6438c391c9 100644 --- a/sdk/security/arm-security/src/operations/externalSecuritySolutions.ts +++ b/sdk/security/arm-security/src/operations/externalSecuritySolutions.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { ExternalSecuritySolutions } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { ExternalSecuritySolution, ExternalSecuritySolutionsListNextOptionalParams, ExternalSecuritySolutionsListOptionalParams, + ExternalSecuritySolutionsListResponse, ExternalSecuritySolutionsListByHomeRegionNextOptionalParams, ExternalSecuritySolutionsListByHomeRegionOptionalParams, - ExternalSecuritySolutionsListResponse, ExternalSecuritySolutionsListByHomeRegionResponse, ExternalSecuritySolutionsGetOptionalParams, ExternalSecuritySolutionsGetResponse, @@ -55,22 +56,34 @@ export class ExternalSecuritySolutionsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: ExternalSecuritySolutionsListOptionalParams + options?: ExternalSecuritySolutionsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ExternalSecuritySolutionsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -100,19 +113,29 @@ export class ExternalSecuritySolutionsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByHomeRegionPagingPage(ascLocation, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByHomeRegionPagingPage(ascLocation, options, settings); } }; } private async *listByHomeRegionPagingPage( ascLocation: string, - options?: ExternalSecuritySolutionsListByHomeRegionOptionalParams + options?: ExternalSecuritySolutionsListByHomeRegionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByHomeRegion(ascLocation, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: ExternalSecuritySolutionsListByHomeRegionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByHomeRegion(ascLocation, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByHomeRegionNext( ascLocation, @@ -120,7 +143,9 @@ export class ExternalSecuritySolutionsImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/governanceAssignments.ts b/sdk/security/arm-security/src/operations/governanceAssignments.ts index 06bf4668034d..31f0228ed73e 100644 --- a/sdk/security/arm-security/src/operations/governanceAssignments.ts +++ b/sdk/security/arm-security/src/operations/governanceAssignments.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { GovernanceAssignments } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -59,8 +60,11 @@ export class GovernanceAssignmentsImpl implements GovernanceAssignments { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(scope, assessmentName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(scope, assessmentName, options, settings); } }; } @@ -68,11 +72,18 @@ export class GovernanceAssignmentsImpl implements GovernanceAssignments { private async *listPagingPage( scope: string, assessmentName: string, - options?: GovernanceAssignmentsListOptionalParams + options?: GovernanceAssignmentsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(scope, assessmentName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: GovernanceAssignmentsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(scope, assessmentName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( scope, @@ -81,7 +92,9 @@ export class GovernanceAssignmentsImpl implements GovernanceAssignments { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/governanceRuleOperations.ts b/sdk/security/arm-security/src/operations/governanceRuleOperations.ts index ab0eb8f0474b..7570f62f879b 100644 --- a/sdk/security/arm-security/src/operations/governanceRuleOperations.ts +++ b/sdk/security/arm-security/src/operations/governanceRuleOperations.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { GovernanceRuleOperations } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -48,22 +49,34 @@ export class GovernanceRuleOperationsImpl implements GovernanceRuleOperations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: GovernanceRuleListOptionalParams + options?: GovernanceRuleListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: GovernanceRuleListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/informationProtectionPolicies.ts b/sdk/security/arm-security/src/operations/informationProtectionPolicies.ts index fb81b2d13521..308b5aad1276 100644 --- a/sdk/security/arm-security/src/operations/informationProtectionPolicies.ts +++ b/sdk/security/arm-security/src/operations/informationProtectionPolicies.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { InformationProtectionPolicies } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,12 +17,12 @@ import { InformationProtectionPolicy, InformationProtectionPoliciesListNextOptionalParams, InformationProtectionPoliciesListOptionalParams, + InformationProtectionPoliciesListResponse, InformationProtectionPolicyName, InformationProtectionPoliciesGetOptionalParams, InformationProtectionPoliciesGetResponse, InformationProtectionPoliciesCreateOrUpdateOptionalParams, InformationProtectionPoliciesCreateOrUpdateResponse, - InformationProtectionPoliciesListResponse, InformationProtectionPoliciesListNextResponse } from "../models"; @@ -58,23 +59,35 @@ export class InformationProtectionPoliciesImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(scope, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(scope, options, settings); } }; } private async *listPagingPage( scope: string, - options?: InformationProtectionPoliciesListOptionalParams + options?: InformationProtectionPoliciesListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(scope, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: InformationProtectionPoliciesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(scope, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(scope, continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/ingestionSettings.ts b/sdk/security/arm-security/src/operations/ingestionSettings.ts index 793393858fd8..20e49b6265d6 100644 --- a/sdk/security/arm-security/src/operations/ingestionSettings.ts +++ b/sdk/security/arm-security/src/operations/ingestionSettings.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { IngestionSettings } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -58,22 +59,34 @@ export class IngestionSettingsImpl implements IngestionSettings { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: IngestionSettingsListOptionalParams + options?: IngestionSettingsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: IngestionSettingsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/iotSecuritySolution.ts b/sdk/security/arm-security/src/operations/iotSecuritySolution.ts index 622225204c33..da2006151614 100644 --- a/sdk/security/arm-security/src/operations/iotSecuritySolution.ts +++ b/sdk/security/arm-security/src/operations/iotSecuritySolution.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { IotSecuritySolution } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { IoTSecuritySolutionModel, IotSecuritySolutionListBySubscriptionNextOptionalParams, IotSecuritySolutionListBySubscriptionOptionalParams, + IotSecuritySolutionListBySubscriptionResponse, IotSecuritySolutionListByResourceGroupNextOptionalParams, IotSecuritySolutionListByResourceGroupOptionalParams, - IotSecuritySolutionListBySubscriptionResponse, IotSecuritySolutionListByResourceGroupResponse, IotSecuritySolutionGetOptionalParams, IotSecuritySolutionGetResponse, @@ -60,22 +61,34 @@ export class IotSecuritySolutionImpl implements IotSecuritySolution { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( - options?: IotSecuritySolutionListBySubscriptionOptionalParams + options?: IotSecuritySolutionListBySubscriptionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: IotSecuritySolutionListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -105,19 +118,33 @@ export class IotSecuritySolutionImpl implements IotSecuritySolution { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: IotSecuritySolutionListByResourceGroupOptionalParams + options?: IotSecuritySolutionListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: IotSecuritySolutionListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -125,7 +152,9 @@ export class IotSecuritySolutionImpl implements IotSecuritySolution { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/iotSecuritySolutionsAnalyticsAggregatedAlert.ts b/sdk/security/arm-security/src/operations/iotSecuritySolutionsAnalyticsAggregatedAlert.ts index a13297c853b3..591232afc82d 100644 --- a/sdk/security/arm-security/src/operations/iotSecuritySolutionsAnalyticsAggregatedAlert.ts +++ b/sdk/security/arm-security/src/operations/iotSecuritySolutionsAnalyticsAggregatedAlert.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { IotSecuritySolutionsAnalyticsAggregatedAlert } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -57,8 +58,16 @@ export class IotSecuritySolutionsAnalyticsAggregatedAlertImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, solutionName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + solutionName, + options, + settings + ); } }; } @@ -66,11 +75,18 @@ export class IotSecuritySolutionsAnalyticsAggregatedAlertImpl private async *listPagingPage( resourceGroupName: string, solutionName: string, - options?: IotSecuritySolutionsAnalyticsAggregatedAlertListOptionalParams + options?: IotSecuritySolutionsAnalyticsAggregatedAlertListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, solutionName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: IotSecuritySolutionsAnalyticsAggregatedAlertListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, solutionName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -79,7 +95,9 @@ export class IotSecuritySolutionsAnalyticsAggregatedAlertImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/iotSecuritySolutionsAnalyticsRecommendation.ts b/sdk/security/arm-security/src/operations/iotSecuritySolutionsAnalyticsRecommendation.ts index a43941426a5f..17f16039df73 100644 --- a/sdk/security/arm-security/src/operations/iotSecuritySolutionsAnalyticsRecommendation.ts +++ b/sdk/security/arm-security/src/operations/iotSecuritySolutionsAnalyticsRecommendation.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { IotSecuritySolutionsAnalyticsRecommendation } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { IoTSecurityAggregatedRecommendation, IotSecuritySolutionsAnalyticsRecommendationListNextOptionalParams, IotSecuritySolutionsAnalyticsRecommendationListOptionalParams, + IotSecuritySolutionsAnalyticsRecommendationListResponse, IotSecuritySolutionsAnalyticsRecommendationGetOptionalParams, IotSecuritySolutionsAnalyticsRecommendationGetResponse, - IotSecuritySolutionsAnalyticsRecommendationListResponse, IotSecuritySolutionsAnalyticsRecommendationListNextResponse } from "../models"; @@ -57,8 +58,16 @@ export class IotSecuritySolutionsAnalyticsRecommendationImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, solutionName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + solutionName, + options, + settings + ); } }; } @@ -66,11 +75,18 @@ export class IotSecuritySolutionsAnalyticsRecommendationImpl private async *listPagingPage( resourceGroupName: string, solutionName: string, - options?: IotSecuritySolutionsAnalyticsRecommendationListOptionalParams + options?: IotSecuritySolutionsAnalyticsRecommendationListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, solutionName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: IotSecuritySolutionsAnalyticsRecommendationListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, solutionName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -79,7 +95,9 @@ export class IotSecuritySolutionsAnalyticsRecommendationImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/jitNetworkAccessPolicies.ts b/sdk/security/arm-security/src/operations/jitNetworkAccessPolicies.ts index ce8746070583..d1787f5f575f 100644 --- a/sdk/security/arm-security/src/operations/jitNetworkAccessPolicies.ts +++ b/sdk/security/arm-security/src/operations/jitNetworkAccessPolicies.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { JitNetworkAccessPolicies } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,15 +17,15 @@ import { JitNetworkAccessPolicy, JitNetworkAccessPoliciesListNextOptionalParams, JitNetworkAccessPoliciesListOptionalParams, + JitNetworkAccessPoliciesListResponse, JitNetworkAccessPoliciesListByRegionNextOptionalParams, JitNetworkAccessPoliciesListByRegionOptionalParams, + JitNetworkAccessPoliciesListByRegionResponse, JitNetworkAccessPoliciesListByResourceGroupNextOptionalParams, JitNetworkAccessPoliciesListByResourceGroupOptionalParams, + JitNetworkAccessPoliciesListByResourceGroupResponse, JitNetworkAccessPoliciesListByResourceGroupAndRegionNextOptionalParams, JitNetworkAccessPoliciesListByResourceGroupAndRegionOptionalParams, - JitNetworkAccessPoliciesListResponse, - JitNetworkAccessPoliciesListByRegionResponse, - JitNetworkAccessPoliciesListByResourceGroupResponse, JitNetworkAccessPoliciesListByResourceGroupAndRegionResponse, JitNetworkAccessPoliciesGetOptionalParams, JitNetworkAccessPoliciesGetResponse, @@ -68,22 +69,34 @@ export class JitNetworkAccessPoliciesImpl implements JitNetworkAccessPolicies { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: JitNetworkAccessPoliciesListOptionalParams + options?: JitNetworkAccessPoliciesListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: JitNetworkAccessPoliciesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -113,19 +126,29 @@ export class JitNetworkAccessPoliciesImpl implements JitNetworkAccessPolicies { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByRegionPagingPage(ascLocation, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByRegionPagingPage(ascLocation, options, settings); } }; } private async *listByRegionPagingPage( ascLocation: string, - options?: JitNetworkAccessPoliciesListByRegionOptionalParams + options?: JitNetworkAccessPoliciesListByRegionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByRegion(ascLocation, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: JitNetworkAccessPoliciesListByRegionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByRegion(ascLocation, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByRegionNext( ascLocation, @@ -133,7 +156,9 @@ export class JitNetworkAccessPoliciesImpl implements JitNetworkAccessPolicies { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -167,19 +192,33 @@ export class JitNetworkAccessPoliciesImpl implements JitNetworkAccessPolicies { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: JitNetworkAccessPoliciesListByResourceGroupOptionalParams + options?: JitNetworkAccessPoliciesListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: JitNetworkAccessPoliciesListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -187,7 +226,9 @@ export class JitNetworkAccessPoliciesImpl implements JitNetworkAccessPolicies { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -228,11 +269,15 @@ export class JitNetworkAccessPoliciesImpl implements JitNetworkAccessPolicies { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listByResourceGroupAndRegionPagingPage( resourceGroupName, ascLocation, - options + options, + settings ); } }; @@ -241,15 +286,22 @@ export class JitNetworkAccessPoliciesImpl implements JitNetworkAccessPolicies { private async *listByResourceGroupAndRegionPagingPage( resourceGroupName: string, ascLocation: string, - options?: JitNetworkAccessPoliciesListByResourceGroupAndRegionOptionalParams + options?: JitNetworkAccessPoliciesListByResourceGroupAndRegionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroupAndRegion( - resourceGroupName, - ascLocation, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: JitNetworkAccessPoliciesListByResourceGroupAndRegionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroupAndRegion( + resourceGroupName, + ascLocation, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupAndRegionNext( resourceGroupName, @@ -258,7 +310,9 @@ export class JitNetworkAccessPoliciesImpl implements JitNetworkAccessPolicies { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/locations.ts b/sdk/security/arm-security/src/operations/locations.ts index 30e1744dca9c..4331121b098f 100644 --- a/sdk/security/arm-security/src/operations/locations.ts +++ b/sdk/security/arm-security/src/operations/locations.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Locations } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -52,22 +53,34 @@ export class LocationsImpl implements Locations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: LocationsListOptionalParams + options?: LocationsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: LocationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/operations.ts b/sdk/security/arm-security/src/operations/operations.ts index b4953ee838f9..5d26baaa3bc5 100644 --- a/sdk/security/arm-security/src/operations/operations.ts +++ b/sdk/security/arm-security/src/operations/operations.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Operations } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -48,22 +49,34 @@ export class OperationsImpl implements Operations { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: OperationsListOptionalParams + options?: OperationsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: OperationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/regulatoryComplianceAssessments.ts b/sdk/security/arm-security/src/operations/regulatoryComplianceAssessments.ts index 3f52d797da8e..257e1f1ed673 100644 --- a/sdk/security/arm-security/src/operations/regulatoryComplianceAssessments.ts +++ b/sdk/security/arm-security/src/operations/regulatoryComplianceAssessments.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { RegulatoryComplianceAssessments } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -59,11 +60,15 @@ export class RegulatoryComplianceAssessmentsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPagingPage( regulatoryComplianceStandardName, regulatoryComplianceControlName, - options + options, + settings ); } }; @@ -72,15 +77,22 @@ export class RegulatoryComplianceAssessmentsImpl private async *listPagingPage( regulatoryComplianceStandardName: string, regulatoryComplianceControlName: string, - options?: RegulatoryComplianceAssessmentsListOptionalParams + options?: RegulatoryComplianceAssessmentsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list( - regulatoryComplianceStandardName, - regulatoryComplianceControlName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: RegulatoryComplianceAssessmentsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + regulatoryComplianceStandardName, + regulatoryComplianceControlName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( regulatoryComplianceStandardName, @@ -89,7 +101,9 @@ export class RegulatoryComplianceAssessmentsImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/regulatoryComplianceControls.ts b/sdk/security/arm-security/src/operations/regulatoryComplianceControls.ts index 30b576f33754..eac6a49052c7 100644 --- a/sdk/security/arm-security/src/operations/regulatoryComplianceControls.ts +++ b/sdk/security/arm-security/src/operations/regulatoryComplianceControls.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { RegulatoryComplianceControls } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -53,19 +54,33 @@ export class RegulatoryComplianceControlsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(regulatoryComplianceStandardName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + regulatoryComplianceStandardName, + options, + settings + ); } }; } private async *listPagingPage( regulatoryComplianceStandardName: string, - options?: RegulatoryComplianceControlsListOptionalParams + options?: RegulatoryComplianceControlsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(regulatoryComplianceStandardName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: RegulatoryComplianceControlsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(regulatoryComplianceStandardName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( regulatoryComplianceStandardName, @@ -73,7 +88,9 @@ export class RegulatoryComplianceControlsImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/regulatoryComplianceStandards.ts b/sdk/security/arm-security/src/operations/regulatoryComplianceStandards.ts index f203900517df..2bd2b46c852f 100644 --- a/sdk/security/arm-security/src/operations/regulatoryComplianceStandards.ts +++ b/sdk/security/arm-security/src/operations/regulatoryComplianceStandards.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { RegulatoryComplianceStandards } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -51,22 +52,34 @@ export class RegulatoryComplianceStandardsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: RegulatoryComplianceStandardsListOptionalParams + options?: RegulatoryComplianceStandardsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: RegulatoryComplianceStandardsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/secureScoreControlDefinitions.ts b/sdk/security/arm-security/src/operations/secureScoreControlDefinitions.ts index 5fbc81bd45e1..920a0d6dc310 100644 --- a/sdk/security/arm-security/src/operations/secureScoreControlDefinitions.ts +++ b/sdk/security/arm-security/src/operations/secureScoreControlDefinitions.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { SecureScoreControlDefinitions } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { SecureScoreControlDefinitionItem, SecureScoreControlDefinitionsListNextOptionalParams, SecureScoreControlDefinitionsListOptionalParams, + SecureScoreControlDefinitionsListResponse, SecureScoreControlDefinitionsListBySubscriptionNextOptionalParams, SecureScoreControlDefinitionsListBySubscriptionOptionalParams, - SecureScoreControlDefinitionsListResponse, SecureScoreControlDefinitionsListBySubscriptionResponse, SecureScoreControlDefinitionsListNextResponse, SecureScoreControlDefinitionsListBySubscriptionNextResponse @@ -53,22 +54,34 @@ export class SecureScoreControlDefinitionsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: SecureScoreControlDefinitionsListOptionalParams + options?: SecureScoreControlDefinitionsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SecureScoreControlDefinitionsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -96,22 +109,34 @@ export class SecureScoreControlDefinitionsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( - options?: SecureScoreControlDefinitionsListBySubscriptionOptionalParams + options?: SecureScoreControlDefinitionsListBySubscriptionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SecureScoreControlDefinitionsListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/secureScoreControls.ts b/sdk/security/arm-security/src/operations/secureScoreControls.ts index 8643a57816da..554b30125fcb 100644 --- a/sdk/security/arm-security/src/operations/secureScoreControls.ts +++ b/sdk/security/arm-security/src/operations/secureScoreControls.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { SecureScoreControls } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { SecureScoreControlDetails, SecureScoreControlsListBySecureScoreNextOptionalParams, SecureScoreControlsListBySecureScoreOptionalParams, + SecureScoreControlsListBySecureScoreResponse, SecureScoreControlsListNextOptionalParams, SecureScoreControlsListOptionalParams, - SecureScoreControlsListBySecureScoreResponse, SecureScoreControlsListResponse, SecureScoreControlsListBySecureScoreNextResponse, SecureScoreControlsListNextResponse @@ -55,19 +56,33 @@ export class SecureScoreControlsImpl implements SecureScoreControls { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySecureScorePagingPage(secureScoreName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySecureScorePagingPage( + secureScoreName, + options, + settings + ); } }; } private async *listBySecureScorePagingPage( secureScoreName: string, - options?: SecureScoreControlsListBySecureScoreOptionalParams + options?: SecureScoreControlsListBySecureScoreOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySecureScore(secureScoreName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SecureScoreControlsListBySecureScoreResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySecureScore(secureScoreName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySecureScoreNext( secureScoreName, @@ -75,7 +90,9 @@ export class SecureScoreControlsImpl implements SecureScoreControls { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -106,22 +123,34 @@ export class SecureScoreControlsImpl implements SecureScoreControls { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: SecureScoreControlsListOptionalParams + options?: SecureScoreControlsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SecureScoreControlsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/secureScores.ts b/sdk/security/arm-security/src/operations/secureScores.ts index 0b84b95cde6f..cd92d5be5942 100644 --- a/sdk/security/arm-security/src/operations/secureScores.ts +++ b/sdk/security/arm-security/src/operations/secureScores.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { SecureScores } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -50,22 +51,34 @@ export class SecureScoresImpl implements SecureScores { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: SecureScoresListOptionalParams + options?: SecureScoresListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SecureScoresListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/securityConnectorApplications.ts b/sdk/security/arm-security/src/operations/securityConnectorApplications.ts index 7cb809b3b930..2b73284961b7 100644 --- a/sdk/security/arm-security/src/operations/securityConnectorApplications.ts +++ b/sdk/security/arm-security/src/operations/securityConnectorApplications.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { SecurityConnectorApplications } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -58,11 +59,15 @@ export class SecurityConnectorApplicationsImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPagingPage( resourceGroupName, securityConnectorName, - options + options, + settings ); } }; @@ -71,15 +76,22 @@ export class SecurityConnectorApplicationsImpl private async *listPagingPage( resourceGroupName: string, securityConnectorName: string, - options?: SecurityConnectorApplicationsListOptionalParams + options?: SecurityConnectorApplicationsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list( - resourceGroupName, - securityConnectorName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SecurityConnectorApplicationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + resourceGroupName, + securityConnectorName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -88,7 +100,9 @@ export class SecurityConnectorApplicationsImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/securityConnectorGovernanceRule.ts b/sdk/security/arm-security/src/operations/securityConnectorGovernanceRule.ts index 1e2993e8a11d..20863977505a 100644 --- a/sdk/security/arm-security/src/operations/securityConnectorGovernanceRule.ts +++ b/sdk/security/arm-security/src/operations/securityConnectorGovernanceRule.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { SecurityConnectorGovernanceRule } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -58,11 +59,15 @@ export class SecurityConnectorGovernanceRuleImpl [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPagingPage( resourceGroupName, securityConnectorName, - options + options, + settings ); } }; @@ -71,15 +76,22 @@ export class SecurityConnectorGovernanceRuleImpl private async *listPagingPage( resourceGroupName: string, securityConnectorName: string, - options?: SecurityConnectorGovernanceRuleListOptionalParams + options?: SecurityConnectorGovernanceRuleListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list( - resourceGroupName, - securityConnectorName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SecurityConnectorGovernanceRuleListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + resourceGroupName, + securityConnectorName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -88,7 +100,9 @@ export class SecurityConnectorGovernanceRuleImpl options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/securityConnectors.ts b/sdk/security/arm-security/src/operations/securityConnectors.ts index 07657b0301a6..6399e0059845 100644 --- a/sdk/security/arm-security/src/operations/securityConnectors.ts +++ b/sdk/security/arm-security/src/operations/securityConnectors.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { SecurityConnectors } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { SecurityConnector, SecurityConnectorsListNextOptionalParams, SecurityConnectorsListOptionalParams, + SecurityConnectorsListResponse, SecurityConnectorsListByResourceGroupNextOptionalParams, SecurityConnectorsListByResourceGroupOptionalParams, - SecurityConnectorsListResponse, SecurityConnectorsListByResourceGroupResponse, SecurityConnectorsGetOptionalParams, SecurityConnectorsGetResponse, @@ -60,22 +61,34 @@ export class SecurityConnectorsImpl implements SecurityConnectors { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: SecurityConnectorsListOptionalParams + options?: SecurityConnectorsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SecurityConnectorsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -106,19 +119,33 @@ export class SecurityConnectorsImpl implements SecurityConnectors { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByResourceGroupPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); } }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, - options?: SecurityConnectorsListByResourceGroupOptionalParams + options?: SecurityConnectorsListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SecurityConnectorsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -126,7 +153,9 @@ export class SecurityConnectorsImpl implements SecurityConnectors { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/securityContacts.ts b/sdk/security/arm-security/src/operations/securityContacts.ts index 346bd811cbe1..d78aa8f67604 100644 --- a/sdk/security/arm-security/src/operations/securityContacts.ts +++ b/sdk/security/arm-security/src/operations/securityContacts.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { SecurityContacts } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -53,22 +54,34 @@ export class SecurityContactsImpl implements SecurityContacts { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: SecurityContactsListOptionalParams + options?: SecurityContactsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SecurityContactsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/securitySolutions.ts b/sdk/security/arm-security/src/operations/securitySolutions.ts index 1f6af5d837f1..b1823fa4227f 100644 --- a/sdk/security/arm-security/src/operations/securitySolutions.ts +++ b/sdk/security/arm-security/src/operations/securitySolutions.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { SecuritySolutions } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -50,22 +51,34 @@ export class SecuritySolutionsImpl implements SecuritySolutions { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: SecuritySolutionsListOptionalParams + options?: SecuritySolutionsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SecuritySolutionsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/settings.ts b/sdk/security/arm-security/src/operations/settings.ts index 05fac13160e0..a252cca2152e 100644 --- a/sdk/security/arm-security/src/operations/settings.ts +++ b/sdk/security/arm-security/src/operations/settings.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Settings } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -53,22 +54,34 @@ export class SettingsImpl implements Settings { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: SettingsListOptionalParams + options?: SettingsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SettingsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/softwareInventories.ts b/sdk/security/arm-security/src/operations/softwareInventories.ts index 29a1f328cad4..1cbe05bb487e 100644 --- a/sdk/security/arm-security/src/operations/softwareInventories.ts +++ b/sdk/security/arm-security/src/operations/softwareInventories.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { SoftwareInventories } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { Software, SoftwareInventoriesListByExtendedResourceNextOptionalParams, SoftwareInventoriesListByExtendedResourceOptionalParams, + SoftwareInventoriesListByExtendedResourceResponse, SoftwareInventoriesListBySubscriptionNextOptionalParams, SoftwareInventoriesListBySubscriptionOptionalParams, - SoftwareInventoriesListByExtendedResourceResponse, SoftwareInventoriesListBySubscriptionResponse, SoftwareInventoriesGetOptionalParams, SoftwareInventoriesGetResponse, @@ -69,13 +70,17 @@ export class SoftwareInventoriesImpl implements SoftwareInventories { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listByExtendedResourcePagingPage( resourceGroupName, resourceNamespace, resourceType, resourceName, - options + options, + settings ); } }; @@ -86,17 +91,24 @@ export class SoftwareInventoriesImpl implements SoftwareInventories { resourceNamespace: string, resourceType: string, resourceName: string, - options?: SoftwareInventoriesListByExtendedResourceOptionalParams + options?: SoftwareInventoriesListByExtendedResourceOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByExtendedResource( - resourceGroupName, - resourceNamespace, - resourceType, - resourceName, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SoftwareInventoriesListByExtendedResourceResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByExtendedResource( + resourceGroupName, + resourceNamespace, + resourceType, + resourceName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByExtendedResourceNext( resourceGroupName, @@ -107,7 +119,9 @@ export class SoftwareInventoriesImpl implements SoftwareInventories { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -144,22 +158,34 @@ export class SoftwareInventoriesImpl implements SoftwareInventories { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( - options?: SoftwareInventoriesListBySubscriptionOptionalParams + options?: SoftwareInventoriesListBySubscriptionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SoftwareInventoriesListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/subAssessments.ts b/sdk/security/arm-security/src/operations/subAssessments.ts index 859740916e55..b7de6f7eeb88 100644 --- a/sdk/security/arm-security/src/operations/subAssessments.ts +++ b/sdk/security/arm-security/src/operations/subAssessments.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { SubAssessments } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { SecuritySubAssessment, SubAssessmentsListAllNextOptionalParams, SubAssessmentsListAllOptionalParams, + SubAssessmentsListAllResponse, SubAssessmentsListNextOptionalParams, SubAssessmentsListOptionalParams, - SubAssessmentsListAllResponse, SubAssessmentsListResponse, SubAssessmentsGetOptionalParams, SubAssessmentsGetResponse, @@ -58,23 +59,35 @@ export class SubAssessmentsImpl implements SubAssessments { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listAllPagingPage(scope, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listAllPagingPage(scope, options, settings); } }; } private async *listAllPagingPage( scope: string, - options?: SubAssessmentsListAllOptionalParams + options?: SubAssessmentsListAllOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listAll(scope, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SubAssessmentsListAllResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listAll(scope, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listAllNext(scope, continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -108,8 +121,11 @@ export class SubAssessmentsImpl implements SubAssessments { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(scope, assessmentName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(scope, assessmentName, options, settings); } }; } @@ -117,11 +133,18 @@ export class SubAssessmentsImpl implements SubAssessments { private async *listPagingPage( scope: string, assessmentName: string, - options?: SubAssessmentsListOptionalParams + options?: SubAssessmentsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(scope, assessmentName, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: SubAssessmentsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(scope, assessmentName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( scope, @@ -130,7 +153,9 @@ export class SubAssessmentsImpl implements SubAssessments { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/tasks.ts b/sdk/security/arm-security/src/operations/tasks.ts index 241d8bba8de8..c47865dc9c0c 100644 --- a/sdk/security/arm-security/src/operations/tasks.ts +++ b/sdk/security/arm-security/src/operations/tasks.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Tasks } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,17 +17,17 @@ import { SecurityTask, TasksListNextOptionalParams, TasksListOptionalParams, + TasksListResponse, TasksListByHomeRegionNextOptionalParams, TasksListByHomeRegionOptionalParams, + TasksListByHomeRegionResponse, TasksListByResourceGroupNextOptionalParams, TasksListByResourceGroupOptionalParams, - TasksListResponse, - TasksListByHomeRegionResponse, + TasksListByResourceGroupResponse, TasksGetSubscriptionLevelTaskOptionalParams, TasksGetSubscriptionLevelTaskResponse, TaskUpdateActionType, TasksUpdateSubscriptionLevelTaskStateOptionalParams, - TasksListByResourceGroupResponse, TasksGetResourceGroupLevelTaskOptionalParams, TasksGetResourceGroupLevelTaskResponse, TasksUpdateResourceGroupLevelTaskStateOptionalParams, @@ -63,22 +64,34 @@ export class TasksImpl implements Tasks { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: TasksListOptionalParams + options?: TasksListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: TasksListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -108,19 +121,29 @@ export class TasksImpl implements Tasks { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByHomeRegionPagingPage(ascLocation, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByHomeRegionPagingPage(ascLocation, options, settings); } }; } private async *listByHomeRegionPagingPage( ascLocation: string, - options?: TasksListByHomeRegionOptionalParams + options?: TasksListByHomeRegionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByHomeRegion(ascLocation, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: TasksListByHomeRegionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByHomeRegion(ascLocation, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByHomeRegionNext( ascLocation, @@ -128,7 +151,9 @@ export class TasksImpl implements Tasks { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -169,11 +194,15 @@ export class TasksImpl implements Tasks { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listByResourceGroupPagingPage( resourceGroupName, ascLocation, - options + options, + settings ); } }; @@ -182,15 +211,22 @@ export class TasksImpl implements Tasks { private async *listByResourceGroupPagingPage( resourceGroupName: string, ascLocation: string, - options?: TasksListByResourceGroupOptionalParams + options?: TasksListByResourceGroupOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByResourceGroup( - resourceGroupName, - ascLocation, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; + let result: TasksListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup( + resourceGroupName, + ascLocation, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByResourceGroupNext( resourceGroupName, @@ -199,7 +235,9 @@ export class TasksImpl implements Tasks { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/topology.ts b/sdk/security/arm-security/src/operations/topology.ts index 6b0608f41b5d..9cac9af0fec4 100644 --- a/sdk/security/arm-security/src/operations/topology.ts +++ b/sdk/security/arm-security/src/operations/topology.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Topology } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -16,9 +17,9 @@ import { TopologyResource, TopologyListNextOptionalParams, TopologyListOptionalParams, + TopologyListResponse, TopologyListByHomeRegionNextOptionalParams, TopologyListByHomeRegionOptionalParams, - TopologyListResponse, TopologyListByHomeRegionResponse, TopologyGetOptionalParams, TopologyGetResponse, @@ -54,22 +55,34 @@ export class TopologyImpl implements Topology { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: TopologyListOptionalParams + options?: TopologyListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: TopologyListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -99,19 +112,29 @@ export class TopologyImpl implements Topology { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listByHomeRegionPagingPage(ascLocation, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByHomeRegionPagingPage(ascLocation, options, settings); } }; } private async *listByHomeRegionPagingPage( ascLocation: string, - options?: TopologyListByHomeRegionOptionalParams + options?: TopologyListByHomeRegionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listByHomeRegion(ascLocation, options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: TopologyListByHomeRegionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByHomeRegion(ascLocation, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listByHomeRegionNext( ascLocation, @@ -119,7 +142,9 @@ export class TopologyImpl implements Topology { options ); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/operations/workspaceSettings.ts b/sdk/security/arm-security/src/operations/workspaceSettings.ts index c0c10de0f2af..1bf77edbda23 100644 --- a/sdk/security/arm-security/src/operations/workspaceSettings.ts +++ b/sdk/security/arm-security/src/operations/workspaceSettings.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { WorkspaceSettings } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -56,22 +57,34 @@ export class WorkspaceSettingsImpl implements WorkspaceSettings { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); } }; } private async *listPagingPage( - options?: WorkspaceSettingsListOptionalParams + options?: WorkspaceSettingsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(options); - yield result.value || []; - let continuationToken = result.nextLink; + let result: WorkspaceSettingsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext(continuationToken, options); continuationToken = result.nextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } diff --git a/sdk/security/arm-security/src/pagingHelper.ts b/sdk/security/arm-security/src/pagingHelper.ts new file mode 100644 index 000000000000..d85fc13bce1e --- /dev/null +++ b/sdk/security/arm-security/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given a result page from a pageable operation, returns a + * continuation token that can be used to begin paging from + * that point later. + * @param page A result object from calling .byPage() on a paged operation. + * @returns The continuation token that can be passed into byPage(). + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/security/arm-security/src/securityCenter.ts b/sdk/security/arm-security/src/securityCenter.ts index 8cdde38deb6b..f7a35bd6a486 100644 --- a/sdk/security/arm-security/src/securityCenter.ts +++ b/sdk/security/arm-security/src/securityCenter.ts @@ -172,16 +172,13 @@ export class SecurityCenter extends coreClient.ServiceClient { ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`; - if (!options.credentialScopes) { - options.credentialScopes = ["https://management.azure.com/.default"]; - } const optionsWithDefaults = { ...defaults, ...options, userAgentOptions: { userAgentPrefix }, - baseUri: + endpoint: options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); @@ -207,7 +204,9 @@ export class SecurityCenter extends coreClient.ServiceClient { this.pipeline.addPolicy( coreRestPipeline.bearerTokenAuthenticationPolicy({ credential: credentials, - scopes: `${optionsWithDefaults.credentialScopes}`, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, challengeCallbacks: { authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge