From 196aa4573d4478c8181dc23a50282e08911ab8f5 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 5 Jan 2022 07:35:59 +0000 Subject: [PATCH] CodeGen from PR 16902 in Azure/azure-rest-api-specs Track2 modify readme.go.md 4 (#16902) * Track2 modify readme.go.md 4 * devops --- common/config/rush/pnpm-lock.yaml | 131 +- rush.json | 5 + .../arm-digitaltwins/CHANGELOG.md | 11 + sdk/digitaltwins/arm-digitaltwins/LICENSE | 21 + sdk/digitaltwins/arm-digitaltwins/README.md | 152 +- sdk/digitaltwins/arm-digitaltwins/_meta.json | 7 + .../arm-digitaltwins/api-extractor.json | 18 + .../arm-digitaltwins/package.json | 95 +- .../review/arm-digitaltwins.api.md | 620 ++++++ .../arm-digitaltwins/rollup.config.js | 211 ++- .../src/azureDigitalTwinsManagementClient.ts | 120 +- ...zureDigitalTwinsManagementClientContext.ts | 67 - ...rivateLinkResourcesMappers.ts => index.ts} | 13 +- .../arm-digitaltwins/src/lroImpl.ts | 34 + .../src/models/digitalTwinsEndpointMappers.ts | 31 - .../src/models/digitalTwinsMappers.ts | 35 - .../arm-digitaltwins/src/models/index.ts | 1660 ++++++----------- .../arm-digitaltwins/src/models/mappers.ts | 936 +++++----- .../arm-digitaltwins/src/models/parameters.ts | 173 +- .../privateEndpointConnectionsMappers.ts | 31 - .../src/operations/digitalTwins.ts | 926 +++++---- .../src/operations/digitalTwinsEndpoint.ts | 530 ++++-- .../arm-digitaltwins/src/operations/index.ts | 3 +- .../src/operations/operations.ts | 158 +- .../operations/privateEndpointConnections.ts | 397 ++-- .../src/operations/privateLinkResources.ts | 152 +- .../src/operationsInterfaces/digitalTwins.ts | 164 ++ .../digitalTwinsEndpoint.ts | 115 ++ .../index.ts} | 13 +- .../src/operationsInterfaces/operations.ts | 22 + .../privateEndpointConnections.ts | 108 ++ .../privateLinkResources.ts | 42 + .../arm-digitaltwins/test/sampleTest.ts | 48 + .../arm-digitaltwins/tsconfig.json | 6 +- sdk/digitaltwins/ci.yml | 8 +- 35 files changed, 4139 insertions(+), 2924 deletions(-) create mode 100644 sdk/digitaltwins/arm-digitaltwins/CHANGELOG.md create mode 100644 sdk/digitaltwins/arm-digitaltwins/LICENSE create mode 100644 sdk/digitaltwins/arm-digitaltwins/_meta.json create mode 100644 sdk/digitaltwins/arm-digitaltwins/api-extractor.json create mode 100644 sdk/digitaltwins/arm-digitaltwins/review/arm-digitaltwins.api.md delete mode 100644 sdk/digitaltwins/arm-digitaltwins/src/azureDigitalTwinsManagementClientContext.ts rename sdk/digitaltwins/arm-digitaltwins/src/{models/privateLinkResourcesMappers.ts => index.ts} (52%) create mode 100644 sdk/digitaltwins/arm-digitaltwins/src/lroImpl.ts delete mode 100644 sdk/digitaltwins/arm-digitaltwins/src/models/digitalTwinsEndpointMappers.ts delete mode 100644 sdk/digitaltwins/arm-digitaltwins/src/models/digitalTwinsMappers.ts delete mode 100644 sdk/digitaltwins/arm-digitaltwins/src/models/privateEndpointConnectionsMappers.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/digitalTwins.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/digitalTwinsEndpoint.ts rename sdk/digitaltwins/arm-digitaltwins/src/{models/operationsMappers.ts => operationsInterfaces/index.ts} (55%) create mode 100644 sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/operations.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/privateEndpointConnections.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/privateLinkResources.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/test/sampleTest.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 694e81b4a476..2c77bb01fdd1 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -34,6 +34,7 @@ specifiers: '@rush-temp/arm-datalake-analytics': file:./projects/arm-datalake-analytics.tgz '@rush-temp/arm-desktopvirtualization': file:./projects/arm-desktopvirtualization.tgz '@rush-temp/arm-devtestlabs': file:./projects/arm-devtestlabs.tgz + '@rush-temp/arm-digitaltwins': file:./projects/arm-digitaltwins.tgz '@rush-temp/arm-eventgrid': file:./projects/arm-eventgrid.tgz '@rush-temp/arm-eventhub': file:./projects/arm-eventhub.tgz '@rush-temp/arm-extendedlocation': file:./projects/arm-extendedlocation.tgz @@ -215,6 +216,7 @@ dependencies: '@rush-temp/arm-datalake-analytics': file:projects/arm-datalake-analytics.tgz '@rush-temp/arm-desktopvirtualization': file:projects/arm-desktopvirtualization.tgz '@rush-temp/arm-devtestlabs': file:projects/arm-devtestlabs.tgz + '@rush-temp/arm-digitaltwins': file:projects/arm-digitaltwins.tgz '@rush-temp/arm-eventgrid': file:projects/arm-eventgrid.tgz '@rush-temp/arm-eventhub': file:projects/arm-eventhub.tgz '@rush-temp/arm-extendedlocation': file:projects/arm-extendedlocation.tgz @@ -6977,7 +6979,7 @@ packages: hasBin: true dev: false - /ts-node/10.4.0_276ff2ad8f60608417677a4691c0f835: + /ts-node/10.4.0_28670484a221c7e896c5d6b821a5cbb7: resolution: {integrity: sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==} hasBin: true peerDependencies: @@ -7003,11 +7005,11 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.2.4 + typescript: 4.4.4 yn: 3.1.1 dev: false - /ts-node/10.4.0_54d7f9b57c83a5c5120be11b085b9de6: + /ts-node/10.4.0_f9f9f28f986ed7ad377c75abc9f416f4: resolution: {integrity: sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==} hasBin: true peerDependencies: @@ -7033,7 +7035,7 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.4.4 + typescript: 4.2.4 yn: 3.1.1 dev: false @@ -7629,7 +7631,7 @@ packages: prettier: 2.5.1 rimraf: 3.0.2 rollup: 1.32.1 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 transitivePeerDependencies: @@ -7857,7 +7859,7 @@ packages: rollup: 1.32.1 sinon: 9.2.4 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 transitivePeerDependencies: @@ -7908,7 +7910,7 @@ packages: rollup: 1.32.1 sinon: 9.2.4 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 transitivePeerDependencies: @@ -7965,7 +7967,7 @@ packages: rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 sinon: 9.2.4 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.14.5 @@ -8500,6 +8502,27 @@ packages: uglify-js: 3.14.5 dev: false + file:projects/arm-digitaltwins.tgz: + resolution: {integrity: sha512-fJw3Lem9lNeRFFW9akRsVx6jUxVLqilkTGeTZK1OLVCERqNsl0DIgW49BgMUgob/DITGPGAj1/kgmCmD5sJ1jA==, tarball: file:projects/arm-digitaltwins.tgz} + name: '@rush-temp/arm-digitaltwins' + version: 0.0.0 + dependencies: + '@microsoft/api-extractor': 7.19.2 + '@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: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.5 + dev: false + file:projects/arm-eventgrid.tgz: resolution: {integrity: sha512-26uyTQ6UX9N1i+BWqT3Ga154/45qazjGOcYOuleDzv7+gERljkMNe6dHkAbeLpwr8k/Tt9mdHY/1dLHrcRIa+w==, tarball: file:projects/arm-eventgrid.tgz} name: '@rush-temp/arm-eventgrid' @@ -9487,7 +9510,7 @@ packages: rollup: 1.32.1 safe-buffer: 5.2.1 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 util: 0.12.4 @@ -9982,7 +10005,7 @@ packages: dev: false file:projects/core-amqp.tgz: - resolution: {integrity: sha512-jmyXvDp5FyZIlqp1zATESQp6qO2NqjKSfY5o9ojPsKN/g9WJ45RL4jfy+cD5u8C2t9jSDTsCoL+jbiLptpkDLA==, tarball: file:projects/core-amqp.tgz} + resolution: {integrity: sha512-nAZlMW/WFVSloK1iVzoSJNx9CHjvMl4/kJrnq1s5Okn96/AQX19SYkqfdvmew1Oy3bxfDC2g3n3e1CFLrlSyEg==, tarball: file:projects/core-amqp.tgz} name: '@rush-temp/core-amqp' version: 0.0.0 dependencies: @@ -10025,7 +10048,7 @@ packages: rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 sinon: 9.2.4 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 url: 0.11.0 @@ -10111,7 +10134,7 @@ packages: rimraf: 3.0.2 rollup: 1.32.1 sinon: 9.2.4 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 util: 0.12.4 @@ -10342,7 +10365,7 @@ packages: shx: 0.3.3 sinon: 9.2.4 tough-cookie: 4.0.0 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 tunnel: 0.0.6 typescript: 4.2.4 @@ -10390,7 +10413,7 @@ packages: prettier: 2.5.1 rimraf: 3.0.2 rollup: 1.32.1 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.14.5 @@ -10657,7 +10680,7 @@ packages: sinon: 9.2.4 snap-shot-it: 7.9.6 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 universal-user-agent: 6.0.0 @@ -10714,7 +10737,7 @@ packages: rollup-plugin-terser: 5.3.1_rollup@1.32.1 rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 util: 0.12.4 @@ -10760,7 +10783,7 @@ packages: rollup: 1.32.1 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 - ts-node: 10.4.0_54d7f9b57c83a5c5120be11b085b9de6 + ts-node: 10.4.0_28670484a221c7e896c5d6b821a5cbb7 tslib: 2.3.1 typescript: 4.4.4 yaml: 1.10.2 @@ -10917,7 +10940,7 @@ packages: rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 rollup-plugin-terser: 5.3.1_rollup@1.32.1 sinon: 9.2.4 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uuid: 8.3.2 @@ -10979,7 +11002,7 @@ packages: rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uuid: 8.3.2 @@ -11034,7 +11057,7 @@ packages: prettier: 2.5.1 rimraf: 3.0.2 rollup: 1.32.1 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 util: 0.12.4 @@ -11087,7 +11110,7 @@ packages: prettier: 2.5.1 rimraf: 3.0.2 rollup: 1.32.1 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 util: 0.12.4 @@ -11289,7 +11312,7 @@ packages: rollup-plugin-terser: 5.3.1_rollup@1.32.1 rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 util: 0.12.4 @@ -11553,7 +11576,7 @@ packages: rimraf: 3.0.2 rollup: 1.32.1 sinon: 9.2.4 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 transitivePeerDependencies: @@ -11702,7 +11725,7 @@ packages: rimraf: 3.0.2 rollup: 1.32.1 sinon: 9.2.4 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 transitivePeerDependencies: @@ -11774,7 +11797,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 transitivePeerDependencies: @@ -11794,7 +11817,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 transitivePeerDependencies: @@ -11814,7 +11837,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 transitivePeerDependencies: @@ -11834,7 +11857,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uuid: 8.3.2 @@ -11873,7 +11896,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 transitivePeerDependencies: @@ -11894,7 +11917,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uuid: 8.3.2 @@ -11917,7 +11940,7 @@ packages: moment: 2.29.1 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uuid: 8.3.2 @@ -11937,7 +11960,7 @@ packages: eslint: 7.32.0 prettier: 1.19.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 transitivePeerDependencies: @@ -11957,7 +11980,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 transitivePeerDependencies: @@ -11978,7 +12001,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uuid: 8.3.2 @@ -12000,7 +12023,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uuid: 8.3.2 @@ -12021,7 +12044,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uuid: 8.3.2 @@ -12041,7 +12064,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 transitivePeerDependencies: @@ -12060,7 +12083,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 transitivePeerDependencies: @@ -12081,7 +12104,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uuid: 8.3.2 @@ -12104,7 +12127,7 @@ packages: node-fetch: 2.6.6 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uuid: 8.3.2 @@ -12125,7 +12148,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uuid: 8.3.2 @@ -12146,7 +12169,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uuid: 8.3.2 @@ -12167,7 +12190,7 @@ packages: eslint: 7.32.0 prettier: 2.5.1 rimraf: 3.0.2 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uuid: 8.3.2 @@ -12539,7 +12562,7 @@ packages: rimraf: 3.0.2 rollup: 1.32.1 sinon: 9.2.4 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 util: 0.12.4 @@ -12608,7 +12631,7 @@ packages: rimraf: 3.0.2 rollup: 1.32.1 sinon: 9.2.4 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 ws: 8.3.0 @@ -12671,7 +12694,7 @@ packages: rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 sinon: 9.2.4 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 util: 0.12.4 @@ -12734,7 +12757,7 @@ packages: rollup-plugin-terser: 5.3.1_rollup@1.32.1 rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 util: 0.12.4 @@ -12797,7 +12820,7 @@ packages: rollup-plugin-terser: 5.3.1_rollup@1.32.1 rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 util: 0.12.4 @@ -12858,7 +12881,7 @@ packages: rollup-plugin-terser: 5.3.1_rollup@1.32.1 rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 util: 0.12.4 @@ -12916,7 +12939,7 @@ packages: rollup-plugin-terser: 5.3.1_rollup@1.32.1 rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 util: 0.12.4 @@ -12976,7 +12999,7 @@ packages: rollup-plugin-terser: 5.3.1_rollup@1.32.1 rollup-plugin-visualizer: 4.2.2_rollup@1.32.1 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 util: 0.12.4 @@ -13028,7 +13051,7 @@ packages: rollup: 1.32.1 sinon: 9.2.4 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.14.5 @@ -13082,7 +13105,7 @@ packages: rollup: 1.32.1 sinon: 9.2.4 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.14.5 @@ -13135,7 +13158,7 @@ packages: rollup: 1.32.1 sinon: 9.2.4 source-map-support: 0.5.21 - ts-node: 10.4.0_276ff2ad8f60608417677a4691c0f835 + ts-node: 10.4.0_f9f9f28f986ed7ad377c75abc9f416f4 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.14.5 diff --git a/rush.json b/rush.json index 66a9aa13703f..797d07d0ccac 100644 --- a/rush.json +++ b/rush.json @@ -1215,6 +1215,11 @@ "packageName": "@azure/arm-containerinstance", "projectFolder": "sdk/containerinstance/arm-containerinstance", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-digitaltwins", + "projectFolder": "sdk/digitaltwins/arm-digitaltwins", + "versionPolicyName": "management" } ] } \ No newline at end of file diff --git a/sdk/digitaltwins/arm-digitaltwins/CHANGELOG.md b/sdk/digitaltwins/arm-digitaltwins/CHANGELOG.md new file mode 100644 index 000000000000..1534a7c8cda4 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 3.0.0 (2022-01-05) + +The package of @azure/arm-digitaltwins is using our next generation design principles since version 3.0.0, which contains breaking changes. + +To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/digitaltwins/arm-digitaltwins/LICENSE b/sdk/digitaltwins/arm-digitaltwins/LICENSE new file mode 100644 index 000000000000..5d1d36e0af80 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/digitaltwins/arm-digitaltwins/README.md b/sdk/digitaltwins/arm-digitaltwins/README.md index 48d9191e17e0..7a8e9e51a0b7 100644 --- a/sdk/digitaltwins/arm-digitaltwins/README.md +++ b/sdk/digitaltwins/arm-digitaltwins/README.md @@ -1,112 +1,98 @@ -## Azure AzureDigitalTwinsManagementClient SDK for JavaScript +# AzureDigitalTwinsManagement client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for AzureDigitalTwinsManagementClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for AzureDigitalTwinsManagement client. + +Azure Digital Twins Client for managing DigitalTwinsInstance + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/digitaltwins/arm-digitaltwins) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-digitaltwins) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-digitaltwins) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. ### Prerequisites -You must have an [Azure subscription](https://azure.microsoft.com/free/). +- An [Azure subscription][azure_sub]. -### How to install +### Install the `@azure/arm-digitaltwins` package -To use this SDK in your project, you will need to install two packages. -- `@azure/arm-digitaltwins` that contains the client. -- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory. +Install the AzureDigitalTwinsManagement client library for JavaScript with `npm`: -Install both packages using the below command: ```bash -npm install --save @azure/arm-digitaltwins @azure/identity +npm install @azure/arm-digitaltwins ``` -> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features. -If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options. +### Create and authenticate a `AzureDigitalTwinsManagementClient` -### How to use +To create a client object to access the AzureDigitalTwinsManagement API, you will need the `endpoint` of your AzureDigitalTwinsManagement resource and a `credential`. The AzureDigitalTwinsManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your AzureDigitalTwinsManagement resource in the [Azure Portal][azure_portal]. -- If you are writing a client side browser application, - - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions. - - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below. -- If you are writing a server side application, - - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples) - - Complete the set up steps required by the credential if any. - - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below. +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). -In the below samples, we pass the credential and the Azure subscription id to instantiate the client. -Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started. +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` -#### nodejs - Authentication, client creation, and get digitalTwins as an example written in JavaScript. +You will also need to **register a new AAD application and grant access to AzureDigitalTwinsManagement** 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`. -##### Sample code +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). ```javascript -const { DefaultAzureCredential } = require("@azure/identity"); const { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples -// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead. -const creds = new DefaultAzureCredential(); -const client = new AzureDigitalTwinsManagementClient(creds, subscriptionId); -const resourceGroupName = "testresourceGroupName"; -const resourceName = "testresourceName"; -client.digitalTwins.get(resourceGroupName, resourceName).then((result) => { - console.log("The result is:"); - console.log(result); -}).catch((err) => { - console.log("An error occurred:"); - console.error(err); -}); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new AzureDigitalTwinsManagementClient(new DefaultAzureCredential(), subscriptionId); ``` -#### browser - Authentication, client creation, and get digitalTwins as an example written in JavaScript. - -In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser. - - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser. - - Note down the client Id from the previous step and use it in the browser sample below. - -##### Sample code - -- index.html - -```html - - - - @azure/arm-digitaltwins sample - - - - - - - + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### AzureDigitalTwinsManagementClient + +`AzureDigitalTwinsManagementClient` is the primary interface for developers using the AzureDigitalTwinsManagement client library. Explore the methods on this client object to understand the different features of the AzureDigitalTwinsManagement service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); ``` +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + ## Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fdigitaltwins%2Farm-digitaltwins%2FREADME.png) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/digitaltwins/arm-digitaltwins/README.png) +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/digitaltwins/arm-digitaltwins/_meta.json b/sdk/digitaltwins/arm-digitaltwins/_meta.json new file mode 100644 index 000000000000..c09102faee98 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "cea6492a1e41b3f3b4f8b4f69bdcc10431e79c0e", + "readme": "specification/digitaltwins/resource-manager/readme.md", + "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/digitaltwins/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211130.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20211130.1" +} \ No newline at end of file diff --git a/sdk/digitaltwins/arm-digitaltwins/api-extractor.json b/sdk/digitaltwins/arm-digitaltwins/api-extractor.json new file mode 100644 index 000000000000..f74b96ff2afe --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-digitaltwins.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/digitaltwins/arm-digitaltwins/package.json b/sdk/digitaltwins/arm-digitaltwins/package.json index e13bc848ee97..2bd3426cef25 100644 --- a/sdk/digitaltwins/arm-digitaltwins/package.json +++ b/sdk/digitaltwins/arm-digitaltwins/package.json @@ -1,58 +1,91 @@ { "name": "@azure/arm-digitaltwins", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "AzureDigitalTwinsManagementClient Library with typescript type definitions for node.js and browser.", - "version": "2.1.0", + "description": "A generated SDK for AzureDigitalTwinsManagementClient.", + "version": "3.0.0", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-azure-js": "^2.1.0", - "@azure/ms-rest-js": "^2.2.0", - "@azure/core-auth": "^1.1.4", - "tslib": "^1.10.0" + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", - "main": "./dist/arm-digitaltwins.js", - "module": "./esm/azureDigitalTwinsManagementClient.js", - "types": "./esm/azureDigitalTwinsManagementClient.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-digitaltwins.d.ts", "devDependencies": { - "typescript": "^3.6.0", - "rollup": "^1.18.0", - "rollup-plugin-node-resolve": "^5.2.0", + "@microsoft/api-extractor": "^7.18.11", + "@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": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.6.0" + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/digitaltwins/arm-digitaltwins", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-digitaltwins.js.map'\" -o ./dist/arm-digitaltwins.min.js ./dist/arm-digitaltwins.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, "autoPublish": true diff --git a/sdk/digitaltwins/arm-digitaltwins/review/arm-digitaltwins.api.md b/sdk/digitaltwins/arm-digitaltwins/review/arm-digitaltwins.api.md new file mode 100644 index 000000000000..d0926f188c5f --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/review/arm-digitaltwins.api.md @@ -0,0 +1,620 @@ +## API Report File for "@azure/arm-digitaltwins" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export type AuthenticationType = string; + +// @public (undocumented) +export class AzureDigitalTwinsManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: AzureDigitalTwinsManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + digitalTwins: DigitalTwins; + // (undocumented) + digitalTwinsEndpoint: DigitalTwinsEndpoint; + // (undocumented) + operations: Operations; + // (undocumented) + privateEndpointConnections: PrivateEndpointConnections; + // (undocumented) + privateLinkResources: PrivateLinkResources; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface AzureDigitalTwinsManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface CheckNameRequest { + name: string; + type: "Microsoft.DigitalTwins/digitalTwinsInstances"; +} + +// @public +export interface CheckNameResult { + message?: string; + nameAvailable?: boolean; + reason?: Reason; +} + +// @public +export interface ConnectionProperties { + groupIds?: string[]; + // (undocumented) + privateEndpoint?: ConnectionPropertiesPrivateEndpoint; + // (undocumented) + privateLinkServiceConnectionState?: ConnectionPropertiesPrivateLinkServiceConnectionState; + readonly provisioningState?: ConnectionPropertiesProvisioningState; +} + +// @public (undocumented) +export type ConnectionPropertiesPrivateEndpoint = PrivateEndpoint & {}; + +// @public (undocumented) +export type ConnectionPropertiesPrivateLinkServiceConnectionState = ConnectionState & {}; + +// @public +export type ConnectionPropertiesProvisioningState = string; + +// @public +export interface ConnectionState { + actionsRequired?: string; + description: string; + status: PrivateLinkServiceConnectionStatus; +} + +// @public +export interface DigitalTwins { + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, digitalTwinsCreate: DigitalTwinsDescription, options?: DigitalTwinsCreateOrUpdateOptionalParams): Promise, DigitalTwinsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, resourceName: string, digitalTwinsCreate: DigitalTwinsDescription, options?: DigitalTwinsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, resourceName: string, options?: DigitalTwinsDeleteOptionalParams): Promise, DigitalTwinsDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, resourceName: string, options?: DigitalTwinsDeleteOptionalParams): Promise; + beginUpdate(resourceGroupName: string, resourceName: string, digitalTwinsPatchDescription: DigitalTwinsPatchDescription, options?: DigitalTwinsUpdateOptionalParams): Promise, DigitalTwinsUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, resourceName: string, digitalTwinsPatchDescription: DigitalTwinsPatchDescription, options?: DigitalTwinsUpdateOptionalParams): Promise; + checkNameAvailability(location: string, digitalTwinsInstanceCheckName: CheckNameRequest, options?: DigitalTwinsCheckNameAvailabilityOptionalParams): Promise; + get(resourceGroupName: string, resourceName: string, options?: DigitalTwinsGetOptionalParams): Promise; + list(options?: DigitalTwinsListOptionalParams): PagedAsyncIterableIterator; + listByResourceGroup(resourceGroupName: string, options?: DigitalTwinsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface DigitalTwinsCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DigitalTwinsCheckNameAvailabilityResponse = CheckNameResult; + +// @public +export interface DigitalTwinsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DigitalTwinsCreateOrUpdateResponse = DigitalTwinsDescription; + +// @public +export interface DigitalTwinsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DigitalTwinsDeleteResponse = DigitalTwinsDescription; + +// @public +export type DigitalTwinsDescription = DigitalTwinsResource & { + readonly createdTime?: Date; + readonly lastUpdatedTime?: Date; + readonly provisioningState?: ProvisioningState; + readonly hostName?: string; + privateEndpointConnections?: PrivateEndpointConnection[]; + publicNetworkAccess?: PublicNetworkAccess; +}; + +// @public +export interface DigitalTwinsDescriptionListResult { + nextLink?: string; + value?: DigitalTwinsDescription[]; +} + +// @public +export interface DigitalTwinsEndpoint { + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, endpointName: string, endpointDescription: DigitalTwinsEndpointResource, options?: DigitalTwinsEndpointCreateOrUpdateOptionalParams): Promise, DigitalTwinsEndpointCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, resourceName: string, endpointName: string, endpointDescription: DigitalTwinsEndpointResource, options?: DigitalTwinsEndpointCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, resourceName: string, endpointName: string, options?: DigitalTwinsEndpointDeleteOptionalParams): Promise, DigitalTwinsEndpointDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, resourceName: string, endpointName: string, options?: DigitalTwinsEndpointDeleteOptionalParams): Promise; + get(resourceGroupName: string, resourceName: string, endpointName: string, options?: DigitalTwinsEndpointGetOptionalParams): Promise; + list(resourceGroupName: string, resourceName: string, options?: DigitalTwinsEndpointListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface DigitalTwinsEndpointCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DigitalTwinsEndpointCreateOrUpdateResponse = DigitalTwinsEndpointResource; + +// @public +export interface DigitalTwinsEndpointDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DigitalTwinsEndpointDeleteResponse = DigitalTwinsEndpointResource; + +// @public +export interface DigitalTwinsEndpointGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DigitalTwinsEndpointGetResponse = DigitalTwinsEndpointResource; + +// @public +export interface DigitalTwinsEndpointListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DigitalTwinsEndpointListNextResponse = DigitalTwinsEndpointResourceListResult; + +// @public +export interface DigitalTwinsEndpointListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DigitalTwinsEndpointListResponse = DigitalTwinsEndpointResourceListResult; + +// @public +export type DigitalTwinsEndpointResource = ExternalResource & { + properties: DigitalTwinsEndpointResourcePropertiesUnion; +}; + +// @public +export interface DigitalTwinsEndpointResourceListResult { + nextLink?: string; + value?: DigitalTwinsEndpointResource[]; +} + +// @public +export interface DigitalTwinsEndpointResourceProperties { + authenticationType?: AuthenticationType; + readonly createdTime?: Date; + deadLetterSecret?: string; + deadLetterUri?: string; + endpointType: "ServiceBus" | "EventHub" | "EventGrid"; + readonly provisioningState?: EndpointProvisioningState; +} + +// @public (undocumented) +export type DigitalTwinsEndpointResourcePropertiesUnion = DigitalTwinsEndpointResourceProperties | ServiceBus | EventHub | EventGrid; + +// @public +export interface DigitalTwinsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DigitalTwinsGetResponse = DigitalTwinsDescription; + +// @public +export interface DigitalTwinsIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type?: DigitalTwinsIdentityType; +} + +// @public +export type DigitalTwinsIdentityType = string; + +// @public +export interface DigitalTwinsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DigitalTwinsListByResourceGroupNextResponse = DigitalTwinsDescriptionListResult; + +// @public +export interface DigitalTwinsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DigitalTwinsListByResourceGroupResponse = DigitalTwinsDescriptionListResult; + +// @public +export interface DigitalTwinsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DigitalTwinsListNextResponse = DigitalTwinsDescriptionListResult; + +// @public +export interface DigitalTwinsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DigitalTwinsListResponse = DigitalTwinsDescriptionListResult; + +// @public +export interface DigitalTwinsPatchDescription { + identity?: DigitalTwinsIdentity; + properties?: DigitalTwinsPatchProperties; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface DigitalTwinsPatchProperties { + publicNetworkAccess?: PublicNetworkAccess; +} + +// @public +export interface DigitalTwinsResource { + readonly id?: string; + identity?: DigitalTwinsIdentity; + location: string; + readonly name?: string; + tags?: { + [propertyName: string]: string; + }; + readonly type?: string; +} + +// @public +export interface DigitalTwinsUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DigitalTwinsUpdateResponse = DigitalTwinsDescription; + +// @public +export type EndpointProvisioningState = string; + +// @public +export type EndpointType = string; + +// @public +export interface ErrorDefinition { + readonly code?: string; + readonly details?: ErrorDefinition[]; + readonly message?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDefinition; +} + +// @public +export type EventGrid = DigitalTwinsEndpointResourceProperties & { + endpointType: "EventGrid"; + topicEndpoint: string; + accessKey1: string | null; + accessKey2?: string; +}; + +// @public +export type EventHub = DigitalTwinsEndpointResourceProperties & { + endpointType: "EventHub"; + connectionStringPrimaryKey?: string; + connectionStringSecondaryKey?: string; + endpointUri?: string; + entityPath?: string; +}; + +// @public +export interface ExternalResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public +export interface GroupIdInformation { + id?: string; + readonly name?: string; + // (undocumented) + properties: GroupIdInformationProperties; + readonly type?: string; +} + +// @public (undocumented) +export type GroupIdInformationProperties = GroupIdInformationPropertiesAutoGenerated & {}; + +// @public +export interface GroupIdInformationPropertiesAutoGenerated { + groupId?: string; + requiredMembers?: string[]; + requiredZoneNames?: string[]; +} + +// @public +export interface GroupIdInformationResponse { + value?: GroupIdInformation[]; +} + +// @public +export enum KnownAuthenticationType { + // (undocumented) + IdentityBased = "IdentityBased", + // (undocumented) + KeyBased = "KeyBased" +} + +// @public +export enum KnownConnectionPropertiesProvisioningState { + // (undocumented) + Approved = "Approved", + // (undocumented) + Disconnected = "Disconnected", + // (undocumented) + Pending = "Pending", + // (undocumented) + Rejected = "Rejected" +} + +// @public +export enum KnownDigitalTwinsIdentityType { + // (undocumented) + None = "None", + // (undocumented) + SystemAssigned = "SystemAssigned" +} + +// @public +export enum KnownEndpointProvisioningState { + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Deleted = "Deleted", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Failed = "Failed", + // (undocumented) + Moving = "Moving", + // (undocumented) + Provisioning = "Provisioning", + // (undocumented) + Restoring = "Restoring", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Suspending = "Suspending", + // (undocumented) + Warning = "Warning" +} + +// @public +export enum KnownEndpointType { + // (undocumented) + EventGrid = "EventGrid", + // (undocumented) + EventHub = "EventHub", + // (undocumented) + ServiceBus = "ServiceBus" +} + +// @public +export enum KnownPrivateLinkServiceConnectionStatus { + // (undocumented) + Approved = "Approved", + // (undocumented) + Disconnected = "Disconnected", + // (undocumented) + Pending = "Pending", + // (undocumented) + Rejected = "Rejected" +} + +// @public +export enum KnownProvisioningState { + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Deleted = "Deleted", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Moving = "Moving", + // (undocumented) + Provisioning = "Provisioning", + // (undocumented) + Restoring = "Restoring", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Suspending = "Suspending", + // (undocumented) + Updating = "Updating", + // (undocumented) + Warning = "Warning" +} + +// @public +export enum KnownPublicNetworkAccess { + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Enabled = "Enabled" +} + +// @public +export enum KnownReason { + // (undocumented) + AlreadyExists = "AlreadyExists", + // (undocumented) + Invalid = "Invalid" +} + +// @public +export interface Operation { + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: string; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface OperationListResult { + nextLink?: string; + readonly value?: Operation[]; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationListResult; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationListResult; + +// @public +export interface PrivateEndpoint { + readonly id?: string; +} + +// @public +export interface PrivateEndpointConnection { + readonly id?: string; + readonly name?: string; + // (undocumented) + properties: PrivateEndpointConnectionProperties; + readonly type?: string; +} + +// @public (undocumented) +export type PrivateEndpointConnectionProperties = ConnectionProperties & {}; + +// @public +export interface PrivateEndpointConnections { + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: PrivateEndpointConnectionsCreateOrUpdateOptionalParams): Promise, PrivateEndpointConnectionsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: PrivateEndpointConnectionsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise; + get(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; + list(resourceGroupName: string, resourceName: string, options?: PrivateEndpointConnectionsListOptionalParams): Promise; +} + +// @public +export interface PrivateEndpointConnectionsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type PrivateEndpointConnectionsCreateOrUpdateResponse = PrivateEndpointConnection; + +// @public +export interface PrivateEndpointConnectionsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface PrivateEndpointConnectionsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PrivateEndpointConnectionsGetResponse = PrivateEndpointConnection; + +// @public +export interface PrivateEndpointConnectionsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PrivateEndpointConnectionsListResponse = PrivateEndpointConnectionsResponse; + +// @public +export interface PrivateEndpointConnectionsResponse { + value?: PrivateEndpointConnection[]; +} + +// @public +export interface PrivateLinkResources { + get(resourceGroupName: string, resourceName: string, resourceId: string, options?: PrivateLinkResourcesGetOptionalParams): Promise; + list(resourceGroupName: string, resourceName: string, options?: PrivateLinkResourcesListOptionalParams): Promise; +} + +// @public +export interface PrivateLinkResourcesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PrivateLinkResourcesGetResponse = GroupIdInformation; + +// @public +export interface PrivateLinkResourcesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PrivateLinkResourcesListResponse = GroupIdInformationResponse; + +// @public +export type PrivateLinkServiceConnectionStatus = string; + +// @public +export type ProvisioningState = string; + +// @public +export type PublicNetworkAccess = string; + +// @public +export type Reason = string; + +// @public +export type ServiceBus = DigitalTwinsEndpointResourceProperties & { + endpointType: "ServiceBus"; + primaryConnectionString?: string; + secondaryConnectionString?: string; + endpointUri?: string; + entityPath?: string; +}; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/digitaltwins/arm-digitaltwins/rollup.config.js b/sdk/digitaltwins/arm-digitaltwins/rollup.config.js index 8370182a953c..9be1955eb7f1 100644 --- a/sdk/digitaltwins/arm-digitaltwins/rollup.config.js +++ b/sdk/digitaltwins/arm-digitaltwins/rollup.config.js @@ -1,37 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/azureDigitalTwinsManagementClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-digitaltwins.js", - format: "umd", - name: "Azure.ArmDigitaltwins", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" - }, - banner: `/* +/* * 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. - */` - }, - plugins: [ - nodeResolve({ mainFields: ['module', 'main'] }), - sourcemaps() - ] + */ + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +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 rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + 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 }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false }; -export default config; +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/digitaltwins/arm-digitaltwins/src/azureDigitalTwinsManagementClient.ts b/sdk/digitaltwins/arm-digitaltwins/src/azureDigitalTwinsManagementClient.ts index 9a9bf51be733..5ea1ccd6bb1b 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/azureDigitalTwinsManagementClient.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/azureDigitalTwinsManagementClient.ts @@ -3,53 +3,93 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import { TokenCredential } from "@azure/core-auth"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as operations from "./operations"; -import { AzureDigitalTwinsManagementClientContext } from "./azureDigitalTwinsManagementClientContext"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + DigitalTwinsImpl, + DigitalTwinsEndpointImpl, + OperationsImpl, + PrivateLinkResourcesImpl, + PrivateEndpointConnectionsImpl +} from "./operations"; +import { + DigitalTwins, + DigitalTwinsEndpoint, + Operations, + PrivateLinkResources, + PrivateEndpointConnections +} from "./operationsInterfaces"; +import { AzureDigitalTwinsManagementClientOptionalParams } from "./models"; - -class AzureDigitalTwinsManagementClient extends AzureDigitalTwinsManagementClientContext { - // Operation groups - digitalTwins: operations.DigitalTwins; - digitalTwinsEndpoint: operations.DigitalTwinsEndpoint; - operations: operations.Operations; - privateLinkResources: operations.PrivateLinkResources; - privateEndpointConnections: operations.PrivateEndpointConnections; +export class AzureDigitalTwinsManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; /** * Initializes a new instance of the AzureDigitalTwinsManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. Credentials - * implementing the TokenCredential interface from the @azure/identity package are recommended. For - * more information about these credentials, see - * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the - * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and - * @azure/ms-rest-browserauth are also supported. + * @param credentials Subscription credentials which uniquely identify client subscription. * @param subscriptionId The subscription identifier. - * @param [options] The parameter options + * @param options The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.AzureDigitalTwinsManagementClientOptions) { - super(credentials, subscriptionId, options); - this.digitalTwins = new operations.DigitalTwins(this); - this.digitalTwinsEndpoint = new operations.DigitalTwinsEndpoint(this); - this.operations = new operations.Operations(this); - this.privateLinkResources = new operations.PrivateLinkResources(this); - this.privateEndpointConnections = new operations.PrivateEndpointConnections(this); - } -} + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: AzureDigitalTwinsManagementClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: AzureDigitalTwinsManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; -// Operation Specifications + const packageDetails = `azsdk-js-arm-digitaltwins/3.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; -export { - AzureDigitalTwinsManagementClient, - AzureDigitalTwinsManagementClientContext, - Models as AzureDigitalTwinsManagementModels, - Mappers as AzureDigitalTwinsManagementMappers -}; -export * from "./operations"; + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2020-12-01"; + this.digitalTwins = new DigitalTwinsImpl(this); + this.digitalTwinsEndpoint = new DigitalTwinsEndpointImpl(this); + this.operations = new OperationsImpl(this); + this.privateLinkResources = new PrivateLinkResourcesImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this); + } + + digitalTwins: DigitalTwins; + digitalTwinsEndpoint: DigitalTwinsEndpoint; + operations: Operations; + privateLinkResources: PrivateLinkResources; + privateEndpointConnections: PrivateEndpointConnections; +} diff --git a/sdk/digitaltwins/arm-digitaltwins/src/azureDigitalTwinsManagementClientContext.ts b/sdk/digitaltwins/arm-digitaltwins/src/azureDigitalTwinsManagementClientContext.ts deleted file mode 100644 index ee784856c160..000000000000 --- a/sdk/digitaltwins/arm-digitaltwins/src/azureDigitalTwinsManagementClientContext.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 * as Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import { TokenCredential } from "@azure/core-auth"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-digitaltwins"; -const packageVersion = "2.1.0"; - -export class AzureDigitalTwinsManagementClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials | TokenCredential; - subscriptionId: string; - apiVersion?: string; - - /** - * Initializes a new instance of the AzureDigitalTwinsManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. Credentials - * implementing the TokenCredential interface from the @azure/identity package are recommended. For - * more information about these credentials, see - * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the - * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and - * @azure/ms-rest-browserauth are also supported. - * @param subscriptionId The subscription identifier. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.AzureDigitalTwinsManagementClientOptions) { - if (credentials == undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - if (subscriptionId == undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } - - if (!options) { - options = {}; - } - if (!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.apiVersion = '2020-12-01'; - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - this.subscriptionId = subscriptionId; - - if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/digitaltwins/arm-digitaltwins/src/models/privateLinkResourcesMappers.ts b/sdk/digitaltwins/arm-digitaltwins/src/index.ts similarity index 52% rename from sdk/digitaltwins/arm-digitaltwins/src/models/privateLinkResourcesMappers.ts rename to sdk/digitaltwins/arm-digitaltwins/src/index.ts index b32c507be757..a992d6782b5e 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/models/privateLinkResourcesMappers.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/index.ts @@ -6,12 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - discriminators, - ErrorDefinition, - ErrorResponse, - GroupIdInformation, - GroupIdInformationProperties, - GroupIdInformationPropertiesModel, - GroupIdInformationResponse -} from "../models/mappers"; +/// +export * from "./models"; +export { AzureDigitalTwinsManagementClient } from "./azureDigitalTwinsManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/lroImpl.ts b/sdk/digitaltwins/arm-digitaltwins/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * 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 { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/digitaltwins/arm-digitaltwins/src/models/digitalTwinsEndpointMappers.ts b/sdk/digitaltwins/arm-digitaltwins/src/models/digitalTwinsEndpointMappers.ts deleted file mode 100644 index ad8ada29d2f4..000000000000 --- a/sdk/digitaltwins/arm-digitaltwins/src/models/digitalTwinsEndpointMappers.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 { - discriminators, - BaseResource, - ConnectionProperties, - ConnectionPropertiesPrivateEndpoint, - ConnectionPropertiesPrivateLinkServiceConnectionState, - ConnectionState, - DigitalTwinsDescription, - DigitalTwinsEndpointResource, - DigitalTwinsEndpointResourceListResult, - DigitalTwinsEndpointResourceProperties, - DigitalTwinsIdentity, - DigitalTwinsResource, - ErrorDefinition, - ErrorResponse, - EventGrid, - EventHub, - ExternalResource, - PrivateEndpoint, - PrivateEndpointConnection, - PrivateEndpointConnectionProperties, - ServiceBus -} from "../models/mappers"; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/models/digitalTwinsMappers.ts b/sdk/digitaltwins/arm-digitaltwins/src/models/digitalTwinsMappers.ts deleted file mode 100644 index dc8fe3f04d4b..000000000000 --- a/sdk/digitaltwins/arm-digitaltwins/src/models/digitalTwinsMappers.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 { - discriminators, - BaseResource, - CheckNameRequest, - CheckNameResult, - ConnectionProperties, - ConnectionPropertiesPrivateEndpoint, - ConnectionPropertiesPrivateLinkServiceConnectionState, - ConnectionState, - DigitalTwinsDescription, - DigitalTwinsDescriptionListResult, - DigitalTwinsEndpointResource, - DigitalTwinsEndpointResourceProperties, - DigitalTwinsIdentity, - DigitalTwinsPatchDescription, - DigitalTwinsPatchProperties, - DigitalTwinsResource, - ErrorDefinition, - ErrorResponse, - EventGrid, - EventHub, - ExternalResource, - PrivateEndpoint, - PrivateEndpointConnection, - PrivateEndpointConnectionProperties, - ServiceBus -} from "../models/mappers"; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/models/index.ts b/sdk/digitaltwins/arm-digitaltwins/src/models/index.ts index 792edb1f6cd8..5b24b4e7d3c2 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/models/index.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/models/index.ts @@ -6,1264 +6,782 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; +export type DigitalTwinsEndpointResourcePropertiesUnion = + | DigitalTwinsEndpointResourceProperties + | ServiceBus + | EventHub + | EventGrid; -/** - * The properties of a DigitalTwinsInstance. - */ -export interface DigitalTwinsPatchProperties { +/** The private endpoint connection of a Digital Twin. */ +export interface PrivateEndpointConnection { /** - * Public network access for the DigitalTwinsInstance. Possible values include: 'Enabled', - * 'Disabled' + * The resource identifier. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - publicNetworkAccess?: PublicNetworkAccess; + readonly id?: string; + /** + * The resource name. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The resource type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + properties: PrivateEndpointConnectionProperties; } -/** - * The properties of a private endpoint connection. - */ +/** The properties of a private endpoint connection. */ export interface ConnectionProperties { /** - * The provisioning state. Possible values include: 'Pending', 'Approved', 'Rejected', - * 'Disconnected' - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The provisioning state. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly provisioningState?: ConnectionPropertiesProvisioningState; privateEndpoint?: ConnectionPropertiesPrivateEndpoint; - /** - * The list of group ids for the private endpoint connection. - */ + /** The list of group ids for the private endpoint connection. */ groupIds?: string[]; privateLinkServiceConnectionState?: ConnectionPropertiesPrivateLinkServiceConnectionState; } -/** - * An interface representing PrivateEndpointConnectionProperties. - */ -export interface PrivateEndpointConnectionProperties extends ConnectionProperties { -} - -/** - * The private endpoint connection of a Digital Twin. - */ -export interface PrivateEndpointConnection extends BaseResource { +/** The private endpoint property of a private endpoint connection. */ +export interface PrivateEndpoint { /** * The resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly id?: string; - /** - * The resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * The resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - properties: PrivateEndpointConnectionProperties; } -/** - * The common properties of a DigitalTwinsInstance. - */ -export interface DigitalTwinsResource extends BaseResource { +/** The current state of a private endpoint connection. */ +export interface ConnectionState { + /** The status of a private endpoint connection. */ + status: PrivateLinkServiceConnectionStatus; + /** The description for the current state of a private endpoint connection. */ + description: string; + /** Actions required for a private endpoint connection. */ + actionsRequired?: string; +} + +/** The common properties of a DigitalTwinsInstance. */ +export interface DigitalTwinsResource { /** * The resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly id?: string; /** * The resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; /** * The resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; - /** - * The resource location. - */ + /** The resource location. */ location: string; - /** - * The resource tags. - */ + /** The resource tags. */ tags?: { [propertyName: string]: string }; - /** - * The managed identity for the DigitalTwinsInstance. - */ + /** The managed identity for the DigitalTwinsInstance. */ identity?: DigitalTwinsIdentity; } -/** - * The description of the DigitalTwins service. - */ -export interface DigitalTwinsDescription extends DigitalTwinsResource { - /** - * Time when DigitalTwinsInstance was created. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly createdTime?: Date; - /** - * Time when DigitalTwinsInstance was updated. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastUpdatedTime?: Date; - /** - * The provisioning state. Possible values include: 'Provisioning', 'Deleting', 'Updating', - * 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: ProvisioningState; - /** - * Api endpoint to work with DigitalTwinsInstance. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly hostName?: string; - privateEndpointConnections?: PrivateEndpointConnection[]; - /** - * Public network access for the DigitalTwinsInstance. Possible values include: 'Enabled', - * 'Disabled' - */ - publicNetworkAccess?: PublicNetworkAccess; -} - -/** - * The managed identity for the DigitalTwinsInstance. - */ +/** The managed identity for the DigitalTwinsInstance. */ export interface DigitalTwinsIdentity { - /** - * The type of Managed Identity used by the DigitalTwinsInstance. Only SystemAssigned is - * supported. Possible values include: 'None', 'SystemAssigned' - */ + /** The type of Managed Identity used by the DigitalTwinsInstance. Only SystemAssigned is supported. */ type?: DigitalTwinsIdentityType; /** - * The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the - * x-ms-identity-principal-id header in the PUT request if the resource has a - * systemAssigned(implicit) identity - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a systemAssigned(implicit) identity + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly principalId?: string; /** - * The tenant id of the Managed Identity Resource. This will be sent to the RP from ARM via the - * x-ms-client-tenant-id header in the PUT request if the resource has a systemAssigned(implicit) - * identity - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The tenant id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a systemAssigned(implicit) identity + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly tenantId?: string; } -/** - * The description of the DigitalTwins service. - */ -export interface DigitalTwinsPatchDescription { - /** - * Instance patch properties - */ - tags?: { [propertyName: string]: string }; - /** - * The managed identity for the DigitalTwinsInstance. - */ - identity?: DigitalTwinsIdentity; - /** - * Properties for the DigitalTwinsInstance. - */ - properties?: DigitalTwinsPatchProperties; +/** Error response. */ +export interface ErrorResponse { + /** Error description */ + error?: ErrorDefinition; } -/** - * Error definition. - */ +/** Error definition. */ export interface ErrorDefinition { /** * Service specific error code which serves as the substatus for the HTTP error code. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly code?: string; /** * Description of the error. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly message?: string; /** * Internal error details. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly details?: ErrorDefinition[]; } -/** - * Error response. - */ -export interface ErrorResponse { +/** The description of the DigitalTwins service. */ +export interface DigitalTwinsPatchDescription { + /** Instance patch properties */ + tags?: { [propertyName: string]: string }; + /** The managed identity for the DigitalTwinsInstance. */ + identity?: DigitalTwinsIdentity; + /** Properties for the DigitalTwinsInstance. */ + properties?: DigitalTwinsPatchProperties; +} + +/** The properties of a DigitalTwinsInstance. */ +export interface DigitalTwinsPatchProperties { + /** Public network access for the DigitalTwinsInstance. */ + publicNetworkAccess?: PublicNetworkAccess; +} + +/** A list of DigitalTwinsInstance Endpoints with a next link. */ +export interface DigitalTwinsEndpointResourceListResult { + /** The link used to get the next page of DigitalTwinsInstance Endpoints. */ + nextLink?: string; + /** A list of DigitalTwinsInstance Endpoints. */ + value?: DigitalTwinsEndpointResource[]; +} + +/** Properties related to Digital Twins Endpoint */ +export interface DigitalTwinsEndpointResourceProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + endpointType: "ServiceBus" | "EventHub" | "EventGrid"; /** - * Error description + * The provisioning state. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - error?: ErrorDefinition; + readonly provisioningState?: EndpointProvisioningState; + /** + * Time when the Endpoint was added to DigitalTwinsInstance. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly createdTime?: Date; + /** Specifies the authentication type being used for connecting to the endpoint. */ + authenticationType?: AuthenticationType; + /** Dead letter storage secret for key-based authentication. Will be obfuscated during read. */ + deadLetterSecret?: string; + /** Dead letter storage URL for identity-based authentication. */ + deadLetterUri?: string; } -/** - * The object that represents the operation. - */ -export interface OperationDisplay { +/** Definition of a resource. */ +export interface ExternalResource { /** - * Service provider: Microsoft DigitalTwins - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The resource identifier. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly provider?: string; + readonly id?: string; /** - * Resource Type: DigitalTwinsInstances - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Extension resource name. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly resource?: string; + readonly name?: string; /** - * Name of the operation - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The resource type. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly operation?: string; + readonly type?: string; +} + +/** A list of DigitalTwins description objects with a next link. */ +export interface DigitalTwinsDescriptionListResult { + /** The link used to get the next page of DigitalTwins description objects. */ + nextLink?: string; + /** A list of DigitalTwins description objects. */ + value?: DigitalTwinsDescription[]; +} + +/** A list of DigitalTwins service operations. It contains a list of operations and a URL link to get the next set of results. */ +export interface OperationListResult { + /** The link used to get the next page of DigitalTwins description objects. */ + nextLink?: string; /** - * Friendly description for the operation, - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * A list of DigitalTwins operations supported by the Microsoft.DigitalTwins resource provider. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly description?: string; + readonly value?: Operation[]; } -/** - * DigitalTwins service REST API operation - */ +/** DigitalTwins service REST API operation */ export interface Operation { /** * Operation name: {provider}/{resource}/{read | write | action | delete} - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; - /** - * Operation properties display - */ + /** Operation properties display */ display?: OperationDisplay; /** * The intended executor of the operation. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly origin?: string; /** * If the operation is a data action (for data plane rbac). - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly isDataAction?: boolean; } -/** - * The result returned from a database check name availability request. - */ -export interface CheckNameRequest { +/** The object that represents the operation. */ +export interface OperationDisplay { /** - * Resource name. + * Service provider: Microsoft DigitalTwins + * NOTE: This property will not be serialized. It can only be populated by the server. */ - name: string; -} - -/** - * The result returned from a check name availability request. - */ -export interface CheckNameResult { + readonly provider?: string; /** - * Specifies a Boolean value that indicates if the name is available. + * Resource Type: DigitalTwinsInstances + * NOTE: This property will not be serialized. It can only be populated by the server. */ - nameAvailable?: boolean; + readonly resource?: string; /** - * Message indicating an unavailable name due to a conflict, or a description of the naming rules - * that are violated. + * Name of the operation + * NOTE: This property will not be serialized. It can only be populated by the server. */ - message?: string; + readonly operation?: string; /** - * Message providing the reason why the given name is invalid. Possible values include: - * 'Invalid', 'AlreadyExists' + * Friendly description for the operation, + * NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly description?: string; +} + +/** The result returned from a database check name availability request. */ +export interface CheckNameRequest { + /** Resource name. */ + name: string; + /** The type of resource, for instance Microsoft.DigitalTwins/digitalTwinsInstances. */ + type: "Microsoft.DigitalTwins/digitalTwinsInstances"; +} + +/** The result returned from a check name availability request. */ +export interface CheckNameResult { + /** Specifies a Boolean value that indicates if the name is available. */ + nameAvailable?: boolean; + /** Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. */ + message?: string; + /** Message providing the reason why the given name is invalid. */ reason?: Reason; } -/** - * Definition of a resource. - */ -export interface ExternalResource extends BaseResource { - /** - * The resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; +/** The available private link resources for a Digital Twin. */ +export interface GroupIdInformationResponse { + /** The list of available private link resources for a Digital Twin. */ + value?: GroupIdInformation[]; +} + +/** The group information for creating a private endpoint on Digital Twin. */ +export interface GroupIdInformation { + properties: GroupIdInformationProperties; + /** The resource identifier. */ + id?: string; /** - * Extension resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The resource name. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; /** * The resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; } -/** - * Contains the possible cases for DigitalTwinsEndpointResourceProperties. - */ -export type DigitalTwinsEndpointResourcePropertiesUnion = DigitalTwinsEndpointResourceProperties | ServiceBus | EventHub | EventGrid; +/** The properties for a group information object. */ +export interface GroupIdInformationPropertiesAutoGenerated { + /** The group id */ + groupId?: string; + /** The required members for a specific group id. */ + requiredMembers?: string[]; + /** The required DNS zones for a specific group id. */ + requiredZoneNames?: string[]; +} -/** - * Properties related to Digital Twins Endpoint - */ -export interface DigitalTwinsEndpointResourceProperties { - /** - * Polymorphic Discriminator - */ - endpointType: "DigitalTwinsEndpointResourceProperties"; - /** - * The provisioning state. Possible values include: 'Provisioning', 'Deleting', 'Succeeded', - * 'Failed', 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: EndpointProvisioningState; +/** The available private link connections for a Digital Twin. */ +export interface PrivateEndpointConnectionsResponse { + /** The list of available private link connections for a Digital Twin. */ + value?: PrivateEndpointConnection[]; +} + +export type PrivateEndpointConnectionProperties = ConnectionProperties & {}; + +export type ConnectionPropertiesPrivateEndpoint = PrivateEndpoint & {}; + +export type ConnectionPropertiesPrivateLinkServiceConnectionState = ConnectionState & {}; + +/** The description of the DigitalTwins service. */ +export type DigitalTwinsDescription = DigitalTwinsResource & { /** - * Time when the Endpoint was added to DigitalTwinsInstance. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Time when DigitalTwinsInstance was created. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly createdTime?: Date; /** - * Specifies the authentication type being used for connecting to the endpoint. Possible values - * include: 'KeyBased', 'IdentityBased' + * Time when DigitalTwinsInstance was updated. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - authenticationType?: AuthenticationType; + readonly lastUpdatedTime?: Date; /** - * Dead letter storage secret for key-based authentication. Will be obfuscated during read. + * The provisioning state. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - deadLetterSecret?: string; + readonly provisioningState?: ProvisioningState; /** - * Dead letter storage URL for identity-based authentication. + * Api endpoint to work with DigitalTwinsInstance. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - deadLetterUri?: string; + readonly hostName?: string; + privateEndpointConnections?: PrivateEndpointConnection[]; + /** Public network access for the DigitalTwinsInstance. */ + publicNetworkAccess?: PublicNetworkAccess; +}; + +/** Properties related to ServiceBus. */ +export type ServiceBus = DigitalTwinsEndpointResourceProperties & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + endpointType: "ServiceBus"; + /** PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. */ + primaryConnectionString?: string; + /** SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. */ + secondaryConnectionString?: string; + /** The URL of the ServiceBus namespace for identity-based authentication. It must include the protocol sb:// */ + endpointUri?: string; + /** The ServiceBus Topic name for identity-based authentication */ + entityPath?: string; +}; + +/** Properties related to EventHub. */ +export type EventHub = DigitalTwinsEndpointResourceProperties & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + endpointType: "EventHub"; + /** PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. */ + connectionStringPrimaryKey?: string; + /** SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. */ + connectionStringSecondaryKey?: string; + /** The URL of the EventHub namespace for identity-based authentication. It must include the protocol sb:// */ + endpointUri?: string; + /** The EventHub name in the EventHub namespace for identity-based authentication. */ + entityPath?: string; +}; + +/** Properties related to EventGrid. */ +export type EventGrid = DigitalTwinsEndpointResourceProperties & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + endpointType: "EventGrid"; + /** EventGrid Topic Endpoint */ + topicEndpoint: string; + /** EventGrid secondary accesskey. Will be obfuscated during read. */ + accessKey1: string | null; + /** EventGrid secondary accesskey. Will be obfuscated during read. */ + accessKey2?: string; +}; + +/** DigitalTwinsInstance endpoint resource. */ +export type DigitalTwinsEndpointResource = ExternalResource & { + /** DigitalTwinsInstance endpoint resource properties. */ + properties: DigitalTwinsEndpointResourcePropertiesUnion; +}; + +export type GroupIdInformationProperties = GroupIdInformationPropertiesAutoGenerated & {}; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + Provisioning = "Provisioning", + Deleting = "Deleting", + Updating = "Updating", + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", + Deleted = "Deleted", + Warning = "Warning", + Suspending = "Suspending", + Restoring = "Restoring", + Moving = "Moving" +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Provisioning** \ + * **Deleting** \ + * **Updating** \ + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Deleted** \ + * **Warning** \ + * **Suspending** \ + * **Restoring** \ + * **Moving** + */ +export type ProvisioningState = string; + +/** Known values of {@link ConnectionPropertiesProvisioningState} that the service accepts. */ +export enum KnownConnectionPropertiesProvisioningState { + Pending = "Pending", + Approved = "Approved", + Rejected = "Rejected", + Disconnected = "Disconnected" +} + +/** + * Defines values for ConnectionPropertiesProvisioningState. \ + * {@link KnownConnectionPropertiesProvisioningState} can be used interchangeably with ConnectionPropertiesProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Pending** \ + * **Approved** \ + * **Rejected** \ + * **Disconnected** + */ +export type ConnectionPropertiesProvisioningState = string; + +/** Known values of {@link PrivateLinkServiceConnectionStatus} that the service accepts. */ +export enum KnownPrivateLinkServiceConnectionStatus { + Pending = "Pending", + Approved = "Approved", + Rejected = "Rejected", + Disconnected = "Disconnected" +} + +/** + * Defines values for PrivateLinkServiceConnectionStatus. \ + * {@link KnownPrivateLinkServiceConnectionStatus} can be used interchangeably with PrivateLinkServiceConnectionStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Pending** \ + * **Approved** \ + * **Rejected** \ + * **Disconnected** + */ +export type PrivateLinkServiceConnectionStatus = string; + +/** Known values of {@link PublicNetworkAccess} that the service accepts. */ +export enum KnownPublicNetworkAccess { + Enabled = "Enabled", + Disabled = "Disabled" +} + +/** + * Defines values for PublicNetworkAccess. \ + * {@link KnownPublicNetworkAccess} can be used interchangeably with PublicNetworkAccess, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type PublicNetworkAccess = string; + +/** Known values of {@link DigitalTwinsIdentityType} that the service accepts. */ +export enum KnownDigitalTwinsIdentityType { + None = "None", + SystemAssigned = "SystemAssigned" +} + +/** + * Defines values for DigitalTwinsIdentityType. \ + * {@link KnownDigitalTwinsIdentityType} can be used interchangeably with DigitalTwinsIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **SystemAssigned** + */ +export type DigitalTwinsIdentityType = string; + +/** Known values of {@link EndpointType} that the service accepts. */ +export enum KnownEndpointType { + EventHub = "EventHub", + EventGrid = "EventGrid", + ServiceBus = "ServiceBus" } /** - * DigitalTwinsInstance endpoint resource. + * Defines values for EndpointType. \ + * {@link KnownEndpointType} can be used interchangeably with EndpointType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **EventHub** \ + * **EventGrid** \ + * **ServiceBus** */ -export interface DigitalTwinsEndpointResource extends ExternalResource { - /** - * DigitalTwinsInstance endpoint resource properties. - */ - properties: DigitalTwinsEndpointResourcePropertiesUnion; +export type EndpointType = string; + +/** Known values of {@link EndpointProvisioningState} that the service accepts. */ +export enum KnownEndpointProvisioningState { + Provisioning = "Provisioning", + Deleting = "Deleting", + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", + Deleted = "Deleted", + Warning = "Warning", + Suspending = "Suspending", + Restoring = "Restoring", + Moving = "Moving", + Disabled = "Disabled" } /** - * Properties related to ServiceBus. + * Defines values for EndpointProvisioningState. \ + * {@link KnownEndpointProvisioningState} can be used interchangeably with EndpointProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Provisioning** \ + * **Deleting** \ + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Deleted** \ + * **Warning** \ + * **Suspending** \ + * **Restoring** \ + * **Moving** \ + * **Disabled** */ -export interface ServiceBus { - /** - * Polymorphic Discriminator - */ - endpointType: "ServiceBus"; - /** - * The provisioning state. Possible values include: 'Provisioning', 'Deleting', 'Succeeded', - * 'Failed', 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: EndpointProvisioningState; - /** - * Time when the Endpoint was added to DigitalTwinsInstance. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly createdTime?: Date; - /** - * Specifies the authentication type being used for connecting to the endpoint. Possible values - * include: 'KeyBased', 'IdentityBased' - */ - authenticationType?: AuthenticationType; - /** - * Dead letter storage secret for key-based authentication. Will be obfuscated during read. - */ - deadLetterSecret?: string; - /** - * Dead letter storage URL for identity-based authentication. - */ - deadLetterUri?: string; - /** - * PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated - * during read. - */ - primaryConnectionString?: string; - /** - * SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated - * during read. - */ - secondaryConnectionString?: string; - /** - * The URL of the ServiceBus namespace for identity-based authentication. It must include the - * protocol sb:// - */ - endpointUri?: string; - /** - * The ServiceBus Topic name for identity-based authentication - */ - entityPath?: string; -} +export type EndpointProvisioningState = string; -/** - * Properties related to EventHub. - */ -export interface EventHub { - /** - * Polymorphic Discriminator - */ - endpointType: "EventHub"; - /** - * The provisioning state. Possible values include: 'Provisioning', 'Deleting', 'Succeeded', - * 'Failed', 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: EndpointProvisioningState; - /** - * Time when the Endpoint was added to DigitalTwinsInstance. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly createdTime?: Date; - /** - * Specifies the authentication type being used for connecting to the endpoint. Possible values - * include: 'KeyBased', 'IdentityBased' - */ - authenticationType?: AuthenticationType; - /** - * Dead letter storage secret for key-based authentication. Will be obfuscated during read. - */ - deadLetterSecret?: string; - /** - * Dead letter storage URL for identity-based authentication. - */ - deadLetterUri?: string; - /** - * PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated - * during read. - */ - connectionStringPrimaryKey?: string; - /** - * SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated - * during read. - */ - connectionStringSecondaryKey?: string; - /** - * The URL of the EventHub namespace for identity-based authentication. It must include the - * protocol sb:// - */ - endpointUri?: string; - /** - * The EventHub name in the EventHub namespace for identity-based authentication. - */ - entityPath?: string; +/** Known values of {@link AuthenticationType} that the service accepts. */ +export enum KnownAuthenticationType { + KeyBased = "KeyBased", + IdentityBased = "IdentityBased" } /** - * Properties related to EventGrid. + * Defines values for AuthenticationType. \ + * {@link KnownAuthenticationType} can be used interchangeably with AuthenticationType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **KeyBased** \ + * **IdentityBased** */ -export interface EventGrid { - /** - * Polymorphic Discriminator - */ - endpointType: "EventGrid"; - /** - * The provisioning state. Possible values include: 'Provisioning', 'Deleting', 'Succeeded', - * 'Failed', 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: EndpointProvisioningState; - /** - * Time when the Endpoint was added to DigitalTwinsInstance. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly createdTime?: Date; - /** - * Specifies the authentication type being used for connecting to the endpoint. Possible values - * include: 'KeyBased', 'IdentityBased' - */ - authenticationType?: AuthenticationType; - /** - * Dead letter storage secret for key-based authentication. Will be obfuscated during read. - */ - deadLetterSecret?: string; - /** - * Dead letter storage URL for identity-based authentication. - */ - deadLetterUri?: string; - /** - * EventGrid Topic Endpoint - */ - topicEndpoint: string; - /** - * EventGrid secondary accesskey. Will be obfuscated during read. - */ - accessKey1: string; - /** - * EventGrid secondary accesskey. Will be obfuscated during read. - */ - accessKey2?: string; -} +export type AuthenticationType = string; -/** - * The properties for a group information object. - */ -export interface GroupIdInformationProperties { - /** - * The group id - */ - groupId?: string; - /** - * The required members for a specific group id. - */ - requiredMembers?: string[]; - /** - * The required DNS zones for a specific group id. - */ - requiredZoneNames?: string[]; +/** Known values of {@link Reason} that the service accepts. */ +export enum KnownReason { + Invalid = "Invalid", + AlreadyExists = "AlreadyExists" } /** - * An interface representing GroupIdInformationPropertiesModel. + * Defines values for Reason. \ + * {@link KnownReason} can be used interchangeably with Reason, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid** \ + * **AlreadyExists** */ -export interface GroupIdInformationPropertiesModel extends GroupIdInformationProperties { -} +export type Reason = string; -/** - * The group information for creating a private endpoint on Digital Twin. - */ -export interface GroupIdInformation { - properties: GroupIdInformationPropertiesModel; - /** - * The resource identifier. - */ - id?: string; - /** - * The resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * The resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; -} +/** Optional parameters. */ +export interface DigitalTwinsGetOptionalParams + extends coreClient.OperationOptions {} -/** - * The available private link connections for a Digital Twin. - */ -export interface PrivateEndpointConnectionsResponse { - /** - * The list of available private link connections for a Digital Twin. - */ - value?: PrivateEndpointConnection[]; -} +/** Contains response data for the get operation. */ +export type DigitalTwinsGetResponse = DigitalTwinsDescription; -/** - * The available private link resources for a Digital Twin. - */ -export interface GroupIdInformationResponse { - /** - * The list of available private link resources for a Digital Twin. - */ - value?: GroupIdInformation[]; +/** Optional parameters. */ +export interface DigitalTwinsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * The current state of a private endpoint connection. - */ -export interface ConnectionState { - /** - * The status of a private endpoint connection. Possible values include: 'Pending', 'Approved', - * 'Rejected', 'Disconnected' - */ - status: PrivateLinkServiceConnectionStatus; - /** - * The description for the current state of a private endpoint connection. - */ - description: string; - /** - * Actions required for a private endpoint connection. - */ - actionsRequired?: string; -} +/** Contains response data for the createOrUpdate operation. */ +export type DigitalTwinsCreateOrUpdateResponse = DigitalTwinsDescription; -/** - * The private endpoint property of a private endpoint connection. - */ -export interface PrivateEndpoint { - /** - * The resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; +/** Optional parameters. */ +export interface DigitalTwinsUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * An interface representing ConnectionPropertiesPrivateEndpoint. - */ -export interface ConnectionPropertiesPrivateEndpoint extends PrivateEndpoint { -} +/** Contains response data for the update operation. */ +export type DigitalTwinsUpdateResponse = DigitalTwinsDescription; -/** - * An interface representing ConnectionPropertiesPrivateLinkServiceConnectionState. - */ -export interface ConnectionPropertiesPrivateLinkServiceConnectionState extends ConnectionState { +/** Optional parameters. */ +export interface DigitalTwinsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * An interface representing AzureDigitalTwinsManagementClientOptions. - */ -export interface AzureDigitalTwinsManagementClientOptions extends AzureServiceClientOptions { - baseUri?: string; -} +/** Contains response data for the delete operation. */ +export type DigitalTwinsDeleteResponse = DigitalTwinsDescription; -/** - * @interface - * A list of DigitalTwins description objects with a next link. - * @extends Array - */ -export interface DigitalTwinsDescriptionListResult extends Array { - /** - * The link used to get the next page of DigitalTwins description objects. - */ - nextLink?: string; -} +/** Optional parameters. */ +export interface DigitalTwinsListOptionalParams + extends coreClient.OperationOptions {} -/** - * @interface - * A list of DigitalTwinsInstance Endpoints with a next link. - * @extends Array - */ -export interface DigitalTwinsEndpointResourceListResult extends Array { - /** - * The link used to get the next page of DigitalTwinsInstance Endpoints. - */ - nextLink?: string; -} +/** Contains response data for the list operation. */ +export type DigitalTwinsListResponse = DigitalTwinsDescriptionListResult; -/** - * @interface - * A list of DigitalTwins service operations. It contains a list of operations and a URL link to - * get the next set of results. - * @extends Array - */ -export interface OperationListResult extends Array { - /** - * The link used to get the next page of DigitalTwins description objects. - */ - nextLink?: string; -} +/** Optional parameters. */ +export interface DigitalTwinsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for PublicNetworkAccess. - * Possible values include: 'Enabled', 'Disabled' - * @readonly - * @enum {string} - */ -export type PublicNetworkAccess = 'Enabled' | 'Disabled'; +/** Contains response data for the listByResourceGroup operation. */ +export type DigitalTwinsListByResourceGroupResponse = DigitalTwinsDescriptionListResult; -/** - * Defines values for ProvisioningState. - * Possible values include: 'Provisioning', 'Deleting', 'Updating', 'Succeeded', 'Failed', - * 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving' - * @readonly - * @enum {string} - */ -export type ProvisioningState = 'Provisioning' | 'Deleting' | 'Updating' | 'Succeeded' | 'Failed' | 'Canceled' | 'Deleted' | 'Warning' | 'Suspending' | 'Restoring' | 'Moving'; +/** Optional parameters. */ +export interface DigitalTwinsCheckNameAvailabilityOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for DigitalTwinsIdentityType. - * Possible values include: 'None', 'SystemAssigned' - * @readonly - * @enum {string} - */ -export type DigitalTwinsIdentityType = 'None' | 'SystemAssigned'; +/** Contains response data for the checkNameAvailability operation. */ +export type DigitalTwinsCheckNameAvailabilityResponse = CheckNameResult; -/** - * Defines values for Reason. - * Possible values include: 'Invalid', 'AlreadyExists' - * @readonly - * @enum {string} - */ -export type Reason = 'Invalid' | 'AlreadyExists'; +/** Optional parameters. */ +export interface DigitalTwinsListNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for EndpointProvisioningState. - * Possible values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', - * 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' - * @readonly - * @enum {string} - */ -export type EndpointProvisioningState = 'Provisioning' | 'Deleting' | 'Succeeded' | 'Failed' | 'Canceled' | 'Deleted' | 'Warning' | 'Suspending' | 'Restoring' | 'Moving' | 'Disabled'; +/** Contains response data for the listNext operation. */ +export type DigitalTwinsListNextResponse = DigitalTwinsDescriptionListResult; -/** - * Defines values for AuthenticationType. - * Possible values include: 'KeyBased', 'IdentityBased' - * @readonly - * @enum {string} - */ -export type AuthenticationType = 'KeyBased' | 'IdentityBased'; +/** Optional parameters. */ +export interface DigitalTwinsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for PrivateLinkServiceConnectionStatus. - * Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' - * @readonly - * @enum {string} - */ -export type PrivateLinkServiceConnectionStatus = 'Pending' | 'Approved' | 'Rejected' | 'Disconnected'; +/** Contains response data for the listByResourceGroupNext operation. */ +export type DigitalTwinsListByResourceGroupNextResponse = DigitalTwinsDescriptionListResult; -/** - * Defines values for ConnectionPropertiesProvisioningState. - * Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' - * @readonly - * @enum {string} - */ -export type ConnectionPropertiesProvisioningState = 'Pending' | 'Approved' | 'Rejected' | 'Disconnected'; +/** Optional parameters. */ +export interface DigitalTwinsEndpointListOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the get operation. - */ -export type DigitalTwinsGetResponse = DigitalTwinsDescription & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsDescription; - }; -}; +/** Contains response data for the list operation. */ +export type DigitalTwinsEndpointListResponse = DigitalTwinsEndpointResourceListResult; -/** - * Contains response data for the createOrUpdate operation. - */ -export type DigitalTwinsCreateOrUpdateResponse = DigitalTwinsDescription & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsDescription; - }; -}; +/** Optional parameters. */ +export interface DigitalTwinsEndpointGetOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the update operation. - */ -export type DigitalTwinsUpdateResponse = DigitalTwinsDescription & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsDescription; - }; -}; +/** Contains response data for the get operation. */ +export type DigitalTwinsEndpointGetResponse = DigitalTwinsEndpointResource; -/** - * Contains response data for the deleteMethod operation. - */ -export type DigitalTwinsDeleteMethodResponse = DigitalTwinsDescription & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsDescription; - }; -}; +/** Optional parameters. */ +export interface DigitalTwinsEndpointCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} -/** - * Contains response data for the list operation. - */ -export type DigitalTwinsListResponse = DigitalTwinsDescriptionListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsDescriptionListResult; - }; -}; +/** Contains response data for the createOrUpdate operation. */ +export type DigitalTwinsEndpointCreateOrUpdateResponse = DigitalTwinsEndpointResource; -/** - * Contains response data for the listByResourceGroup operation. - */ -export type DigitalTwinsListByResourceGroupResponse = DigitalTwinsDescriptionListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsDescriptionListResult; - }; -}; +/** Optional parameters. */ +export interface DigitalTwinsEndpointDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} -/** - * Contains response data for the checkNameAvailability operation. - */ -export type DigitalTwinsCheckNameAvailabilityResponse = CheckNameResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CheckNameResult; - }; -}; +/** Contains response data for the delete operation. */ +export type DigitalTwinsEndpointDeleteResponse = DigitalTwinsEndpointResource; -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type DigitalTwinsBeginCreateOrUpdateResponse = DigitalTwinsDescription & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsDescription; - }; -}; +/** Optional parameters. */ +export interface DigitalTwinsEndpointListNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the beginUpdate operation. - */ -export type DigitalTwinsBeginUpdateResponse = DigitalTwinsDescription & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsDescription; - }; -}; +/** Contains response data for the listNext operation. */ +export type DigitalTwinsEndpointListNextResponse = DigitalTwinsEndpointResourceListResult; -/** - * Contains response data for the beginDeleteMethod operation. - */ -export type DigitalTwinsBeginDeleteMethodResponse = DigitalTwinsDescription & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsDescription; - }; -}; +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listNext operation. - */ -export type DigitalTwinsListNextResponse = DigitalTwinsDescriptionListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsDescriptionListResult; - }; -}; +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; -/** - * Contains response data for the listByResourceGroupNext operation. - */ -export type DigitalTwinsListByResourceGroupNextResponse = DigitalTwinsDescriptionListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsDescriptionListResult; - }; -}; +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the list operation. - */ -export type DigitalTwinsEndpointListResponse = DigitalTwinsEndpointResourceListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsEndpointResourceListResult; - }; -}; +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationListResult; -/** - * Contains response data for the get operation. - */ -export type DigitalTwinsEndpointGetResponse = DigitalTwinsEndpointResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsEndpointResource; - }; -}; +/** Optional parameters. */ +export interface PrivateLinkResourcesListOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the createOrUpdate operation. - */ -export type DigitalTwinsEndpointCreateOrUpdateResponse = DigitalTwinsEndpointResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsEndpointResource; - }; -}; +/** Contains response data for the list operation. */ +export type PrivateLinkResourcesListResponse = GroupIdInformationResponse; -/** - * Contains response data for the deleteMethod operation. - */ -export type DigitalTwinsEndpointDeleteMethodResponse = DigitalTwinsEndpointResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsEndpointResource; - }; -}; +/** Optional parameters. */ +export interface PrivateLinkResourcesGetOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type DigitalTwinsEndpointBeginCreateOrUpdateResponse = DigitalTwinsEndpointResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsEndpointResource; - }; -}; +/** Contains response data for the get operation. */ +export type PrivateLinkResourcesGetResponse = GroupIdInformation; -/** - * Contains response data for the beginDeleteMethod operation. - */ -export type DigitalTwinsEndpointBeginDeleteMethodResponse = DigitalTwinsEndpointResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsEndpointResource; - }; -}; +/** Optional parameters. */ +export interface PrivateEndpointConnectionsListOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listNext operation. - */ -export type DigitalTwinsEndpointListNextResponse = DigitalTwinsEndpointResourceListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: DigitalTwinsEndpointResourceListResult; - }; -}; +/** Contains response data for the list operation. */ +export type PrivateEndpointConnectionsListResponse = PrivateEndpointConnectionsResponse; -/** - * Contains response data for the list operation. - */ -export type OperationsListResponse = OperationListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationListResult; - }; -}; +/** Optional parameters. */ +export interface PrivateEndpointConnectionsGetOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listNext operation. - */ -export type OperationsListNextResponse = OperationListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationListResult; - }; -}; +/** Contains response data for the get operation. */ +export type PrivateEndpointConnectionsGetResponse = PrivateEndpointConnection; -/** - * Contains response data for the list operation. - */ -export type PrivateLinkResourcesListResponse = GroupIdInformationResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: GroupIdInformationResponse; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type PrivateLinkResourcesGetResponse = GroupIdInformation & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: GroupIdInformation; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type PrivateEndpointConnectionsListResponse = PrivateEndpointConnectionsResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PrivateEndpointConnectionsResponse; - }; -}; +/** Optional parameters. */ +export interface PrivateEndpointConnectionsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} -/** - * Contains response data for the get operation. - */ -export type PrivateEndpointConnectionsGetResponse = PrivateEndpointConnection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PrivateEndpointConnection; - }; -}; +/** Optional parameters. */ +export interface PrivateEndpointConnectionsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} -/** - * Contains response data for the createOrUpdate operation. - */ -export type PrivateEndpointConnectionsCreateOrUpdateResponse = PrivateEndpointConnection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PrivateEndpointConnection; - }; -}; +/** Contains response data for the createOrUpdate operation. */ +export type PrivateEndpointConnectionsCreateOrUpdateResponse = PrivateEndpointConnection; -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type PrivateEndpointConnectionsBeginCreateOrUpdateResponse = PrivateEndpointConnection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PrivateEndpointConnection; - }; -}; +/** Optional parameters. */ +export interface AzureDigitalTwinsManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/digitaltwins/arm-digitaltwins/src/models/mappers.ts b/sdk/digitaltwins/arm-digitaltwins/src/models/mappers.ts index fe0df279f389..b54dec313f00 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/models/mappers.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/models/mappers.ts @@ -6,39 +6,57 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; - -export const DigitalTwinsPatchProperties: msRest.CompositeMapper = { - serializedName: "DigitalTwinsPatchProperties", +export const PrivateEndpointConnection: coreClient.CompositeMapper = { type: { name: "Composite", - className: "DigitalTwinsPatchProperties", + className: "PrivateEndpointConnection", modelProperties: { - publicNetworkAccess: { - nullable: true, - serializedName: "publicNetworkAccess", + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + constraints: { + Pattern: new RegExp("^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$") + }, + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, type: { name: "String" } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "PrivateEndpointConnectionProperties" + } } } } }; -export const ConnectionProperties: msRest.CompositeMapper = { - serializedName: "ConnectionProperties", +export const ConnectionProperties: coreClient.CompositeMapper = { type: { name: "Composite", className: "ConnectionProperties", modelProperties: { provisioningState: { - nullable: true, - readOnly: true, serializedName: "provisioningState", + readOnly: true, + nullable: true, type: { name: "String" } @@ -72,110 +90,96 @@ export const ConnectionProperties: msRest.CompositeMapper = { } }; -export const PrivateEndpointConnectionProperties: msRest.CompositeMapper = { - serializedName: "PrivateEndpointConnection_properties", +export const PrivateEndpoint: coreClient.CompositeMapper = { type: { name: "Composite", - className: "PrivateEndpointConnectionProperties", + className: "PrivateEndpoint", modelProperties: { - ...ConnectionProperties.type.modelProperties + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + } } } }; -export const PrivateEndpointConnection: msRest.CompositeMapper = { - serializedName: "PrivateEndpointConnection", +export const ConnectionState: coreClient.CompositeMapper = { type: { name: "Composite", - className: "PrivateEndpointConnection", + className: "ConnectionState", modelProperties: { - id: { - readOnly: true, - serializedName: "id", + status: { + serializedName: "status", + required: true, type: { name: "String" } }, - name: { - readOnly: true, - serializedName: "name", - constraints: { - Pattern: /^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$/ - }, + description: { + serializedName: "description", + required: true, type: { name: "String" } }, - type: { - readOnly: true, - serializedName: "type", + actionsRequired: { + serializedName: "actionsRequired", type: { name: "String" } - }, - properties: { - required: true, - serializedName: "properties", - type: { - name: "Composite", - className: "PrivateEndpointConnectionProperties" - } } } } }; -export const DigitalTwinsResource: msRest.CompositeMapper = { - serializedName: "DigitalTwinsResource", +export const DigitalTwinsResource: coreClient.CompositeMapper = { type: { name: "Composite", className: "DigitalTwinsResource", modelProperties: { id: { - readOnly: true, serializedName: "id", + readOnly: true, type: { name: "String" } }, name: { - readOnly: true, - serializedName: "name", constraints: { - Pattern: /^(?!-)[A-Za-z0-9-]{3,63}(? +/** Class containing DigitalTwins operations. */ +export class DigitalTwinsImpl implements DigitalTwins { + private readonly client: AzureDigitalTwinsManagementClient; /** - * Create a DigitalTwins. - * @param {AzureDigitalTwinsManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class DigitalTwins class. + * @param client Reference to the service client */ - constructor(client: AzureDigitalTwinsManagementClientContext) { + constructor(client: AzureDigitalTwinsManagementClient) { this.client = client; } /** - * Get DigitalTwinsInstances resource. - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param [options] The optional parameters - * @returns Promise - */ - get(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param callback The callback - */ - get(resourceGroupName: string, resourceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param options The optional parameters - * @param callback The callback + * Get all the DigitalTwinsInstances in a subscription. + * @param options The options parameters. */ - get(resourceGroupName: string, resourceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - resourceName, - options + public list( + options?: DigitalTwinsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; }, - getOperationSpec, - callback) as Promise; + byPage: () => { + return this.listPagingPage(options); + } + }; } - /** - * Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property - * is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the - * modified values in a new body to update the DigitalTwinsInstance. - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param digitalTwinsCreate The DigitalTwinsInstance and security metadata. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdate(resourceGroupName: string, resourceName: string, digitalTwinsCreate: Models.DigitalTwinsDescription, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreateOrUpdate(resourceGroupName,resourceName,digitalTwinsCreate,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + private async *listPagingPage( + options?: DigitalTwinsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } } - /** - * Update metadata of DigitalTwinsInstance. - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param digitalTwinsPatchDescription The DigitalTwinsInstance and security metadata. - * @param [options] The optional parameters - * @returns Promise - */ - update(resourceGroupName: string, resourceName: string, digitalTwinsPatchDescription: Models.DigitalTwinsPatchDescription, options?: msRest.RequestOptionsBase): Promise { - return this.beginUpdate(resourceGroupName,resourceName,digitalTwinsPatchDescription,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + private async *listPagingAll( + options?: DigitalTwinsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** - * Delete a DigitalTwinsInstance. + * Get all the DigitalTwinsInstances in a resource group. * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,resourceName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + public listByResourceGroup( + resourceGroupName: string, + options?: DigitalTwinsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; } - /** - * Get all the DigitalTwinsInstances in a subscription. - * @param [options] The optional parameters - * @returns Promise - */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: DigitalTwinsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, options - }, - listOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: DigitalTwinsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } } /** - * Get all the DigitalTwinsInstances in a resource group. - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param [options] The optional parameters - * @returns Promise - */ - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param callback The callback - */ - listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; - /** + * Get DigitalTwinsInstances resource. * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param options The optional parameters - * @param callback The callback + * @param resourceName The name of the DigitalTwinsInstance. + * @param options The options parameters. */ - listByResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + resourceName: string, + options?: DigitalTwinsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - options - }, - listByResourceGroupOperationSpec, - callback) as Promise; + { resourceGroupName, resourceName, options }, + getOperationSpec + ); } /** - * Check if a DigitalTwinsInstance name is available. - * @param location Location of DigitalTwinsInstance. - * @param name Resource name. - * @param [options] The optional parameters - * @returns Promise - */ - checkNameAvailability(location: string, name: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param location Location of DigitalTwinsInstance. - * @param name Resource name. - * @param callback The callback - */ - checkNameAvailability(location: string, name: string, callback: msRest.ServiceCallback): void; - /** - * @param location Location of DigitalTwinsInstance. - * @param name Resource name. - * @param options The optional parameters - * @param callback The callback + * Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is + * to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified + * values in a new body to update the DigitalTwinsInstance. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param digitalTwinsCreate The DigitalTwinsInstance and security metadata. + * @param options The options parameters. */ - checkNameAvailability(location: string, name: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - checkNameAvailability(location: string, name: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - location, - name, - options - }, - checkNameAvailabilityOperationSpec, - callback) as Promise; + async beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + digitalTwinsCreate: DigitalTwinsDescription, + options?: DigitalTwinsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DigitalTwinsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, resourceName, digitalTwinsCreate, options }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property - * is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the - * modified values in a new body to update the DigitalTwinsInstance. + * Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is + * to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified + * values in a new body to update the DigitalTwinsInstance. * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. * @param digitalTwinsCreate The DigitalTwinsInstance and security metadata. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginCreateOrUpdate(resourceGroupName: string, resourceName: string, digitalTwinsCreate: Models.DigitalTwinsDescription, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - resourceName, - digitalTwinsCreate, - options - }, - beginCreateOrUpdateOperationSpec, - options); + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + digitalTwinsCreate: DigitalTwinsDescription, + options?: DigitalTwinsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + resourceName, + digitalTwinsCreate, + options + ); + return poller.pollUntilDone(); } /** @@ -209,112 +262,263 @@ export class DigitalTwins { * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. * @param digitalTwinsPatchDescription The DigitalTwinsInstance and security metadata. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginUpdate(resourceGroupName: string, resourceName: string, digitalTwinsPatchDescription: Models.DigitalTwinsPatchDescription, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( + async beginUpdate( + resourceGroupName: string, + resourceName: string, + digitalTwinsPatchDescription: DigitalTwinsPatchDescription, + options?: DigitalTwinsUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DigitalTwinsUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, { resourceGroupName, resourceName, digitalTwinsPatchDescription, options }, - beginUpdateOperationSpec, - options); + updateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Update metadata of DigitalTwinsInstance. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param digitalTwinsPatchDescription The DigitalTwinsInstance and security metadata. + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + resourceName: string, + digitalTwinsPatchDescription: DigitalTwinsPatchDescription, + options?: DigitalTwinsUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + resourceName, + digitalTwinsPatchDescription, + options + ); + return poller.pollUntilDone(); } /** * Delete a DigitalTwinsInstance. * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginDeleteMethod(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - resourceName, - options - }, - beginDeleteMethodOperationSpec, - options); + async beginDelete( + resourceGroupName: string, + resourceName: string, + options?: DigitalTwinsDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DigitalTwinsDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, resourceName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * Get all the DigitalTwinsInstances in a subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * Delete a DigitalTwinsInstance. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param options The options parameters. */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + async beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + options?: DigitalTwinsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + resourceName, + options + ); + return poller.pollUntilDone(); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * Get all the DigitalTwinsInstances in a subscription. + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + private _list( + options?: DigitalTwinsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * Get all the DigitalTwinsInstances in a resource group. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listByResourceGroup( + resourceGroupName: string, + options?: DigitalTwinsListByResourceGroupOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); } /** - * Get all the DigitalTwinsInstances in a resource group. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * Check if a DigitalTwinsInstance name is available. + * @param location Location of DigitalTwinsInstance. + * @param digitalTwinsInstanceCheckName Set the name parameter in the DigitalTwinsInstanceCheckName + * structure to the name of the DigitalTwinsInstance to check. + * @param options The options parameters. */ - listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + checkNameAvailability( + location: string, + digitalTwinsInstanceCheckName: CheckNameRequest, + options?: DigitalTwinsCheckNameAvailabilityOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { location, digitalTwinsInstanceCheckName, options }, + checkNameAvailabilityOperationSpec + ); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listByResourceGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + private _listNext( + nextLink: string, + options?: DigitalTwinsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. */ - listByResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: DigitalTwinsListByResourceGroupNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByResourceGroupNextOperationSpec, - callback) as Promise; + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.DigitalTwinsDescription @@ -323,110 +527,86 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/digitalTwinsInstances", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName ], - responses: { - 200: { - bodyMapper: Mappers.DigitalTwinsDescriptionListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, + headerParameters: [Parameters.accept], serializer }; - -const listByResourceGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", + httpMethod: "PUT", responses: { 200: { - bodyMapper: Mappers.DigitalTwinsDescriptionListResult + bodyMapper: Mappers.DigitalTwinsDescription + }, + 201: { + bodyMapper: Mappers.DigitalTwinsDescription + }, + 202: { + bodyMapper: Mappers.DigitalTwinsDescription + }, + 204: { + bodyMapper: Mappers.DigitalTwinsDescription }, default: { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const checkNameAvailabilityOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/locations/{location}/checkNameAvailability", + requestBody: Parameters.digitalTwinsCreate, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, - Parameters.location - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.resourceGroupName, + Parameters.resourceName ], - requestBody: { - parameterPath: { - name: "name" - }, - mapper: { - ...Mappers.CheckNameRequest, - required: true - } - }, + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", + httpMethod: "PATCH", responses: { 200: { - bodyMapper: Mappers.CheckNameResult + bodyMapper: Mappers.DigitalTwinsDescription + }, + 201: { + bodyMapper: Mappers.DigitalTwinsDescription + }, + 202: { + bodyMapper: Mappers.DigitalTwinsDescription + }, + 204: { + bodyMapper: Mappers.DigitalTwinsDescription }, default: { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", + requestBody: Parameters.digitalTwinsPatchDescription, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "digitalTwinsCreate", - mapper: { - ...Mappers.DigitalTwinsDescription, - required: true - } - }, + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", + httpMethod: "DELETE", responses: { 200: { bodyMapper: Mappers.DigitalTwinsDescription @@ -434,90 +614,90 @@ const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { 201: { bodyMapper: Mappers.DigitalTwinsDescription }, + 202: { + bodyMapper: Mappers.DigitalTwinsDescription + }, + 204: { + bodyMapper: Mappers.DigitalTwinsDescription + }, default: { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const beginUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "digitalTwinsPatchDescription", - mapper: { - ...Mappers.DigitalTwinsPatchDescription, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/digitalTwinsInstances", + httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.DigitalTwinsDescription - }, - 202: { - bodyMapper: Mappers.DigitalTwinsDescription + bodyMapper: Mappers.DigitalTwinsDescriptionListResult }, default: { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DigitalTwinsDescriptionListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.resourceGroupName ], + headerParameters: [Parameters.accept], + serializer +}; +const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/locations/{location}/checkNameAvailability", + httpMethod: "POST", responses: { 200: { - bodyMapper: Mappers.DigitalTwinsDescription - }, - 202: { - bodyMapper: Mappers.DigitalTwinsDescription + bodyMapper: Mappers.CheckNameResult }, - 204: {}, default: { bodyMapper: Mappers.ErrorResponse } }, + requestBody: Parameters.digitalTwinsInstanceCheckName, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.location + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DigitalTwinsDescriptionListResult @@ -526,22 +706,18 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DigitalTwinsDescriptionListResult @@ -550,5 +726,13 @@ const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operations/digitalTwinsEndpoint.ts b/sdk/digitaltwins/arm-digitaltwins/src/operations/digitalTwinsEndpoint.ts index fd2df72a76a3..81aadd6f7a4f 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/operations/digitalTwinsEndpoint.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/operations/digitalTwinsEndpoint.ts @@ -3,26 +3,41 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/digitalTwinsEndpointMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { DigitalTwinsEndpoint } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureDigitalTwinsManagementClientContext } from "../azureDigitalTwinsManagementClientContext"; +import { AzureDigitalTwinsManagementClient } from "../azureDigitalTwinsManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + DigitalTwinsEndpointResource, + DigitalTwinsEndpointListNextOptionalParams, + DigitalTwinsEndpointListOptionalParams, + DigitalTwinsEndpointListResponse, + DigitalTwinsEndpointGetOptionalParams, + DigitalTwinsEndpointGetResponse, + DigitalTwinsEndpointCreateOrUpdateOptionalParams, + DigitalTwinsEndpointCreateOrUpdateResponse, + DigitalTwinsEndpointDeleteOptionalParams, + DigitalTwinsEndpointDeleteResponse, + DigitalTwinsEndpointListNextResponse +} from "../models"; -/** Class representing a DigitalTwinsEndpoint. */ -export class DigitalTwinsEndpoint { - private readonly client: AzureDigitalTwinsManagementClientContext; +/// +/** Class containing DigitalTwinsEndpoint operations. */ +export class DigitalTwinsEndpointImpl implements DigitalTwinsEndpoint { + private readonly client: AzureDigitalTwinsManagementClient; /** - * Create a DigitalTwinsEndpoint. - * @param {AzureDigitalTwinsManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class DigitalTwinsEndpoint class. + * @param client Reference to the service client */ - constructor(client: AzureDigitalTwinsManagementClientContext) { + constructor(client: AzureDigitalTwinsManagementClient) { this.client = client; } @@ -30,68 +45,171 @@ export class DigitalTwinsEndpoint { * Get DigitalTwinsInstance Endpoints. * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param callback The callback - */ - list(resourceGroupName: string, resourceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param options The optional parameters - * @param callback The callback - */ - list(resourceGroupName: string, resourceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + public list( + resourceGroupName: string, + resourceName: string, + options?: DigitalTwinsEndpointListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, resourceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(resourceGroupName, resourceName, options); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + resourceName: string, + options?: DigitalTwinsEndpointListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(resourceGroupName, resourceName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( resourceGroupName, resourceName, + continuationToken, options - }, - listOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + resourceGroupName: string, + resourceName: string, + options?: DigitalTwinsEndpointListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + resourceName, + options + )) { + yield* page; + } } /** - * Get DigitalTwinsInstances Endpoint. + * Get DigitalTwinsInstance Endpoints. * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. - * @param endpointName Name of Endpoint Resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, resourceName: string, endpointName: string, options?: msRest.RequestOptionsBase): Promise; + private _list( + resourceGroupName: string, + resourceName: string, + options?: DigitalTwinsEndpointListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + listOperationSpec + ); + } + /** + * Get DigitalTwinsInstances Endpoint. * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. * @param endpointName Name of Endpoint Resource. - * @param callback The callback + * @param options The options parameters. */ - get(resourceGroupName: string, resourceName: string, endpointName: string, callback: msRest.ServiceCallback): void; + get( + resourceGroupName: string, + resourceName: string, + endpointName: string, + options?: DigitalTwinsEndpointGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, endpointName, options }, + getOperationSpec + ); + } + /** + * Create or update DigitalTwinsInstance endpoint. * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. * @param endpointName Name of Endpoint Resource. - * @param options The optional parameters - * @param callback The callback + * @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata. + * @param options The options parameters. */ - get(resourceGroupName: string, resourceName: string, endpointName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, resourceName: string, endpointName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( + async beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + endpointName: string, + endpointDescription: DigitalTwinsEndpointResource, + options?: DigitalTwinsEndpointCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DigitalTwinsEndpointCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, { resourceGroupName, resourceName, endpointName, + endpointDescription, options }, - getOperationSpec, - callback) as Promise; + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** @@ -99,13 +217,24 @@ export class DigitalTwinsEndpoint { * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. * @param endpointName Name of Endpoint Resource. - * @param properties DigitalTwinsInstance endpoint resource properties. - * @param [options] The optional parameters - * @returns Promise + * @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata. + * @param options The options parameters. */ - createOrUpdate(resourceGroupName: string, resourceName: string, endpointName: string, properties: Models.DigitalTwinsEndpointResourcePropertiesUnion, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreateOrUpdate(resourceGroupName,resourceName,endpointName,properties,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + endpointName: string, + endpointDescription: DigitalTwinsEndpointResource, + options?: DigitalTwinsEndpointCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + resourceName, + endpointName, + endpointDescription, + options + ); + return poller.pollUntilDone(); } /** @@ -113,34 +242,67 @@ export class DigitalTwinsEndpoint { * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. * @param endpointName Name of Endpoint Resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, resourceName: string, endpointName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,resourceName,endpointName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } + async beginDelete( + resourceGroupName: string, + resourceName: string, + endpointName: string, + options?: DigitalTwinsEndpointDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DigitalTwinsEndpointDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; - /** - * Create or update DigitalTwinsInstance endpoint. - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param endpointName Name of Endpoint Resource. - * @param properties DigitalTwinsInstance endpoint resource properties. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateOrUpdate(resourceGroupName: string, resourceName: string, endpointName: string, properties: Models.DigitalTwinsEndpointResourcePropertiesUnion, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - resourceName, - endpointName, - properties, - options - }, - beginCreateOrUpdateOperationSpec, - options); + const lro = new LroImpl( + sendOperation, + { resourceGroupName, resourceName, endpointName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** @@ -148,66 +310,49 @@ export class DigitalTwinsEndpoint { * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. * @param endpointName Name of Endpoint Resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginDeleteMethod(resourceGroupName: string, resourceName: string, endpointName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - resourceName, - endpointName, - options - }, - beginDeleteMethodOperationSpec, - options); + async beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + endpointName: string, + options?: DigitalTwinsEndpointDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + resourceName, + endpointName, + options + ); + return poller.pollUntilDone(); } /** - * Get DigitalTwinsInstance Endpoints. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListNext + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + resourceGroupName: string, + resourceName: string, + nextLink: string, + options?: DigitalTwinsEndpointListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { resourceGroupName, resourceName, nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.DigitalTwinsEndpointResourceListResult @@ -216,24 +361,20 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.endpointName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.resourceName ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DigitalTwinsEndpointResource @@ -242,33 +383,21 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName, Parameters.endpointName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: { - properties: "properties" - }, - mapper: { - ...Mappers.DigitalTwinsEndpointResource, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}", + httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.DigitalTwinsEndpointResource @@ -276,56 +405,64 @@ const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { 201: { bodyMapper: Mappers.DigitalTwinsEndpointResource }, + 202: { + bodyMapper: Mappers.DigitalTwinsEndpointResource + }, + 204: { + bodyMapper: Mappers.DigitalTwinsEndpointResource + }, default: { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}", + requestBody: Parameters.endpointDescription, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName, Parameters.endpointName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}", + httpMethod: "DELETE", responses: { 200: { bodyMapper: Mappers.DigitalTwinsEndpointResource }, + 201: { + bodyMapper: Mappers.DigitalTwinsEndpointResource + }, 202: { bodyMapper: Mappers.DigitalTwinsEndpointResource }, - 204: {}, + 204: { + bodyMapper: Mappers.DigitalTwinsEndpointResource + }, default: { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.endpointName + ], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.DigitalTwinsEndpointResourceListResult @@ -334,5 +471,14 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operations/index.ts b/sdk/digitaltwins/arm-digitaltwins/src/operations/index.ts index 7c807db2a533..05c151b730f3 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/operations/index.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/operations/index.ts @@ -3,8 +3,7 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export * from "./digitalTwins"; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operations/operations.ts b/sdk/digitaltwins/arm-digitaltwins/src/operations/operations.ts index afaaeb9cd0dc..42184b288775 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/operations/operations.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/operations/operations.ts @@ -3,92 +3,109 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/operationsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureDigitalTwinsManagementClientContext } from "../azureDigitalTwinsManagementClientContext"; +import { AzureDigitalTwinsManagementClient } from "../azureDigitalTwinsManagementClient"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; -/** Class representing a Operations. */ -export class Operations { - private readonly client: AzureDigitalTwinsManagementClientContext; +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: AzureDigitalTwinsManagementClient; /** - * Create a Operations. - * @param {AzureDigitalTwinsManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client */ - constructor(client: AzureDigitalTwinsManagementClientContext) { + constructor(client: AzureDigitalTwinsManagementClient) { this.client = client; } /** * Lists all of the available DigitalTwins service REST API operations. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; }, - listOperationSpec, - callback) as Promise; + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** * Lists all of the available DigitalTwins service REST API operations. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.DigitalTwins/operations", httpMethod: "GET", - path: "providers/Microsoft.DigitalTwins/operations", - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.OperationListResult @@ -97,22 +114,14 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.OperationListResult @@ -121,5 +130,8 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operations/privateEndpointConnections.ts b/sdk/digitaltwins/arm-digitaltwins/src/operations/privateEndpointConnections.ts index ced8e2a4429e..5fdbf2241549 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/operations/privateEndpointConnections.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/operations/privateEndpointConnections.ts @@ -3,26 +3,37 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/privateEndpointConnectionsMappers"; +import { PrivateEndpointConnections } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureDigitalTwinsManagementClientContext } from "../azureDigitalTwinsManagementClientContext"; +import { AzureDigitalTwinsManagementClient } from "../azureDigitalTwinsManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + PrivateEndpointConnectionsListOptionalParams, + PrivateEndpointConnectionsListResponse, + PrivateEndpointConnectionsGetOptionalParams, + PrivateEndpointConnectionsGetResponse, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnection, + PrivateEndpointConnectionsCreateOrUpdateOptionalParams, + PrivateEndpointConnectionsCreateOrUpdateResponse +} from "../models"; -/** Class representing a PrivateEndpointConnections. */ -export class PrivateEndpointConnections { - private readonly client: AzureDigitalTwinsManagementClientContext; +/** Class containing PrivateEndpointConnections operations. */ +export class PrivateEndpointConnectionsImpl + implements PrivateEndpointConnections { + private readonly client: AzureDigitalTwinsManagementClient; /** - * Create a PrivateEndpointConnections. - * @param {AzureDigitalTwinsManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class PrivateEndpointConnections class. + * @param client Reference to the service client */ - constructor(client: AzureDigitalTwinsManagementClientContext) { + constructor(client: AzureDigitalTwinsManagementClient) { this.client = client; } @@ -30,68 +41,109 @@ export class PrivateEndpointConnections { * List private endpoint connection properties. * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param callback The callback - */ - list(resourceGroupName: string, resourceName: string, callback: msRest.ServiceCallback): void; + list( + resourceGroupName: string, + resourceName: string, + options?: PrivateEndpointConnectionsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + listOperationSpec + ); + } + /** + * Get private endpoint connection properties for the given private endpoint. * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. - * @param options The optional parameters - * @param callback The callback + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param options The options parameters. */ - list(resourceGroupName: string, resourceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, resourceName, + privateEndpointConnectionName, options }, - listOperationSpec, - callback) as Promise; + getOperationSpec + ); } /** - * Get private endpoint connection properties for the given private endpoint. - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param [options] The optional parameters - * @returns Promise - */ - get(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param callback The callback - */ - get(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, callback: msRest.ServiceCallback): void; - /** + * Delete private endpoint connection with the specified name. * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - get(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( + async beginDelete( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, { resourceGroupName, resourceName, privateEndpointConnectionName, options }, - getOperationSpec, - callback) as Promise; + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** @@ -99,12 +151,21 @@ export class PrivateEndpointConnections { * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,resourceName,privateEndpointConnectionName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); + async beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + resourceName, + privateEndpointConnectionName, + options + ); + return poller.pollUntilDone(); } /** @@ -112,33 +173,75 @@ export class PrivateEndpointConnections { * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param properties - * @param [options] The optional parameters - * @returns Promise + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param options The options parameters. */ - createOrUpdate(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, properties: Models.PrivateEndpointConnectionProperties, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreateOrUpdate(resourceGroupName,resourceName,privateEndpointConnectionName,properties,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } + async beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + PrivateEndpointConnectionsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; - /** - * Delete private endpoint connection with the specified name. - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param [options] The optional parameters - * @returns Promise - */ - beginDeleteMethod(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( + const lro = new LroImpl( + sendOperation, { resourceGroupName, resourceName, privateEndpointConnectionName, + privateEndpointConnection, options }, - beginDeleteMethodOperationSpec, - options); + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** @@ -146,40 +249,33 @@ export class PrivateEndpointConnections { * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param properties - * @param [options] The optional parameters - * @returns Promise + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param options The options parameters. */ - beginCreateOrUpdate(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, properties: Models.PrivateEndpointConnectionProperties, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - resourceName, - privateEndpointConnectionName, - properties, - options - }, - beginCreateOrUpdateOperationSpec, - options); + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection, + options + ); + return poller.pollUntilDone(); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.PrivateEndpointConnectionsResponse @@ -188,24 +284,20 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.privateEndpointConnectionName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.resourceName ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PrivateEndpointConnection @@ -214,69 +306,72 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName, Parameters.privateEndpointConnectionName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + httpMethod: "DELETE", responses: { 200: {}, + 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName, Parameters.privateEndpointConnectionName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: { - properties: "properties" - }, - mapper: { - ...Mappers.PrivateEndpointConnection, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.PrivateEndpointConnection }, + 201: { + bodyMapper: Mappers.PrivateEndpointConnection + }, 202: { bodyMapper: Mappers.PrivateEndpointConnection }, + 204: { + bodyMapper: Mappers.PrivateEndpointConnection + }, default: { bodyMapper: Mappers.ErrorResponse } }, + requestBody: Parameters.privateEndpointConnection, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.privateEndpointConnectionName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operations/privateLinkResources.ts b/sdk/digitaltwins/arm-digitaltwins/src/operations/privateLinkResources.ts index dcf85693728c..26b6b93f9b2f 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/operations/privateLinkResources.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/operations/privateLinkResources.ts @@ -3,25 +3,30 @@ * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/privateLinkResourcesMappers"; +import { PrivateLinkResources } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureDigitalTwinsManagementClientContext } from "../azureDigitalTwinsManagementClientContext"; +import { AzureDigitalTwinsManagementClient } from "../azureDigitalTwinsManagementClient"; +import { + PrivateLinkResourcesListOptionalParams, + PrivateLinkResourcesListResponse, + PrivateLinkResourcesGetOptionalParams, + PrivateLinkResourcesGetResponse +} from "../models"; -/** Class representing a PrivateLinkResources. */ -export class PrivateLinkResources { - private readonly client: AzureDigitalTwinsManagementClientContext; +/** Class containing PrivateLinkResources operations. */ +export class PrivateLinkResourcesImpl implements PrivateLinkResources { + private readonly client: AzureDigitalTwinsManagementClient; /** - * Create a PrivateLinkResources. - * @param {AzureDigitalTwinsManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class PrivateLinkResources class. + * @param client Reference to the service client */ - constructor(client: AzureDigitalTwinsManagementClientContext) { + constructor(client: AzureDigitalTwinsManagementClient) { this.client = client; } @@ -29,32 +34,17 @@ export class PrivateLinkResources { * List private link resources for given Digital Twin. * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param callback The callback - */ - list(resourceGroupName: string, resourceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param options The optional parameters - * @param callback The callback - */ - list(resourceGroupName: string, resourceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + list( + resourceGroupName: string, + resourceName: string, + options?: PrivateLinkResourcesListOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - resourceName, - options - }, - listOperationSpec, - callback) as Promise; + { resourceGroupName, resourceName, options }, + listOperationSpec + ); } /** @@ -62,54 +52,27 @@ export class PrivateLinkResources { * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. * @param resourceName The name of the DigitalTwinsInstance. * @param resourceId The name of the private link resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, resourceName: string, resourceId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param resourceId The name of the private link resource. - * @param callback The callback - */ - get(resourceGroupName: string, resourceName: string, resourceId: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. - * @param resourceName The name of the DigitalTwinsInstance. - * @param resourceId The name of the private link resource. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, resourceName: string, resourceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, resourceName: string, resourceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + resourceName: string, + resourceId: string, + options?: PrivateLinkResourcesGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - resourceName, - resourceId, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, resourceName, resourceId, options }, + getOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateLinkResources", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateLinkResources", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.GroupIdInformationResponse @@ -118,24 +81,20 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateLinkResources/{resourceId}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.resourceName, - Parameters.resourceId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.resourceName ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/privateLinkResources/{resourceId}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.GroupIdInformation @@ -144,5 +103,14 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.resourceId + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/digitalTwins.ts b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/digitalTwins.ts new file mode 100644 index 000000000000..f67a57b24048 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/digitalTwins.ts @@ -0,0 +1,164 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + DigitalTwinsDescription, + DigitalTwinsListOptionalParams, + DigitalTwinsListByResourceGroupOptionalParams, + DigitalTwinsGetOptionalParams, + DigitalTwinsGetResponse, + DigitalTwinsCreateOrUpdateOptionalParams, + DigitalTwinsCreateOrUpdateResponse, + DigitalTwinsPatchDescription, + DigitalTwinsUpdateOptionalParams, + DigitalTwinsUpdateResponse, + DigitalTwinsDeleteOptionalParams, + DigitalTwinsDeleteResponse, + CheckNameRequest, + DigitalTwinsCheckNameAvailabilityOptionalParams, + DigitalTwinsCheckNameAvailabilityResponse +} from "../models"; + +/// +/** Interface representing a DigitalTwins. */ +export interface DigitalTwins { + /** + * Get all the DigitalTwinsInstances in a subscription. + * @param options The options parameters. + */ + list( + options?: DigitalTwinsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get all the DigitalTwinsInstances in a resource group. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: DigitalTwinsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get DigitalTwinsInstances resource. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + options?: DigitalTwinsGetOptionalParams + ): Promise; + /** + * Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is + * to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified + * values in a new body to update the DigitalTwinsInstance. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param digitalTwinsCreate The DigitalTwinsInstance and security metadata. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + digitalTwinsCreate: DigitalTwinsDescription, + options?: DigitalTwinsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DigitalTwinsCreateOrUpdateResponse + > + >; + /** + * Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is + * to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified + * values in a new body to update the DigitalTwinsInstance. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param digitalTwinsCreate The DigitalTwinsInstance and security metadata. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + digitalTwinsCreate: DigitalTwinsDescription, + options?: DigitalTwinsCreateOrUpdateOptionalParams + ): Promise; + /** + * Update metadata of DigitalTwinsInstance. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param digitalTwinsPatchDescription The DigitalTwinsInstance and security metadata. + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + resourceName: string, + digitalTwinsPatchDescription: DigitalTwinsPatchDescription, + options?: DigitalTwinsUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DigitalTwinsUpdateResponse + > + >; + /** + * Update metadata of DigitalTwinsInstance. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param digitalTwinsPatchDescription The DigitalTwinsInstance and security metadata. + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + resourceName: string, + digitalTwinsPatchDescription: DigitalTwinsPatchDescription, + options?: DigitalTwinsUpdateOptionalParams + ): Promise; + /** + * Delete a DigitalTwinsInstance. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + resourceName: string, + options?: DigitalTwinsDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DigitalTwinsDeleteResponse + > + >; + /** + * Delete a DigitalTwinsInstance. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + options?: DigitalTwinsDeleteOptionalParams + ): Promise; + /** + * Check if a DigitalTwinsInstance name is available. + * @param location Location of DigitalTwinsInstance. + * @param digitalTwinsInstanceCheckName Set the name parameter in the DigitalTwinsInstanceCheckName + * structure to the name of the DigitalTwinsInstance to check. + * @param options The options parameters. + */ + checkNameAvailability( + location: string, + digitalTwinsInstanceCheckName: CheckNameRequest, + options?: DigitalTwinsCheckNameAvailabilityOptionalParams + ): Promise; +} diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/digitalTwinsEndpoint.ts b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/digitalTwinsEndpoint.ts new file mode 100644 index 000000000000..4c1e62e5397f --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/digitalTwinsEndpoint.ts @@ -0,0 +1,115 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + DigitalTwinsEndpointResource, + DigitalTwinsEndpointListOptionalParams, + DigitalTwinsEndpointGetOptionalParams, + DigitalTwinsEndpointGetResponse, + DigitalTwinsEndpointCreateOrUpdateOptionalParams, + DigitalTwinsEndpointCreateOrUpdateResponse, + DigitalTwinsEndpointDeleteOptionalParams, + DigitalTwinsEndpointDeleteResponse +} from "../models"; + +/// +/** Interface representing a DigitalTwinsEndpoint. */ +export interface DigitalTwinsEndpoint { + /** + * Get DigitalTwinsInstance Endpoints. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + resourceName: string, + options?: DigitalTwinsEndpointListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get DigitalTwinsInstances Endpoint. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param endpointName Name of Endpoint Resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + endpointName: string, + options?: DigitalTwinsEndpointGetOptionalParams + ): Promise; + /** + * Create or update DigitalTwinsInstance endpoint. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param endpointName Name of Endpoint Resource. + * @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + endpointName: string, + endpointDescription: DigitalTwinsEndpointResource, + options?: DigitalTwinsEndpointCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DigitalTwinsEndpointCreateOrUpdateResponse + > + >; + /** + * Create or update DigitalTwinsInstance endpoint. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param endpointName Name of Endpoint Resource. + * @param endpointDescription The DigitalTwinsInstance endpoint metadata and security metadata. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + endpointName: string, + endpointDescription: DigitalTwinsEndpointResource, + options?: DigitalTwinsEndpointCreateOrUpdateOptionalParams + ): Promise; + /** + * Delete a DigitalTwinsInstance endpoint. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param endpointName Name of Endpoint Resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + resourceName: string, + endpointName: string, + options?: DigitalTwinsEndpointDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DigitalTwinsEndpointDeleteResponse + > + >; + /** + * Delete a DigitalTwinsInstance endpoint. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param endpointName Name of Endpoint Resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + endpointName: string, + options?: DigitalTwinsEndpointDeleteOptionalParams + ): Promise; +} diff --git a/sdk/digitaltwins/arm-digitaltwins/src/models/operationsMappers.ts b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/index.ts similarity index 55% rename from sdk/digitaltwins/arm-digitaltwins/src/models/operationsMappers.ts rename to sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/index.ts index 7e9414298012..05c151b730f3 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/models/operationsMappers.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/index.ts @@ -6,11 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - discriminators, - ErrorDefinition, - ErrorResponse, - Operation, - OperationDisplay, - OperationListResult -} from "../models/mappers"; +export * from "./digitalTwins"; +export * from "./digitalTwinsEndpoint"; +export * from "./operations"; +export * from "./privateLinkResources"; +export * from "./privateEndpointConnections"; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/operations.ts b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..6c7496010bce --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * Lists all of the available DigitalTwins service REST API operations. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/privateEndpointConnections.ts b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/privateEndpointConnections.ts new file mode 100644 index 000000000000..911ef0d66ca0 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/privateEndpointConnections.ts @@ -0,0 +1,108 @@ +/* + * 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 { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + PrivateEndpointConnectionsListOptionalParams, + PrivateEndpointConnectionsListResponse, + PrivateEndpointConnectionsGetOptionalParams, + PrivateEndpointConnectionsGetResponse, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnection, + PrivateEndpointConnectionsCreateOrUpdateOptionalParams, + PrivateEndpointConnectionsCreateOrUpdateResponse +} from "../models"; + +/** Interface representing a PrivateEndpointConnections. */ +export interface PrivateEndpointConnections { + /** + * List private endpoint connection properties. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + resourceName: string, + options?: PrivateEndpointConnectionsListOptionalParams + ): Promise; + /** + * Get private endpoint connection properties for the given private endpoint. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetOptionalParams + ): Promise; + /** + * Delete private endpoint connection with the specified name. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams + ): Promise, void>>; + /** + * Delete private endpoint connection with the specified name. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams + ): Promise; + /** + * Update the status of a private endpoint connection with the given name. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + PrivateEndpointConnectionsCreateOrUpdateResponse + > + >; + /** + * Update the status of a private endpoint connection with the given name. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param privateEndpointConnection The private endpoint connection with updated properties. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsCreateOrUpdateOptionalParams + ): Promise; +} diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/privateLinkResources.ts b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/privateLinkResources.ts new file mode 100644 index 000000000000..af3cb5c98f15 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/privateLinkResources.ts @@ -0,0 +1,42 @@ +/* + * 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 { + PrivateLinkResourcesListOptionalParams, + PrivateLinkResourcesListResponse, + PrivateLinkResourcesGetOptionalParams, + PrivateLinkResourcesGetResponse +} from "../models"; + +/** Interface representing a PrivateLinkResources. */ +export interface PrivateLinkResources { + /** + * List private link resources for given Digital Twin. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + resourceName: string, + options?: PrivateLinkResourcesListOptionalParams + ): Promise; + /** + * Get the specified private link resource for the given Digital Twin. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param resourceId The name of the private link resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + resourceId: string, + options?: PrivateLinkResourcesGetOptionalParams + ): Promise; +} diff --git a/sdk/digitaltwins/arm-digitaltwins/test/sampleTest.ts b/sdk/digitaltwins/arm-digitaltwins/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/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/digitaltwins/arm-digitaltwins/tsconfig.json b/sdk/digitaltwins/arm-digitaltwins/tsconfig.json index 422b584abd5e..6e3251194117 100644 --- a/sdk/digitaltwins/arm-digitaltwins/tsconfig.json +++ b/sdk/digitaltwins/arm-digitaltwins/tsconfig.json @@ -3,7 +3,7 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, @@ -11,9 +11,9 @@ "forceConsistentCasingInFileNames": true, "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", + "outDir": "./dist-esm", "importHelpers": true }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts"], "exclude": ["node_modules"] } diff --git a/sdk/digitaltwins/ci.yml b/sdk/digitaltwins/ci.yml index f086a8135b3f..2a8c5a8a1b48 100644 --- a/sdk/digitaltwins/ci.yml +++ b/sdk/digitaltwins/ci.yml @@ -1,5 +1,3 @@ -# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - trigger: branches: include: @@ -9,7 +7,6 @@ trigger: paths: include: - sdk/digitaltwins/ - pr: branches: include: @@ -17,10 +14,11 @@ pr: - feature/* - release/* - hotfix/* + exclude: + - feature/v4 paths: include: - sdk/digitaltwins/ - extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: @@ -28,3 +26,5 @@ extends: Artifacts: - name: azure-digital-twins-core safeName: azuredigitaltwinscore + - name: azure-arm-digitaltwins + safeName: azurearmdigitaltwins