diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 581bf163d637..27b6a7f3851d 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -9753,7 +9753,7 @@ packages: dev: false file:projects/arm-botservice.tgz: - resolution: {integrity: sha512-PQBwddr7cW9SAkQAch2O4+Nt7EaFk3XnbMoZ9SJ/QJ2mQBofqUQRoOZ6DViU6ivC4ExISlxx6wxBDA2IUGluVA==, tarball: file:projects/arm-botservice.tgz} + resolution: {integrity: sha512-mF4nCf/qyg/0ATRr3W8ux8ainl4MGXLJ1UsO7lcOTFFf0A1TLYxrmscqQ+tQ6vaawGjWllZEp39p3GymMbZ9Hg==, tarball: file:projects/arm-botservice.tgz} name: '@rush-temp/arm-botservice' version: 0.0.0 dependencies: @@ -9781,28 +9781,27 @@ packages: dev: false file:projects/arm-cdn.tgz: - resolution: {integrity: sha512-KHZlB1DaSIueBDEoEvZj1XfqcOgY1UkRp+pxp4Wy47OmGOg5N1/GQkDsZZ67qRCRbvFzMWu6yKZts97/5cqE6A==, tarball: file:projects/arm-cdn.tgz} + resolution: {integrity: sha512-7flkZDb1ZsSBUOiHM/Wg/gd7zOLT0jqBMTbDF5qzbzy4K8LGg1CkPVyTy6vHaaushI82DjrSQSk/m/lkaP5DDg==, tarball: file:projects/arm-cdn.tgz} name: '@rush-temp/arm-cdn' version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 '@azure/identity': 2.0.4 '@microsoft/api-extractor': 7.22.1 - '@rollup/plugin-commonjs': 21.0.3_rollup@2.70.1 - '@rollup/plugin-json': 4.1.0_rollup@2.70.1 - '@rollup/plugin-multi-entry': 4.1.0_rollup@2.70.1 - '@rollup/plugin-node-resolve': 13.2.0_rollup@2.70.1 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 - rollup: 2.70.1 - rollup-plugin-sourcemaps: 0.6.3_rollup@2.70.1 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.15.4 transitivePeerDependencies: - - '@types/node' - debug - encoding - supports-color @@ -10424,7 +10423,7 @@ packages: dev: false file:projects/arm-datafactory.tgz: - resolution: {integrity: sha512-j+LTbRhHIaMJMaKmSs/ugOXWowAtP21BK0F8lThUcZ5lOlfbOxY9iU7phGtUPih0dn4HcjjTx8g2j4caUfE4vQ==, tarball: file:projects/arm-datafactory.tgz} + resolution: {integrity: sha512-6lPhYBkS1WE4IdreMMzxq4KIEbT/lK+Fm0/yq4bw2+u4BOowi9JsmRF+SmjfDQnflBlVV2T++NCmkeFW0LaMRA==, tarball: file:projects/arm-datafactory.tgz} name: '@rush-temp/arm-datafactory' version: 0.0.0 dependencies: @@ -10647,7 +10646,7 @@ packages: dev: false file:projects/arm-digitaltwins.tgz: - resolution: {integrity: sha512-hW849ZUuBqPjs2hSiWFKM2L38jA29tgjpn1HSxr5gdGqSbkh+xJWb10tjhbByoPAGoC/xiLlmFsEzLWoIME2HQ==, tarball: file:projects/arm-digitaltwins.tgz} + resolution: {integrity: sha512-UoYxvLJ6lsdjg2ko5jVsLEQQLC1nIjSFPc4lkFkwwUJAMFgceRXpPAcTMs+O0aICUIZSgs3Fw+sVW8m6ZbFsxA==, tarball: file:projects/arm-digitaltwins.tgz} name: '@rush-temp/arm-digitaltwins' version: 0.0.0 dependencies: diff --git a/sdk/cdn/arm-cdn/README.md b/sdk/cdn/arm-cdn/README.md index 39668a92d5b7..0fe39d52e9de 100644 --- a/sdk/cdn/arm-cdn/README.md +++ b/sdk/cdn/arm-cdn/README.md @@ -16,8 +16,6 @@ Cdn Management Client - [LTS versions of Node.js](https://nodejs.org/about/releases/) - Latest versions of Safari, Chrome, Edge and Firefox. -See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. - ### Prerequisites - An [Azure subscription][azure_sub]. @@ -51,17 +49,8 @@ For more information about how to create an Azure AD Application check out [this ```javascript const { CdnManagementClient } = require("@azure/arm-cdn"); const { DefaultAzureCredential } = require("@azure/identity"); -// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. - const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new CdnManagementClient(new DefaultAzureCredential(), subscriptionId); - -// For client-side applications running in the browser, use this code instead: -// const credential = new InteractiveBrowserCredential({ -// tenantId: "", -// clientId: "" -// }); -// const client = new CdnManagementClient(credential, subscriptionId); ``` diff --git a/sdk/cdn/arm-cdn/_meta.json b/sdk/cdn/arm-cdn/_meta.json index 041fb3efa0b7..e0265dd17999 100644 --- a/sdk/cdn/arm-cdn/_meta.json +++ b/sdk/cdn/arm-cdn/_meta.json @@ -1,8 +1,8 @@ { - "commit": "82fdf284eea880a8e027c354911a814999a77178", + "commit": "a4df057f17b1462c86907e8f2eda0b4d975619a3", "readme": "specification/cdn/resource-manager/readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\cdn\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-beta.17 --generate-sample=true", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/cdn/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220105.1", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.2.0", - "use": "@autorest/typescript@6.0.0-beta.17" + "release_tool": "@azure-tools/js-sdk-release-tools@2.3.0", + "use": "@autorest/typescript@6.0.0-alpha.16.20220105.1" } \ No newline at end of file diff --git a/sdk/cdn/arm-cdn/package.json b/sdk/cdn/arm-cdn/package.json index 6f4a51f41280..1af462d0a3c2 100644 --- a/sdk/cdn/arm-cdn/package.json +++ b/sdk/cdn/arm-cdn/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for CdnManagementClient.", - "version": "7.0.1", + "version": "7.0.2", "engines": { "node": ">=12.0.0" }, @@ -29,13 +29,13 @@ "types": "./types/arm-cdn.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.18.11", - "@rollup/plugin-commonjs": "^21.0.1", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-multi-entry": "^4.1.0", - "@rollup/plugin-node-resolve": "^13.1.3", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", "mkdirp": "^1.0.4", - "rollup": "^2.66.1", - "rollup-plugin-sourcemaps": "^0.6.3", + "rollup": "^1.16.3", + "rollup-plugin-sourcemaps": "^0.4.2", "typescript": "~4.2.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", @@ -98,21 +98,5 @@ "docs": "echo skipped" }, "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/cdnManagementClient.ts", - "prefix": "packageDetails" - } - ] - }, - "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-cdn?view=azure-node-preview" - } -} + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/cdn/arm-cdn/rollup.config.js b/sdk/cdn/arm-cdn/rollup.config.js index 3f89d7309da5..9be1955eb7f1 100644 --- a/sdk/cdn/arm-cdn/rollup.config.js +++ b/sdk/cdn/arm-cdn/rollup.config.js @@ -14,14 +14,62 @@ import json from "@rollup/plugin-json"; import nodeBuiltins from "builtin-modules"; +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + // #region Warning Handler /** - * A function that can determine whether a rollup warning should be ignored. If + * A function that can determine whether a rollupwarning should be ignored. If * the function returns `true`, then the warning will not be displayed. */ -function ignoreNiseSinonEval(warning) { +function ignoreNiseSinonEvalWarnings(warning) { return ( warning.code === "EVAL" && warning.id && @@ -30,14 +78,17 @@ function ignoreNiseSinonEval(warning) { ); } -function ignoreChaiCircularDependency(warning) { +function ignoreChaiCircularDependencyWarnings(warning) { return ( warning.code === "CIRCULAR_DEPENDENCY" && warning.importer && warning.importer.includes("node_modules/chai") === true ); } -const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; /** * Construct a warning handler for the shared rollup configuration @@ -71,7 +122,22 @@ function makeBrowserTestConfig() { nodeResolve({ mainFields: ["module", "browser"] }), - cjs(), + cjs({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), json(), sourcemaps() //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) @@ -107,7 +173,7 @@ export function makeConfig(pkg, options) { ], output: { file: "dist/index.js", format: "cjs", sourcemap: true }, preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve()] + plugins: [sourcemaps(), nodeResolve(), cjs()] }; const config = [baseConfig]; diff --git a/sdk/cdn/arm-cdn/src/cdnManagementClient.ts b/sdk/cdn/arm-cdn/src/cdnManagementClient.ts index cf2e03046430..ec6c96ce3e69 100644 --- a/sdk/cdn/arm-cdn/src/cdnManagementClient.ts +++ b/sdk/cdn/arm-cdn/src/cdnManagementClient.ts @@ -105,7 +105,7 @@ export class CdnManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-cdn/7.0.1`; + const packageDetails = `azsdk-js-arm-cdn/7.0.2`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -120,8 +120,7 @@ export class CdnManagementClient extends coreClient.ServiceClient { userAgentOptions: { userAgentPrefix }, - baseUri: - options.endpoint ?? options.baseUri ?? "https://management.azure.com" + baseUri: options.endpoint || "https://management.azure.com" }; super(optionsWithDefaults); // Parameter assignments diff --git a/sdk/cdn/arm-cdn/src/operations/afdCustomDomains.ts b/sdk/cdn/arm-cdn/src/operations/afdCustomDomains.ts index 72900a185654..32390dca6cbf 100644 --- a/sdk/cdn/arm-cdn/src/operations/afdCustomDomains.ts +++ b/sdk/cdn/arm-cdn/src/operations/afdCustomDomains.ts @@ -226,13 +226,11 @@ export class AfdCustomDomainsImpl implements AfdCustomDomains { }, createOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -332,13 +330,11 @@ export class AfdCustomDomainsImpl implements AfdCustomDomains { }, updateOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -426,13 +422,11 @@ export class AfdCustomDomainsImpl implements AfdCustomDomains { { resourceGroupName, profileName, customDomainName, options }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -517,13 +511,11 @@ export class AfdCustomDomainsImpl implements AfdCustomDomains { { resourceGroupName, profileName, customDomainName, options }, refreshValidationTokenOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/afdEndpoints.ts b/sdk/cdn/arm-cdn/src/operations/afdEndpoints.ts index ba46654dc1ba..21065a345ac0 100644 --- a/sdk/cdn/arm-cdn/src/operations/afdEndpoints.ts +++ b/sdk/cdn/arm-cdn/src/operations/afdEndpoints.ts @@ -311,13 +311,11 @@ export class AfdEndpointsImpl implements AfdEndpoints { { resourceGroupName, profileName, endpointName, endpoint, options }, createOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -421,13 +419,11 @@ export class AfdEndpointsImpl implements AfdEndpoints { }, updateOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -518,13 +514,11 @@ export class AfdEndpointsImpl implements AfdEndpoints { { resourceGroupName, profileName, endpointName, options }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -613,13 +607,11 @@ export class AfdEndpointsImpl implements AfdEndpoints { { resourceGroupName, profileName, endpointName, contents, options }, purgeContentOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/afdOriginGroups.ts b/sdk/cdn/arm-cdn/src/operations/afdOriginGroups.ts index 81ae0adcd7d4..05dd328d3397 100644 --- a/sdk/cdn/arm-cdn/src/operations/afdOriginGroups.ts +++ b/sdk/cdn/arm-cdn/src/operations/afdOriginGroups.ts @@ -304,13 +304,11 @@ export class AfdOriginGroupsImpl implements AfdOriginGroups { { resourceGroupName, profileName, originGroupName, originGroup, options }, createOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -410,13 +408,11 @@ export class AfdOriginGroupsImpl implements AfdOriginGroups { }, updateOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -503,13 +499,11 @@ export class AfdOriginGroupsImpl implements AfdOriginGroups { { resourceGroupName, profileName, originGroupName, options }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/afdOrigins.ts b/sdk/cdn/arm-cdn/src/operations/afdOrigins.ts index 31ea66daf7d3..56dcec4942af 100644 --- a/sdk/cdn/arm-cdn/src/operations/afdOrigins.ts +++ b/sdk/cdn/arm-cdn/src/operations/afdOrigins.ts @@ -240,13 +240,11 @@ export class AfdOriginsImpl implements AfdOrigins { }, createOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -352,13 +350,11 @@ export class AfdOriginsImpl implements AfdOrigins { }, updateOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -450,13 +446,11 @@ export class AfdOriginsImpl implements AfdOrigins { { resourceGroupName, profileName, originGroupName, originName, options }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/customDomains.ts b/sdk/cdn/arm-cdn/src/operations/customDomains.ts index 6fb21ccefdf1..366df1bc966d 100644 --- a/sdk/cdn/arm-cdn/src/operations/customDomains.ts +++ b/sdk/cdn/arm-cdn/src/operations/customDomains.ts @@ -244,12 +244,10 @@ export class CustomDomainsImpl implements CustomDomains { }, createOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -345,12 +343,10 @@ export class CustomDomainsImpl implements CustomDomains { }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/endpoints.ts b/sdk/cdn/arm-cdn/src/operations/endpoints.ts index 8c1dc61cf9b1..ab5188fdf2b3 100644 --- a/sdk/cdn/arm-cdn/src/operations/endpoints.ts +++ b/sdk/cdn/arm-cdn/src/operations/endpoints.ts @@ -312,12 +312,10 @@ export class EndpointsImpl implements Endpoints { { resourceGroupName, profileName, endpointName, endpoint, options }, createOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -419,12 +417,10 @@ export class EndpointsImpl implements Endpoints { }, updateOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -513,12 +509,10 @@ export class EndpointsImpl implements Endpoints { { resourceGroupName, profileName, endpointName, options }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -606,12 +600,10 @@ export class EndpointsImpl implements Endpoints { { resourceGroupName, profileName, endpointName, options }, startOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -695,12 +687,10 @@ export class EndpointsImpl implements Endpoints { { resourceGroupName, profileName, endpointName, options }, stopOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -792,12 +782,10 @@ export class EndpointsImpl implements Endpoints { }, purgeContentOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -893,12 +881,10 @@ export class EndpointsImpl implements Endpoints { }, loadContentOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/originGroups.ts b/sdk/cdn/arm-cdn/src/operations/originGroups.ts index bb85064a9616..59e43e579731 100644 --- a/sdk/cdn/arm-cdn/src/operations/originGroups.ts +++ b/sdk/cdn/arm-cdn/src/operations/originGroups.ts @@ -242,12 +242,10 @@ export class OriginGroupsImpl implements OriginGroups { }, createOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -351,12 +349,10 @@ export class OriginGroupsImpl implements OriginGroups { }, updateOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -452,12 +448,10 @@ export class OriginGroupsImpl implements OriginGroups { }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/origins.ts b/sdk/cdn/arm-cdn/src/operations/origins.ts index 8d7b3c59f815..e6ba9e5579da 100644 --- a/sdk/cdn/arm-cdn/src/operations/origins.ts +++ b/sdk/cdn/arm-cdn/src/operations/origins.ts @@ -233,12 +233,10 @@ export class OriginsImpl implements Origins { }, createOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -339,12 +337,10 @@ export class OriginsImpl implements Origins { }, updateOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -434,12 +430,10 @@ export class OriginsImpl implements Origins { { resourceGroupName, profileName, endpointName, originName, options }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/policies.ts b/sdk/cdn/arm-cdn/src/operations/policies.ts index cad2172350c1..fa295f500bec 100644 --- a/sdk/cdn/arm-cdn/src/operations/policies.ts +++ b/sdk/cdn/arm-cdn/src/operations/policies.ts @@ -192,12 +192,10 @@ export class PoliciesImpl implements Policies { }, createOrUpdateOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -291,12 +289,10 @@ export class PoliciesImpl implements Policies { }, updateOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/profiles.ts b/sdk/cdn/arm-cdn/src/operations/profiles.ts index 0591b170ac38..b0346604d25f 100644 --- a/sdk/cdn/arm-cdn/src/operations/profiles.ts +++ b/sdk/cdn/arm-cdn/src/operations/profiles.ts @@ -336,12 +336,10 @@ export class ProfilesImpl implements Profiles { { resourceGroupName, profileName, profile, options }, createOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -432,12 +430,10 @@ export class ProfilesImpl implements Profiles { { resourceGroupName, profileName, profileUpdateParameters, options }, updateOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** @@ -522,12 +518,10 @@ export class ProfilesImpl implements Profiles { { resourceGroupName, profileName, options }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/routes.ts b/sdk/cdn/arm-cdn/src/operations/routes.ts index aa73b552ac5f..681e81d955bb 100644 --- a/sdk/cdn/arm-cdn/src/operations/routes.ts +++ b/sdk/cdn/arm-cdn/src/operations/routes.ts @@ -239,13 +239,11 @@ export class RoutesImpl implements Routes { }, createOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -350,13 +348,11 @@ export class RoutesImpl implements Routes { }, updateOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -450,13 +446,11 @@ export class RoutesImpl implements Routes { { resourceGroupName, profileName, endpointName, routeName, options }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/ruleSets.ts b/sdk/cdn/arm-cdn/src/operations/ruleSets.ts index 5c67e7843a60..56bfde935a7e 100644 --- a/sdk/cdn/arm-cdn/src/operations/ruleSets.ts +++ b/sdk/cdn/arm-cdn/src/operations/ruleSets.ts @@ -316,13 +316,11 @@ export class RuleSetsImpl implements RuleSets { { resourceGroupName, profileName, ruleSetName, options }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/rules.ts b/sdk/cdn/arm-cdn/src/operations/rules.ts index d545e95c3436..b085d69d893f 100644 --- a/sdk/cdn/arm-cdn/src/operations/rules.ts +++ b/sdk/cdn/arm-cdn/src/operations/rules.ts @@ -230,13 +230,11 @@ export class RulesImpl implements Rules { { resourceGroupName, profileName, ruleSetName, ruleName, rule, options }, createOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -339,13 +337,11 @@ export class RulesImpl implements Rules { }, updateOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -437,13 +433,11 @@ export class RulesImpl implements Rules { { resourceGroupName, profileName, ruleSetName, ruleName, options }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/secrets.ts b/sdk/cdn/arm-cdn/src/operations/secrets.ts index 806d9f2c1570..c824dd506159 100644 --- a/sdk/cdn/arm-cdn/src/operations/secrets.ts +++ b/sdk/cdn/arm-cdn/src/operations/secrets.ts @@ -212,13 +212,11 @@ export class SecretsImpl implements Secrets { { resourceGroupName, profileName, secretName, secret, options }, createOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -305,13 +303,11 @@ export class SecretsImpl implements Secrets { { resourceGroupName, profileName, secretName, options }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/src/operations/securityPolicies.ts b/sdk/cdn/arm-cdn/src/operations/securityPolicies.ts index e2016adfb456..ab193c811d9b 100644 --- a/sdk/cdn/arm-cdn/src/operations/securityPolicies.ts +++ b/sdk/cdn/arm-cdn/src/operations/securityPolicies.ts @@ -224,13 +224,11 @@ export class SecurityPoliciesImpl implements SecurityPolicies { }, createOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -330,13 +328,11 @@ export class SecurityPoliciesImpl implements SecurityPolicies { }, patchOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** @@ -423,13 +419,11 @@ export class SecurityPoliciesImpl implements SecurityPolicies { { resourceGroupName, profileName, securityPolicyName, options }, deleteOperationSpec ); - const poller = new LroEngine(lro, { + return new LroEngine(lro, { resumeFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs, lroResourceLocationConfig: "azure-async-operation" }); - await poller.poll(); - return poller; } /** diff --git a/sdk/cdn/arm-cdn/test/sampleTest.ts b/sdk/cdn/arm-cdn/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/cdn/arm-cdn/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * 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. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/cdn/arm-cdn/tsconfig.json b/sdk/cdn/arm-cdn/tsconfig.json index d80de3340da5..3e6ae96443f3 100644 --- a/sdk/cdn/arm-cdn/tsconfig.json +++ b/sdk/cdn/arm-cdn/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-cdn": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"