From 299d14de3039277dd3020c98618e08226d8418d9 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 5 Jan 2022 08:20:52 +0000 Subject: [PATCH] CodeGen from PR 16925 in Azure/azure-rest-api-specs Track2 modify readme.go.md 5 (#16925) --- common/config/rush/pnpm-lock.yaml | 131 +- rush.json | 5 + sdk/iotcentral/arm-iotcentral/CHANGELOG.md | 11 + .../arm-iotcentral/{LICENSE.txt => LICENSE} | 4 +- sdk/iotcentral/arm-iotcentral/README.md | 142 +- sdk/iotcentral/arm-iotcentral/_meta.json | 7 + .../arm-iotcentral/api-extractor.json | 18 + sdk/iotcentral/arm-iotcentral/package.json | 94 +- .../review/arm-iotcentral.api.md | 323 +++++ .../arm-iotcentral/rollup.config.js | 211 ++- .../src/{models/appsMappers.ts => index.ts} | 18 +- .../arm-iotcentral/src/iotCentralClient.ts | 90 +- .../src/iotCentralClientContext.ts | 61 - sdk/iotcentral/arm-iotcentral/src/lroImpl.ts | 34 + .../arm-iotcentral/src/models/index.ts | 777 +++++------ .../arm-iotcentral/src/models/mappers.ts | 450 ++++--- .../arm-iotcentral/src/models/parameters.ts | 98 +- .../arm-iotcentral/src/operations/apps.ts | 1183 +++++++++-------- .../arm-iotcentral/src/operations/index.ts | 3 +- .../src/operations/operations.ts | 162 +-- .../src/operationsInterfaces/apps.ts | 174 +++ .../index.ts} | 8 +- .../src/operationsInterfaces/operations.ts | 22 + .../arm-iotcentral/test/sampleTest.ts | 48 + sdk/iotcentral/arm-iotcentral/tsconfig.json | 6 +- sdk/iotcentral/ci.yml | 29 + 26 files changed, 2531 insertions(+), 1578 deletions(-) create mode 100644 sdk/iotcentral/arm-iotcentral/CHANGELOG.md rename sdk/iotcentral/arm-iotcentral/{LICENSE.txt => LICENSE} (96%) create mode 100644 sdk/iotcentral/arm-iotcentral/_meta.json create mode 100644 sdk/iotcentral/arm-iotcentral/api-extractor.json create mode 100644 sdk/iotcentral/arm-iotcentral/review/arm-iotcentral.api.md rename sdk/iotcentral/arm-iotcentral/src/{models/appsMappers.ts => index.ts} (50%) delete mode 100644 sdk/iotcentral/arm-iotcentral/src/iotCentralClientContext.ts create mode 100644 sdk/iotcentral/arm-iotcentral/src/lroImpl.ts create mode 100644 sdk/iotcentral/arm-iotcentral/src/operationsInterfaces/apps.ts rename sdk/iotcentral/arm-iotcentral/src/{models/operationsMappers.ts => operationsInterfaces/index.ts} (68%) create mode 100644 sdk/iotcentral/arm-iotcentral/src/operationsInterfaces/operations.ts create mode 100644 sdk/iotcentral/arm-iotcentral/test/sampleTest.ts create mode 100644 sdk/iotcentral/ci.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 694e81b4a476..7c56cf3682ae 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -39,6 +39,7 @@ specifiers: '@rush-temp/arm-extendedlocation': file:./projects/arm-extendedlocation.tgz '@rush-temp/arm-features': file:./projects/arm-features.tgz '@rush-temp/arm-hdinsight': file:./projects/arm-hdinsight.tgz + '@rush-temp/arm-iotcentral': file:./projects/arm-iotcentral.tgz '@rush-temp/arm-iothub': file:./projects/arm-iothub.tgz '@rush-temp/arm-keyvault': file:./projects/arm-keyvault.tgz '@rush-temp/arm-links': file:./projects/arm-links.tgz @@ -220,6 +221,7 @@ dependencies: '@rush-temp/arm-extendedlocation': file:projects/arm-extendedlocation.tgz '@rush-temp/arm-features': file:projects/arm-features.tgz '@rush-temp/arm-hdinsight': file:projects/arm-hdinsight.tgz + '@rush-temp/arm-iotcentral': file:projects/arm-iotcentral.tgz '@rush-temp/arm-iothub': file:projects/arm-iothub.tgz '@rush-temp/arm-keyvault': file:projects/arm-keyvault.tgz '@rush-temp/arm-links': file:projects/arm-links.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 @@ -8604,6 +8606,27 @@ packages: uglify-js: 3.14.5 dev: false + file:projects/arm-iotcentral.tgz: + resolution: {integrity: sha512-0gjAsJWc8Vw+g8icwLfr9LF6uWh/8/B6a+K1/lp7KMu7pVd5ml8vmLH6VBL4cwnO69kUxwRV6J5EdvBOOhip/g==, tarball: file:projects/arm-iotcentral.tgz} + name: '@rush-temp/arm-iotcentral' + 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-iothub.tgz: resolution: {integrity: sha512-PzFOxAYNZCA5fFinZSNlhYM6Z5GYX/yJkJAKycsLISLkEDrj70v3ihSJqSoyI3o9y0oxM1GqeijIgfPgvj4zWg==, tarball: file:projects/arm-iothub.tgz} name: '@rush-temp/arm-iothub' @@ -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..80e3574a38fe 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-iotcentral", + "projectFolder": "sdk/iotcentral/arm-iotcentral", + "versionPolicyName": "management" } ] } \ No newline at end of file diff --git a/sdk/iotcentral/arm-iotcentral/CHANGELOG.md b/sdk/iotcentral/arm-iotcentral/CHANGELOG.md new file mode 100644 index 000000000000..3e3e3b580c4e --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 6.0.0 (2022-01-05) + +The package of @azure/arm-iotcentral is using our next generation design principles since version 6.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/iotcentral/arm-iotcentral/LICENSE.txt b/sdk/iotcentral/arm-iotcentral/LICENSE similarity index 96% rename from sdk/iotcentral/arm-iotcentral/LICENSE.txt rename to sdk/iotcentral/arm-iotcentral/LICENSE index 2d3163745319..5d1d36e0af80 100644 --- a/sdk/iotcentral/arm-iotcentral/LICENSE.txt +++ b/sdk/iotcentral/arm-iotcentral/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2021 Microsoft +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 @@ -18,4 +18,4 @@ 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. +SOFTWARE. \ No newline at end of file diff --git a/sdk/iotcentral/arm-iotcentral/README.md b/sdk/iotcentral/arm-iotcentral/README.md index 0254dd60cb43..b623d65546e9 100644 --- a/sdk/iotcentral/arm-iotcentral/README.md +++ b/sdk/iotcentral/arm-iotcentral/README.md @@ -1,102 +1,98 @@ -## Azure IotCentralClient SDK for JavaScript +# Azure IotCentral client library for JavaScript -This package contains an isomorphic SDK for IotCentralClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure IotCentral client. + +Use this API to manage IoT Central Applications in your Azure subscription. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iotcentral/arm-iotcentral) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-iotcentral) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-iotcentral) | +[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 + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-iotcentral` package -### How to Install +Install the Azure IotCentral client library for JavaScript with `npm`: ```bash npm install @azure/arm-iotcentral ``` -### How to use +### Create and authenticate a `IotCentralClient` -#### nodejs - client creation and get apps as an example written in TypeScript. +To create a client object to access the Azure IotCentral API, you will need the `endpoint` of your Azure IotCentral resource and a `credential`. The Azure IotCentral client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure IotCentral resource in the [Azure Portal][azure_portal]. -##### Install @azure/ms-rest-nodeauth +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). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: -- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. ```bash -npm install @azure/ms-rest-nodeauth@"^3.0.0" +npm install @azure/identity ``` -##### Sample code +You will also need to **register a new AAD application and grant access to Azure IotCentral** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). -While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package -```typescript -const msRestNodeAuth = require("@azure/ms-rest-nodeauth"); +```javascript const { IotCentralClient } = require("@azure/arm-iotcentral"); -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new IotCentralClient(creds, subscriptionId); - const resourceGroupName = "testresourceGroupName"; - const resourceName = "testresourceName"; - client.apps.get(resourceGroupName, resourceName).then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new IotCentralClient(new DefaultAzureCredential(), subscriptionId); ``` -#### browser - Authentication, client creation and get apps as an example written in JavaScript. -##### Install @azure/ms-rest-browserauth +### 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). -```bash -npm install @azure/ms-rest-browserauth -``` +## Key concepts + +### IotCentralClient -##### Sample code - -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. - -- index.html -```html - - - - @azure/arm-iotcentral sample - - - - - - - - +`IotCentralClient` is the primary interface for developers using the Azure IotCentral client library. Explore the methods on this client object to understand the different features of the Azure IotCentral 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%2Fiotcentral%2Farm-iotcentral%2FREADME.png) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/iotcentral/arm-iotcentral/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/iotcentral/arm-iotcentral/_meta.json b/sdk/iotcentral/arm-iotcentral/_meta.json new file mode 100644 index 000000000000..ac15dcd0eb43 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "9f28b00aaee6d4360ac3dee7f9a10279f5d15568", + "readme": "specification/iotcentral/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/iotcentral/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/iotcentral/arm-iotcentral/api-extractor.json b/sdk/iotcentral/arm-iotcentral/api-extractor.json new file mode 100644 index 000000000000..00d44d1929c3 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/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-iotcentral.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/iotcentral/arm-iotcentral/package.json b/sdk/iotcentral/arm-iotcentral/package.json index 395353525347..0af8fb5bcd32 100644 --- a/sdk/iotcentral/arm-iotcentral/package.json +++ b/sdk/iotcentral/arm-iotcentral/package.json @@ -1,57 +1,91 @@ { "name": "@azure/arm-iotcentral", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "IotCentralClient Library with typescript type definitions for node.js and browser.", - "version": "4.1.0", + "description": "A generated SDK for IotCentralClient.", + "version": "6.0.0", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-azure-js": "^2.0.1", - "@azure/ms-rest-js": "^2.0.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-iotcentral.js", - "module": "./esm/iotCentralClient.js", - "types": "./esm/iotCentralClient.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-iotcentral.d.ts", "devDependencies": { - "typescript": "^3.5.3", - "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/iotcentral/arm-iotcentral", "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-iotcentral.js.map'\" -o ./dist/arm-iotcentral.min.js ./dist/arm-iotcentral.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/iotcentral/arm-iotcentral/review/arm-iotcentral.api.md b/sdk/iotcentral/arm-iotcentral/review/arm-iotcentral.api.md new file mode 100644 index 000000000000..0f392f6299b8 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/review/arm-iotcentral.api.md @@ -0,0 +1,323 @@ +## API Report File for "@azure/arm-iotcentral" + +> 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 App = Resource & { + sku: AppSkuInfo; + identity?: SystemAssignedServiceIdentity; + readonly applicationId?: string; + displayName?: string; + subdomain?: string; + template?: string; + readonly state?: AppState; +}; + +// @public +export interface AppAvailabilityInfo { + readonly message?: string; + readonly nameAvailable?: boolean; + readonly reason?: string; +} + +// @public +export interface AppListResult { + nextLink?: string; + value?: App[]; +} + +// @public +export interface AppPatch { + readonly applicationId?: string; + displayName?: string; + identity?: SystemAssignedServiceIdentity; + sku?: AppSkuInfo; + readonly state?: AppState; + subdomain?: string; + tags?: { + [propertyName: string]: string; + }; + template?: string; +} + +// @public +export interface Apps { + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, app: App, options?: AppsCreateOrUpdateOptionalParams): Promise, AppsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, resourceName: string, app: App, options?: AppsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, resourceName: string, options?: AppsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, resourceName: string, options?: AppsDeleteOptionalParams): Promise; + beginUpdate(resourceGroupName: string, resourceName: string, appPatch: AppPatch, options?: AppsUpdateOptionalParams): Promise, AppsUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, resourceName: string, appPatch: AppPatch, options?: AppsUpdateOptionalParams): Promise; + checkNameAvailability(operationInputs: OperationInputs, options?: AppsCheckNameAvailabilityOptionalParams): Promise; + checkSubdomainAvailability(operationInputs: OperationInputs, options?: AppsCheckSubdomainAvailabilityOptionalParams): Promise; + get(resourceGroupName: string, resourceName: string, options?: AppsGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: AppsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: AppsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + listTemplates(options?: AppsListTemplatesOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface AppsCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppsCheckNameAvailabilityResponse = AppAvailabilityInfo; + +// @public +export interface AppsCheckSubdomainAvailabilityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppsCheckSubdomainAvailabilityResponse = AppAvailabilityInfo; + +// @public +export interface AppsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type AppsCreateOrUpdateResponse = App; + +// @public +export interface AppsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface AppsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppsGetResponse = App; + +// @public +export type AppSku = string; + +// @public +export interface AppSkuInfo { + name: AppSku; +} + +// @public +export interface AppsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppsListByResourceGroupNextResponse = AppListResult; + +// @public +export interface AppsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppsListByResourceGroupResponse = AppListResult; + +// @public +export interface AppsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppsListBySubscriptionNextResponse = AppListResult; + +// @public +export interface AppsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppsListBySubscriptionResponse = AppListResult; + +// @public +export interface AppsListTemplatesNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppsListTemplatesNextResponse = AppTemplatesResult; + +// @public +export interface AppsListTemplatesOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AppsListTemplatesResponse = AppTemplatesResult; + +// @public +export type AppState = string; + +// @public +export interface AppsUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type AppsUpdateResponse = App; + +// @public +export interface AppTemplate { + readonly description?: string; + readonly industry?: string; + readonly locations?: AppTemplateLocations[]; + readonly manifestId?: string; + readonly manifestVersion?: string; + readonly name?: string; + readonly order?: number; + readonly title?: string; +} + +// @public +export interface AppTemplateLocations { + readonly displayName?: string; + readonly id?: string; +} + +// @public +export interface AppTemplatesResult { + nextLink?: string; + readonly value?: AppTemplate[]; +} + +// @public +export interface CloudError { + readonly code?: string; + details?: CloudErrorBody[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface CloudErrorBody { + readonly code?: string; + details?: CloudErrorBody[]; + readonly message?: string; + readonly target?: string; +} + +// @public (undocumented) +export class IotCentralClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: IotCentralClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + apps: Apps; + // (undocumented) + operations: Operations; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface IotCentralClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export enum KnownAppSku { + // (undocumented) + ST0 = "ST0", + // (undocumented) + ST1 = "ST1", + // (undocumented) + ST2 = "ST2" +} + +// @public +export enum KnownAppState { + // (undocumented) + Created = "created", + // (undocumented) + Suspended = "suspended" +} + +// @public +export enum KnownSystemAssignedServiceIdentityType { + // (undocumented) + None = "None", + // (undocumented) + SystemAssigned = "SystemAssigned" +} + +// @public +export interface Operation { + display?: OperationDisplay; + readonly name?: string; + readonly origin?: string; + readonly properties?: Record; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface OperationInputs { + name: string; + type?: 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 Resource { + readonly id?: string; + location: string; + readonly name?: string; + tags?: { + [propertyName: string]: string; + }; + readonly type?: string; +} + +// @public +export interface SystemAssignedServiceIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type: SystemAssignedServiceIdentityType; +} + +// @public +export type SystemAssignedServiceIdentityType = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/iotcentral/arm-iotcentral/rollup.config.js b/sdk/iotcentral/arm-iotcentral/rollup.config.js index 3793eb23d9a7..9be1955eb7f1 100644 --- a/sdk/iotcentral/arm-iotcentral/rollup.config.js +++ b/sdk/iotcentral/arm-iotcentral/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/iotCentralClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-iotcentral.js", - format: "umd", - name: "Azure.ArmIotcentral", - 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/iotcentral/arm-iotcentral/src/models/appsMappers.ts b/sdk/iotcentral/arm-iotcentral/src/index.ts similarity index 50% rename from sdk/iotcentral/arm-iotcentral/src/models/appsMappers.ts rename to sdk/iotcentral/arm-iotcentral/src/index.ts index f0a1b9f18c7e..4ad459473efe 100644 --- a/sdk/iotcentral/arm-iotcentral/src/models/appsMappers.ts +++ b/sdk/iotcentral/arm-iotcentral/src/index.ts @@ -6,17 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - App, - AppAvailabilityInfo, - AppListResult, - AppPatch, - AppSkuInfo, - AppTemplate, - AppTemplateLocations, - AppTemplatesResult, - BaseResource, - CloudError, - OperationInputs, - Resource -} from "../models/mappers"; +/// +export * from "./models"; +export { IotCentralClient } from "./iotCentralClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/iotcentral/arm-iotcentral/src/iotCentralClient.ts b/sdk/iotcentral/arm-iotcentral/src/iotCentralClient.ts index 71f83aaafdb6..6c8e073f7146 100644 --- a/sdk/iotcentral/arm-iotcentral/src/iotCentralClient.ts +++ b/sdk/iotcentral/arm-iotcentral/src/iotCentralClient.ts @@ -3,41 +3,75 @@ * 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/mappers"; -import * as operations from "./operations"; -import { IotCentralClientContext } from "./iotCentralClientContext"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { AppsImpl, OperationsImpl } from "./operations"; +import { Apps, Operations } from "./operationsInterfaces"; +import { IotCentralClientOptionalParams } from "./models"; - -class IotCentralClient extends IotCentralClientContext { - // Operation groups - apps: operations.Apps; - operations: operations.Operations; +export class IotCentralClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; /** * Initializes a new instance of the IotCentralClient class. - * @param credentials Credentials needed for the client to connect to Azure. + * @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, subscriptionId: string, options?: Models.IotCentralClientOptions) { - super(credentials, subscriptionId, options); - this.apps = new operations.Apps(this); - this.operations = new operations.Operations(this); - } -} + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: IotCentralClientOptionalParams + ) { + 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: IotCentralClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; -// Operation Specifications + const packageDetails = `azsdk-js-arm-iotcentral/6.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; -export { - IotCentralClient, - IotCentralClientContext, - Models as IotCentralModels, - Mappers as IotCentralMappers -}; -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 || "2021-06-01"; + this.apps = new AppsImpl(this); + this.operations = new OperationsImpl(this); + } + + apps: Apps; + operations: Operations; +} diff --git a/sdk/iotcentral/arm-iotcentral/src/iotCentralClientContext.ts b/sdk/iotcentral/arm-iotcentral/src/iotCentralClientContext.ts deleted file mode 100644 index f1963b771d2b..000000000000 --- a/sdk/iotcentral/arm-iotcentral/src/iotCentralClientContext.ts +++ /dev/null @@ -1,61 +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 * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-iotcentral"; -const packageVersion = "4.1.0"; - -export class IotCentralClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - subscriptionId: string; - apiVersion?: string; - - /** - * Initializes a new instance of the IotCentralClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId The subscription identifier. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.IotCentralClientOptions) { - 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 = '2018-09-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/iotcentral/arm-iotcentral/src/lroImpl.ts b/sdk/iotcentral/arm-iotcentral/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/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/iotcentral/arm-iotcentral/src/models/index.ts b/sdk/iotcentral/arm-iotcentral/src/models/index.ts index 444beeb733b4..5c68d5509be7 100644 --- a/sdk/iotcentral/arm-iotcentral/src/models/index.ts +++ b/sdk/iotcentral/arm-iotcentral/src/models/index.ts @@ -6,634 +6,469 @@ * 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 }; - -/** - * Information about the SKU of the IoT Central application. - */ +/** Information about the SKU of the IoT Central application. */ export interface AppSkuInfo { + /** The name of the SKU. */ + name: AppSku; +} + +/** Managed service identity (either system assigned, or none) */ +export interface SystemAssignedServiceIdentity { /** - * The name of the SKU. Possible values include: 'F1', 'S1', 'ST0', 'ST1', 'ST2' + * The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - name: AppSku; + readonly principalId?: string; + /** + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** Type of managed service identity (either system assigned, or none). */ + type: SystemAssignedServiceIdentityType; } -/** - * The common properties of an ARM resource. - */ -export interface Resource extends BaseResource { +/** The common properties of an ARM resource. */ +export interface Resource { /** * The ARM 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 ARM 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 IoT Central application. - */ -export interface App extends Resource { - /** - * The ID of the application. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly applicationId?: string; - /** - * The display name of the application. - */ - displayName?: string; - /** - * The subdomain of the application. - */ - subdomain?: string; - /** - * The ID of the application template, which is a blueprint that defines the characteristics and - * behaviors of an application. Optional; if not specified, defaults to a blank blueprint and - * allows the application to be defined from scratch. - */ - template?: string; - /** - * A valid instance SKU. - */ - sku: AppSkuInfo; -} - -/** - * The description of the IoT Central application. - */ -export interface AppPatch { +/** Error details. */ +export interface CloudError { /** - * Instance tags - */ - tags?: { [propertyName: string]: string }; - /** - * A valid instance SKU. - */ - sku?: AppSkuInfo; - /** - * The ID of the application. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly applicationId?: string; - /** - * The display name of the application. + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - displayName?: string; + readonly code?: string; /** - * The subdomain of the application. + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - subdomain?: string; + readonly message?: string; /** - * The ID of the application template, which is a blueprint that defines the characteristics and - * behaviors of an application. Optional; if not specified, defaults to a blank blueprint and - * allows the application to be defined from scratch. + * The target of the particular error. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - template?: string; + readonly target?: string; + /** A list of additional details about the error. */ + details?: CloudErrorBody[]; } -/** - * Details of error response. - */ +/** Details of error response. */ export interface CloudErrorBody { /** * The 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; /** * The error message. - * **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; /** * The target of the particular 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 target?: string; - /** - * A list of additional details about the error. - */ + /** A list of additional details about the error. */ details?: CloudErrorBody[]; } -/** - * The object that represents the operation. - */ -export interface OperationDisplay { - /** - * Service provider: Microsoft IoT Central - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provider?: string; +/** The description of the IoT Central application. */ +export interface AppPatch { + /** Instance tags */ + tags?: { [propertyName: string]: string }; + /** A valid instance SKU. */ + sku?: AppSkuInfo; + /** The managed identities for the IoT Central application. */ + identity?: SystemAssignedServiceIdentity; /** - * Resource Type: IoT Central - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The ID of the application. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly resource?: string; + readonly applicationId?: string; + /** The display name of the application. */ + displayName?: string; + /** The subdomain of the application. */ + subdomain?: string; + /** The ID of the application template, which is a blueprint that defines the characteristics and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and allows the application to be defined from scratch. */ + template?: string; /** - * Name of the operation - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The current state of the application. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly operation?: string; - /** - * Friendly description for the operation, - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly description?: string; + readonly state?: AppState; } -/** - * IoT Central 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.** - */ - readonly name?: string; - /** - * The object that represents the operation. - */ - display?: OperationDisplay; - /** - * The intended executor of the operation. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly origin?: string; - /** - * Additional descriptions for the operation. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly properties?: any; +/** A list of IoT Central Applications with a next link. */ +export interface AppListResult { + /** The link used to get the next page of IoT Central Applications. */ + nextLink?: string; + /** A list of IoT Central Applications. */ + value?: App[]; } -/** - * Input values. - */ +/** Input values. */ export interface OperationInputs { - /** - * The name of the IoT Central application instance to check. - */ + /** The name of the IoT Central application instance to check. */ name: string; - /** - * The type of the IoT Central resource to query. Default value: 'IoTApps'. - */ + /** The type of the IoT Central resource to query. */ type?: string; } -/** - * The properties indicating whether a given IoT Central application name or subdomain is - * available. - */ +/** The properties indicating whether a given IoT Central application name or subdomain is available. */ export interface AppAvailabilityInfo { /** * The value which indicates whether the provided name is available. - * **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 nameAvailable?: boolean; /** * The reason for unavailability. - * **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 reason?: string; /** * The detailed reason message. - * **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; } -/** - * IoT Central Application Template Locations. - */ -export interface AppTemplateLocations { - /** - * The ID of the location. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; +/** A list of IoT Central Application Templates with a next link. */ +export interface AppTemplatesResult { + /** The link used to get the next page of IoT Central application templates. */ + nextLink?: string; /** - * The display name of the location. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * A list of IoT Central Application Templates. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly displayName?: string; + readonly value?: AppTemplate[]; } -/** - * IoT Central Application Template. - */ +/** IoT Central Application Template. */ export interface AppTemplate { /** * The ID of the template. - * **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 manifestId?: string; /** * The version of the template. - * **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 manifestVersion?: string; /** * The name of the template. - * **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 title of the template. - * **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 title?: string; /** * The order of the template in the templates list. - * **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 order?: number; /** * The description of the template. - * **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 description?: string; /** * The industry of the template. - * **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 industry?: string; /** * A list of locations that support the template. - * **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 locations?: AppTemplateLocations[]; } -/** - * An interface representing IotCentralClientOptions. - */ -export interface IotCentralClientOptions extends AzureServiceClientOptions { - baseUri?: string; +/** IoT Central Application Template Locations. */ +export interface AppTemplateLocations { + /** + * The ID of the location. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The display name of the location. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly displayName?: string; } -/** - * @interface - * A list of IoT Central Applications with a next link. - * @extends Array - */ -export interface AppListResult extends Array { +/** A list of IoT Central 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 IoT Central description objects. */ + nextLink?: string; /** - * The link used to get the next page of IoT Central Applications. + * A list of operations supported by the Microsoft.IoTCentral resource provider. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - nextLink?: string; + readonly value?: Operation[]; } -/** - * @interface - * A list of IoT Central Application Templates with a next link. - * @extends Array - */ -export interface AppTemplatesResult extends Array { +/** IoT Central REST API operation */ +export interface Operation { /** - * The link used to get the next page of IoT Central application templates. + * Operation name: {provider}/{resource}/{read | write | action | delete} + * NOTE: This property will not be serialized. It can only be populated by the server. */ - nextLink?: string; + readonly name?: string; + /** The object that represents the operation. */ + display?: OperationDisplay; + /** + * The intended executor of the operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly origin?: string; + /** + * Additional descriptions for the operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly properties?: Record; } -/** - * @interface - * A list of IoT Central 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 object that represents the operation. */ +export interface OperationDisplay { + /** + * Service provider: Microsoft IoT Central + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provider?: string; /** - * The link used to get the next page of IoT Central description objects. + * Resource Type: IoT Central + * NOTE: This property will not be serialized. It can only be populated by the server. */ - nextLink?: string; + readonly resource?: string; + /** + * Name of the operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operation?: string; + /** + * Friendly description for the operation, + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; } -/** - * Defines values for AppSku. - * Possible values include: 'F1', 'S1', 'ST0', 'ST1', 'ST2' - * @readonly - * @enum {string} - */ -export type AppSku = 'F1' | 'S1' | 'ST0' | 'ST1' | 'ST2'; - -/** - * Contains response data for the get operation. - */ -export type AppsGetResponse = App & { +/** The IoT Central application. */ +export type App = Resource & { + /** A valid instance SKU. */ + sku: AppSkuInfo; + /** The managed identities for the IoT Central application. */ + identity?: SystemAssignedServiceIdentity; /** - * The underlying HTTP response. + * The ID of the application. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: App; - }; -}; - -/** - * Contains response data for the createOrUpdate operation. - */ -export type AppsCreateOrUpdateResponse = App & { + readonly applicationId?: string; + /** The display name of the application. */ + displayName?: string; + /** The subdomain of the application. */ + subdomain?: string; + /** The ID of the application template, which is a blueprint that defines the characteristics and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and allows the application to be defined from scratch. */ + template?: string; /** - * The underlying HTTP response. + * The current state of the application. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: App; - }; + readonly state?: AppState; }; +/** Known values of {@link AppState} that the service accepts. */ +export enum KnownAppState { + Created = "created", + Suspended = "suspended" +} + /** - * Contains response data for the update operation. - */ -export type AppsUpdateResponse = App & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; + * Defines values for AppState. \ + * {@link KnownAppState} can be used interchangeably with AppState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **created** \ + * **suspended** + */ +export type AppState = string; + +/** Known values of {@link AppSku} that the service accepts. */ +export enum KnownAppSku { + ST0 = "ST0", + ST1 = "ST1", + ST2 = "ST2" +} - /** - * The response body as parsed JSON or XML - */ - parsedBody: App; - }; -}; +/** + * Defines values for AppSku. \ + * {@link KnownAppSku} can be used interchangeably with AppSku, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ST0** \ + * **ST1** \ + * **ST2** + */ +export type AppSku = string; + +/** Known values of {@link SystemAssignedServiceIdentityType} that the service accepts. */ +export enum KnownSystemAssignedServiceIdentityType { + None = "None", + SystemAssigned = "SystemAssigned" +} /** - * Contains response data for the listBySubscription operation. - */ -export type AppsListBySubscriptionResponse = AppListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; + * Defines values for SystemAssignedServiceIdentityType. \ + * {@link KnownSystemAssignedServiceIdentityType} can be used interchangeably with SystemAssignedServiceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **SystemAssigned** + */ +export type SystemAssignedServiceIdentityType = string; + +/** Optional parameters. */ +export interface AppsGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type AppsGetResponse = App; + +/** Optional parameters. */ +export interface AppsCreateOrUpdateOptionalParams + 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 response body as parsed JSON or XML - */ - parsedBody: AppListResult; - }; -}; +/** Contains response data for the createOrUpdate operation. */ +export type AppsCreateOrUpdateResponse = App; -/** - * Contains response data for the listByResourceGroup operation. - */ -export type AppsListByResourceGroupResponse = AppListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Optional parameters. */ +export interface AppsUpdateOptionalParams 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 response body as parsed JSON or XML - */ - parsedBody: AppListResult; - }; -}; +/** Contains response data for the update operation. */ +export type AppsUpdateResponse = App; -/** - * Contains response data for the checkNameAvailability operation. - */ -export type AppsCheckNameAvailabilityResponse = AppAvailabilityInfo & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Optional parameters. */ +export interface AppsDeleteOptionalParams 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 response body as parsed JSON or XML - */ - parsedBody: AppAvailabilityInfo; - }; -}; +/** Optional parameters. */ +export interface AppsListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the checkSubdomainAvailability operation. - */ -export type AppsCheckSubdomainAvailabilityResponse = AppAvailabilityInfo & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Contains response data for the listBySubscription operation. */ +export type AppsListBySubscriptionResponse = AppListResult; - /** - * The response body as parsed JSON or XML - */ - parsedBody: AppAvailabilityInfo; - }; -}; +/** Optional parameters. */ +export interface AppsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listTemplates operation. - */ -export type AppsListTemplatesResponse = AppTemplatesResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Contains response data for the listByResourceGroup operation. */ +export type AppsListByResourceGroupResponse = AppListResult; - /** - * The response body as parsed JSON or XML - */ - parsedBody: AppTemplatesResult; - }; -}; +/** Optional parameters. */ +export interface AppsCheckNameAvailabilityOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type AppsBeginCreateOrUpdateResponse = App & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Contains response data for the checkNameAvailability operation. */ +export type AppsCheckNameAvailabilityResponse = AppAvailabilityInfo; - /** - * The response body as parsed JSON or XML - */ - parsedBody: App; - }; -}; +/** Optional parameters. */ +export interface AppsCheckSubdomainAvailabilityOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the beginUpdate operation. - */ -export type AppsBeginUpdateResponse = App & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Contains response data for the checkSubdomainAvailability operation. */ +export type AppsCheckSubdomainAvailabilityResponse = AppAvailabilityInfo; - /** - * The response body as parsed JSON or XML - */ - parsedBody: App; - }; -}; +/** Optional parameters. */ +export interface AppsListTemplatesOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listBySubscriptionNext operation. - */ -export type AppsListBySubscriptionNextResponse = AppListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Contains response data for the listTemplates operation. */ +export type AppsListTemplatesResponse = AppTemplatesResult; - /** - * The response body as parsed JSON or XML - */ - parsedBody: AppListResult; - }; -}; +/** Optional parameters. */ +export interface AppsListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listByResourceGroupNext operation. - */ -export type AppsListByResourceGroupNextResponse = AppListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Contains response data for the listBySubscriptionNext operation. */ +export type AppsListBySubscriptionNextResponse = AppListResult; - /** - * The response body as parsed JSON or XML - */ - parsedBody: AppListResult; - }; -}; +/** Optional parameters. */ +export interface AppsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listTemplatesNext operation. - */ -export type AppsListTemplatesNextResponse = AppTemplatesResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Contains response data for the listByResourceGroupNext operation. */ +export type AppsListByResourceGroupNextResponse = AppListResult; - /** - * The response body as parsed JSON or XML - */ - parsedBody: AppTemplatesResult; - }; -}; +/** Optional parameters. */ +export interface AppsListTemplatesNextOptionalParams + extends coreClient.OperationOptions {} -/** - * 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; +/** Contains response data for the listTemplatesNext operation. */ +export type AppsListTemplatesNextResponse = AppTemplatesResult; - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationListResult; - }; -}; +/** Optional parameters. */ +export interface OperationsListOptionalParams + 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; +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationListResult; - }; -}; +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationListResult; + +/** Optional parameters. */ +export interface IotCentralClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/iotcentral/arm-iotcentral/src/models/mappers.ts b/sdk/iotcentral/arm-iotcentral/src/models/mappers.ts index 1471146067ac..6982d3511bde 100644 --- a/sdk/iotcentral/arm-iotcentral/src/models/mappers.ts +++ b/sdk/iotcentral/arm-iotcentral/src/models/mappers.ts @@ -6,21 +6,16 @@ * 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 AppSkuInfo: msRest.CompositeMapper = { - serializedName: "AppSkuInfo", +export const AppSkuInfo: coreClient.CompositeMapper = { type: { name: "Composite", className: "AppSkuInfo", modelProperties: { name: { - required: true, serializedName: "name", + required: true, type: { name: "String" } @@ -29,178 +24,147 @@ export const AppSkuInfo: msRest.CompositeMapper = { } }; -export const Resource: msRest.CompositeMapper = { - serializedName: "Resource", +export const SystemAssignedServiceIdentity: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Resource", + className: "SystemAssignedServiceIdentity", modelProperties: { - id: { + principalId: { + serializedName: "principalId", readOnly: true, - serializedName: "id", type: { - name: "String" + name: "Uuid" } }, - name: { + tenantId: { + serializedName: "tenantId", readOnly: true, - serializedName: "name", - constraints: { - Pattern: /^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,99}[a-zA-Z0-9]$/ - }, type: { - name: "String" + name: "Uuid" } }, type: { - readOnly: true, serializedName: "type", - type: { - name: "String" - } - }, - location: { required: true, - serializedName: "location", type: { name: "String" } - }, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } - } } } } }; -export const App: msRest.CompositeMapper = { - serializedName: "App", +export const Resource: coreClient.CompositeMapper = { type: { name: "Composite", - className: "App", + className: "Resource", modelProperties: { - ...Resource.type.modelProperties, - applicationId: { + id: { + serializedName: "id", readOnly: true, - serializedName: "properties.applicationId", type: { name: "String" } }, - displayName: { - serializedName: "properties.displayName", + name: { + constraints: { + Pattern: new RegExp("^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,99}[a-zA-Z0-9]$") + }, + serializedName: "name", + readOnly: true, type: { name: "String" } }, - subdomain: { - serializedName: "properties.subdomain", + type: { + serializedName: "type", + readOnly: true, type: { name: "String" } }, - template: { - serializedName: "properties.template", + location: { + serializedName: "location", + required: true, type: { name: "String" } }, - sku: { - required: true, - serializedName: "sku", + tags: { + serializedName: "tags", type: { - name: "Composite", - className: "AppSkuInfo" + name: "Dictionary", + value: { type: { name: "String" } } } } } } }; -export const AppPatch: msRest.CompositeMapper = { - serializedName: "AppPatch", +export const CloudError: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AppPatch", + className: "CloudError", modelProperties: { - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } - } - }, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "AppSkuInfo" - } - }, - applicationId: { + code: { + serializedName: "error.code", readOnly: true, - serializedName: "properties.applicationId", type: { name: "String" } }, - displayName: { - serializedName: "properties.displayName", + message: { + serializedName: "error.message", + readOnly: true, type: { name: "String" } }, - subdomain: { - serializedName: "properties.subdomain", + target: { + serializedName: "error.target", + readOnly: true, type: { name: "String" } }, - template: { - serializedName: "properties.template", + details: { + serializedName: "error.details", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CloudErrorBody" + } + } } } } } }; -export const CloudErrorBody: msRest.CompositeMapper = { - serializedName: "CloudErrorBody", +export const CloudErrorBody: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudErrorBody", modelProperties: { code: { - readOnly: true, serializedName: "code", + readOnly: true, type: { name: "String" } }, message: { - readOnly: true, serializedName: "message", + readOnly: true, type: { name: "String" } }, target: { - readOnly: true, serializedName: "target", + readOnly: true, type: { name: "String" } @@ -221,36 +185,60 @@ export const CloudErrorBody: msRest.CompositeMapper = { } }; -export const OperationDisplay: msRest.CompositeMapper = { - serializedName: "OperationDisplay", +export const AppPatch: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationDisplay", + className: "AppPatch", modelProperties: { - provider: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "AppSkuInfo" + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "SystemAssignedServiceIdentity" + } + }, + applicationId: { + serializedName: "properties.applicationId", readOnly: true, - serializedName: "provider", type: { name: "String" } }, - resource: { - readOnly: true, - serializedName: "resource", + displayName: { + serializedName: "properties.displayName", type: { name: "String" } }, - operation: { - readOnly: true, - serializedName: "operation", + subdomain: { + serializedName: "properties.subdomain", type: { name: "String" } }, - description: { + template: { + serializedName: "properties.template", + type: { + name: "String" + } + }, + state: { + serializedName: "properties.state", readOnly: true, - serializedName: "description", type: { name: "String" } @@ -259,60 +247,48 @@ export const OperationDisplay: msRest.CompositeMapper = { } }; -export const Operation: msRest.CompositeMapper = { - serializedName: "Operation", +export const AppListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Operation", + className: "AppListResult", modelProperties: { - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay" - } - }, - origin: { - readOnly: true, - serializedName: "origin", + nextLink: { + serializedName: "nextLink", type: { name: "String" } }, - properties: { - readOnly: true, - serializedName: "properties", + value: { + serializedName: "value", type: { - name: "Object" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "App" + } + } } } } } }; -export const OperationInputs: msRest.CompositeMapper = { - serializedName: "OperationInputs", +export const OperationInputs: coreClient.CompositeMapper = { type: { name: "Composite", className: "OperationInputs", modelProperties: { name: { - required: true, serializedName: "name", + required: true, type: { name: "String" } }, type: { + defaultValue: "IoTApps", serializedName: "type", - defaultValue: 'IoTApps', type: { name: "String" } @@ -321,29 +297,28 @@ export const OperationInputs: msRest.CompositeMapper = { } }; -export const AppAvailabilityInfo: msRest.CompositeMapper = { - serializedName: "AppAvailabilityInfo", +export const AppAvailabilityInfo: coreClient.CompositeMapper = { type: { name: "Composite", className: "AppAvailabilityInfo", modelProperties: { nameAvailable: { - readOnly: true, serializedName: "nameAvailable", + readOnly: true, type: { name: "Boolean" } }, reason: { - readOnly: true, serializedName: "reason", + readOnly: true, type: { name: "String" } }, message: { - readOnly: true, serializedName: "message", + readOnly: true, type: { name: "String" } @@ -352,88 +327,91 @@ export const AppAvailabilityInfo: msRest.CompositeMapper = { } }; -export const AppTemplateLocations: msRest.CompositeMapper = { - serializedName: "AppTemplateLocations", +export const AppTemplatesResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AppTemplateLocations", + className: "AppTemplatesResult", modelProperties: { - id: { - readOnly: true, - serializedName: "id", + nextLink: { + serializedName: "nextLink", type: { name: "String" } }, - displayName: { + value: { + serializedName: "value", readOnly: true, - serializedName: "displayName", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AppTemplate" + } + } } } } } }; -export const AppTemplate: msRest.CompositeMapper = { - serializedName: "AppTemplate", +export const AppTemplate: coreClient.CompositeMapper = { type: { name: "Composite", className: "AppTemplate", modelProperties: { manifestId: { - readOnly: true, serializedName: "manifestId", + readOnly: true, type: { name: "String" } }, manifestVersion: { - readOnly: true, serializedName: "manifestVersion", + readOnly: true, type: { name: "String" } }, name: { - readOnly: true, serializedName: "name", + readOnly: true, type: { name: "String" } }, title: { - readOnly: true, serializedName: "title", + readOnly: true, type: { name: "String" } }, order: { - readOnly: true, serializedName: "order", + readOnly: true, type: { name: "Number" } }, description: { - readOnly: true, serializedName: "description", + readOnly: true, type: { name: "String" } }, industry: { - readOnly: true, serializedName: "industry", + readOnly: true, type: { name: "String" } }, locations: { - readOnly: true, serializedName: "locations", + readOnly: true, type: { name: "Sequence", element: { @@ -448,39 +426,33 @@ export const AppTemplate: msRest.CompositeMapper = { } }; -export const AppListResult: msRest.CompositeMapper = { - serializedName: "AppListResult", +export const AppTemplateLocations: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AppListResult", + className: "AppTemplateLocations", modelProperties: { - nextLink: { - serializedName: "nextLink", + id: { + serializedName: "id", + readOnly: true, type: { name: "String" } }, - value: { - serializedName: "", + displayName: { + serializedName: "displayName", + readOnly: true, type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "App" - } - } + name: "String" } } } } }; -export const AppTemplatesResult: msRest.CompositeMapper = { - serializedName: "AppTemplatesResult", +export const OperationListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AppTemplatesResult", + className: "OperationListResult", modelProperties: { nextLink: { serializedName: "nextLink", @@ -489,14 +461,14 @@ export const AppTemplatesResult: msRest.CompositeMapper = { } }, value: { + serializedName: "value", readOnly: true, - serializedName: "", type: { name: "Sequence", element: { type: { name: "Composite", - className: "AppTemplate" + className: "Operation" } } } @@ -505,29 +477,131 @@ export const AppTemplatesResult: msRest.CompositeMapper = { } }; -export const OperationListResult: msRest.CompositeMapper = { - serializedName: "OperationListResult", +export const Operation: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationListResult", + className: "Operation", modelProperties: { - nextLink: { - serializedName: "nextLink", + name: { + serializedName: "name", + readOnly: true, type: { name: "String" } }, - value: { + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", readOnly: true, - serializedName: "", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Operation" - } - } + name: "String" + } + }, + properties: { + serializedName: "properties", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + readOnly: true, + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + readOnly: true, + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const App: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "App", + modelProperties: { + ...Resource.type.modelProperties, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "AppSkuInfo" + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "SystemAssignedServiceIdentity" + } + }, + applicationId: { + serializedName: "properties.applicationId", + readOnly: true, + type: { + name: "String" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + subdomain: { + serializedName: "properties.subdomain", + type: { + name: "String" + } + }, + template: { + serializedName: "properties.template", + type: { + name: "String" + } + }, + state: { + serializedName: "properties.state", + readOnly: true, + type: { + name: "String" } } } diff --git a/sdk/iotcentral/arm-iotcentral/src/models/parameters.ts b/sdk/iotcentral/arm-iotcentral/src/models/parameters.ts index b5b5ee4fce77..0b920e44059b 100644 --- a/sdk/iotcentral/arm-iotcentral/src/models/parameters.ts +++ b/sdk/iotcentral/arm-iotcentral/src/models/parameters.ts @@ -3,70 +3,124 @@ * 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 { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + App as AppMapper, + AppPatch as AppPatchMapper, + OperationInputs as OperationInputsMapper +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const accept: OperationParameter = { + parameterPath: "accept", mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", type: { name: "String" } } }; -export const apiVersion: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", + +export const $host: OperationURLParameter = { + parameterPath: "$host", mapper: { + serializedName: "$host", required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2021-06-01", + isConstant: true, serializedName: "api-version", type: { name: "String" } } }; -export const nextPageLink: msRest.OperationURLParameter = { - parameterPath: "nextPageLink", + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", mapper: { + serializedName: "subscriptionId", required: true, - serializedName: "nextLink", type: { name: "String" } - }, - skipEncoding: true + } }; -export const resourceGroupName: msRest.OperationURLParameter = { + +export const resourceGroupName: OperationURLParameter = { parameterPath: "resourceGroupName", mapper: { - required: true, serializedName: "resourceGroupName", + required: true, type: { name: "String" } } }; -export const resourceName: msRest.OperationURLParameter = { + +export const resourceName: OperationURLParameter = { parameterPath: "resourceName", mapper: { - required: true, serializedName: "resourceName", + required: true, type: { name: "String" } } }; -export const subscriptionId: msRest.OperationURLParameter = { - parameterPath: "subscriptionId", + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], mapper: { - required: true, - serializedName: "subscriptionId", + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", type: { name: "String" } } }; + +export const app: OperationParameter = { + parameterPath: "app", + mapper: AppMapper +}; + +export const appPatch: OperationParameter = { + parameterPath: "appPatch", + mapper: AppPatchMapper +}; + +export const operationInputs: OperationParameter = { + parameterPath: "operationInputs", + mapper: OperationInputsMapper +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; diff --git a/sdk/iotcentral/arm-iotcentral/src/operations/apps.ts b/sdk/iotcentral/arm-iotcentral/src/operations/apps.ts index 2e5ecccf4179..7e87f5ef5428 100644 --- a/sdk/iotcentral/arm-iotcentral/src/operations/apps.ts +++ b/sdk/iotcentral/arm-iotcentral/src/operations/apps.ts @@ -3,412 +3,602 @@ * 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/appsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Apps } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { IotCentralClientContext } from "../iotCentralClientContext"; +import { IotCentralClient } from "../iotCentralClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + App, + AppsListBySubscriptionNextOptionalParams, + AppsListBySubscriptionOptionalParams, + AppsListByResourceGroupNextOptionalParams, + AppsListByResourceGroupOptionalParams, + AppTemplate, + AppsListTemplatesNextOptionalParams, + AppsListTemplatesOptionalParams, + AppsGetOptionalParams, + AppsGetResponse, + AppsCreateOrUpdateOptionalParams, + AppsCreateOrUpdateResponse, + AppPatch, + AppsUpdateOptionalParams, + AppsUpdateResponse, + AppsDeleteOptionalParams, + AppsListBySubscriptionResponse, + AppsListByResourceGroupResponse, + OperationInputs, + AppsCheckNameAvailabilityOptionalParams, + AppsCheckNameAvailabilityResponse, + AppsCheckSubdomainAvailabilityOptionalParams, + AppsCheckSubdomainAvailabilityResponse, + AppsListTemplatesResponse, + AppsListBySubscriptionNextResponse, + AppsListByResourceGroupNextResponse, + AppsListTemplatesNextResponse +} from "../models"; -/** Class representing a Apps. */ -export class Apps { - private readonly client: IotCentralClientContext; +/// +/** Class containing Apps operations. */ +export class AppsImpl implements Apps { + private readonly client: IotCentralClient; /** - * Create a Apps. - * @param {IotCentralClientContext} client Reference to the service client. + * Initialize a new instance of the class Apps class. + * @param client Reference to the service client */ - constructor(client: IotCentralClientContext) { + constructor(client: IotCentralClient) { this.client = client; } /** - * Get the metadata of an IoT Central application. - * @param resourceGroupName The name of the resource group that contains the IoT Central - * application. - * @param resourceName The ARM resource name of the IoT Central application. - * @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 IoT Central - * application. - * @param resourceName The ARM resource name of the IoT Central application. - * @param callback The callback - */ - get(resourceGroupName: string, resourceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group that contains the IoT Central - * application. - * @param resourceName The ARM resource name of the IoT Central application. - * @param options The optional parameters - * @param callback The callback - */ - 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 + * Get all IoT Central Applications in a subscription. + * @param options The options parameters. + */ + public listBySubscription( + options?: AppsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); }, - getOperationSpec, - callback) as Promise; - } - - /** - * Create or update the metadata of an IoT Central application. The usual pattern to modify a - * property is to retrieve the IoT Central application metadata and security metadata, and then - * combine them with the modified values in a new body to update the IoT Central application. - * @param resourceGroupName The name of the resource group that contains the IoT Central - * application. - * @param resourceName The ARM resource name of the IoT Central application. - * @param app The IoT Central application metadata and security metadata. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdate(resourceGroupName: string, resourceName: string, app: Models.App, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreateOrUpdate(resourceGroupName,resourceName,app,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionPagingPage(options); + } + }; } - /** - * Update the metadata of an IoT Central application. - * @param resourceGroupName The name of the resource group that contains the IoT Central - * application. - * @param resourceName The ARM resource name of the IoT Central application. - * @param appPatch The IoT Central application metadata and security metadata. - * @param [options] The optional parameters - * @returns Promise - */ - update(resourceGroupName: string, resourceName: string, appPatch: Models.AppPatch, options?: msRest.RequestOptionsBase): Promise { - return this.beginUpdate(resourceGroupName,resourceName,appPatch,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + private async *listBySubscriptionPagingPage( + options?: AppsListBySubscriptionOptionalParams + ): AsyncIterableIterator { + let result = await this._listBySubscription(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } } - /** - * Delete an IoT Central application. - * @param resourceGroupName The name of the resource group that contains the IoT Central - * application. - * @param resourceName The ARM resource name of the IoT Central application. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,resourceName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); + private async *listBySubscriptionPagingAll( + options?: AppsListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } } /** - * Get all IoT Central Applications in a subscription. - * @param [options] The optional parameters - * @returns Promise - */ - listBySubscription(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - listBySubscription(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - listBySubscription(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listBySubscription(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + * Get all the IoT Central Applications in a resource group. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: AppsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; }, - listBySubscriptionOperationSpec, - callback) as Promise; + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; } - /** - * Get all the IoT Central Applications in a resource group. - * @param resourceGroupName The name of the resource group that contains the IoT Central - * application. - * @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 IoT Central - * application. - * @param callback The callback - */ - listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group that contains the IoT Central - * application. - * @param options The optional parameters - * @param callback The callback - */ - listByResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: AppsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( resourceGroupName, + continuationToken, options - }, - listByResourceGroupOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: AppsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } } /** - * Check if an IoT Central application name is available. - * @param operationInputs Set the name parameter in the OperationInputs structure to the name of - * the IoT Central application to check. - * @param [options] The optional parameters - * @returns Promise - */ - checkNameAvailability(operationInputs: Models.OperationInputs, options?: msRest.RequestOptionsBase): Promise; - /** - * @param operationInputs Set the name parameter in the OperationInputs structure to the name of - * the IoT Central application to check. - * @param callback The callback - */ - checkNameAvailability(operationInputs: Models.OperationInputs, callback: msRest.ServiceCallback): void; - /** - * @param operationInputs Set the name parameter in the OperationInputs structure to the name of - * the IoT Central application to check. - * @param options The optional parameters - * @param callback The callback - */ - checkNameAvailability(operationInputs: Models.OperationInputs, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - checkNameAvailability(operationInputs: Models.OperationInputs, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - operationInputs, - options + * Get all available application templates. + * @param options The options parameters. + */ + public listTemplates( + options?: AppsListTemplatesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listTemplatesPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; }, - checkNameAvailabilityOperationSpec, - callback) as Promise; + byPage: () => { + return this.listTemplatesPagingPage(options); + } + }; + } + + private async *listTemplatesPagingPage( + options?: AppsListTemplatesOptionalParams + ): AsyncIterableIterator { + let result = await this._listTemplates(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listTemplatesNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listTemplatesPagingAll( + options?: AppsListTemplatesOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listTemplatesPagingPage(options)) { + yield* page; + } } /** - * Check if an IoT Central application subdomain is available. - * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain - * of the IoT Central application to check. - * @param [options] The optional parameters - * @returns Promise - */ - checkSubdomainAvailability(operationInputs: Models.OperationInputs, options?: msRest.RequestOptionsBase): Promise; - /** - * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain - * of the IoT Central application to check. - * @param callback The callback - */ - checkSubdomainAvailability(operationInputs: Models.OperationInputs, callback: msRest.ServiceCallback): void; - /** - * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain - * of the IoT Central application to check. - * @param options The optional parameters - * @param callback The callback + * Get the metadata of an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param options The options parameters. */ - checkSubdomainAvailability(operationInputs: Models.OperationInputs, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - checkSubdomainAvailability(operationInputs: Models.OperationInputs, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + resourceName: string, + options?: AppsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - operationInputs, - options - }, - checkSubdomainAvailabilityOperationSpec, - callback) as Promise; + { resourceGroupName, resourceName, options }, + getOperationSpec + ); } /** - * Get all available application templates. - * @param [options] The optional parameters - * @returns Promise - */ - listTemplates(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - listTemplates(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - listTemplates(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listTemplates(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listTemplatesOperationSpec, - callback) as Promise; + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property + * is to retrieve the IoT Central application metadata and security metadata, and then combine them + * with the modified values in a new body to update the IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + app: App, + options?: AppsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + AppsCreateOrUpdateResponse + > + > { + 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, app, options }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * Create or update the metadata of an IoT Central application. The usual pattern to modify a - * property is to retrieve the IoT Central application metadata and security metadata, and then - * combine them with the modified values in a new body to update the IoT Central application. - * @param resourceGroupName The name of the resource group that contains the IoT Central - * application. + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property + * is to retrieve the IoT Central application metadata and security metadata, and then combine them + * with the modified values in a new body to update the IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @param app The IoT Central application metadata and security metadata. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateOrUpdate(resourceGroupName: string, resourceName: string, app: Models.App, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - resourceName, - app, - options - }, - beginCreateOrUpdateOperationSpec, - options); + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + app: App, + options?: AppsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + resourceName, + app, + options + ); + return poller.pollUntilDone(); } /** * Update the metadata of an IoT Central application. - * @param resourceGroupName The name of the resource group that contains the IoT Central - * application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @param appPatch The IoT Central application metadata and security metadata. - * @param [options] The optional parameters - * @returns Promise - */ - beginUpdate(resourceGroupName: string, resourceName: string, appPatch: Models.AppPatch, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - resourceName, - appPatch, - options - }, - beginUpdateOperationSpec, - options); + * @param options The options parameters. + */ + async beginUpdate( + resourceGroupName: string, + resourceName: string, + appPatch: AppPatch, + options?: AppsUpdateOptionalParams + ): Promise< + PollerLike, AppsUpdateResponse> + > { + 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, appPatch, options }, + updateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * Delete an IoT Central application. - * @param resourceGroupName The name of the resource group that contains the IoT Central - * application. + * Update the metadata of an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. - * @param [options] The optional parameters - * @returns Promise - */ - beginDeleteMethod(resourceGroupName: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - resourceName, - options - }, - beginDeleteMethodOperationSpec, - options); + * @param appPatch The IoT Central application metadata and security metadata. + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + resourceName: string, + appPatch: AppPatch, + options?: AppsUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + resourceName, + appPatch, + options + ); + return poller.pollUntilDone(); } /** - * Get all IoT Central Applications in a subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + * Delete an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + resourceName: string, + options?: AppsDeleteOptionalParams + ): 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, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listBySubscriptionNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + * Delete an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + options?: AppsDeleteOptionalParams + ): 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 options The optional parameters - * @param callback The callback + * Get all IoT Central Applications in a subscription. + * @param options The options parameters. */ - listBySubscriptionNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listBySubscription( + options?: AppsListBySubscriptionOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listBySubscriptionNextOperationSpec, - callback) as Promise; + { options }, + listBySubscriptionOperationSpec + ); } /** * Get all the IoT Central Applications in a resource group. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param options The options parameters. */ - listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + private _listByResourceGroup( + resourceGroupName: string, + options?: AppsListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listByResourceGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + * Check if an IoT Central application name is available. + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the + * IoT Central application to check. + * @param options The options parameters. + */ + checkNameAvailability( + operationInputs: OperationInputs, + options?: AppsCheckNameAvailabilityOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { operationInputs, options }, + checkNameAvailabilityOperationSpec + ); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listByResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + * Check if an IoT Central application subdomain is available. + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of + * the IoT Central application to check. + * @param options The options parameters. + */ + checkSubdomainAvailability( + operationInputs: OperationInputs, + options?: AppsCheckSubdomainAvailabilityOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByResourceGroupNextOperationSpec, - callback) as Promise; + { operationInputs, options }, + checkSubdomainAvailabilityOperationSpec + ); } /** * Get all available application templates. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listTemplatesNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + private _listTemplates( + options?: AppsListTemplatesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listTemplatesOperationSpec + ); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. */ - listTemplatesNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + private _listBySubscriptionNext( + nextLink: string, + options?: AppsListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } + /** - * @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 IoT Central application. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. */ - listTemplatesNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listTemplatesNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: AppsListByResourceGroupNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listTemplatesNextOperationSpec, - callback) as Promise; + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); } -} + /** + * ListTemplatesNext + * @param nextLink The nextLink from the previous successful call to the ListTemplates method. + * @param options The options parameters. + */ + private _listTemplatesNext( + nextLink: string, + options?: AppsListTemplatesNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listTemplatesNextOperationSpec + ); + } +} // 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.IoTCentral/iotApps/{resourceName}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.App @@ -417,246 +607,201 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const listBySubscriptionOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/iotApps", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}", + httpMethod: "PUT", responses: { 200: { - bodyMapper: Mappers.AppListResult + bodyMapper: Mappers.App + }, + 201: { + bodyMapper: Mappers.App + }, + 202: { + bodyMapper: Mappers.App + }, + 204: { + bodyMapper: Mappers.App }, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const listByResourceGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps", + requestBody: Parameters.app, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, - Parameters.resourceGroupName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.resourceGroupName, + Parameters.resourceName ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}", + httpMethod: "PATCH", responses: { 200: { - bodyMapper: Mappers.AppListResult + bodyMapper: Mappers.App + }, + 201: { + bodyMapper: Mappers.App + }, + 202: { + bodyMapper: Mappers.App + }, + 204: { + bodyMapper: Mappers.App }, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const checkNameAvailabilityOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability", + requestBody: Parameters.appPatch, + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName ], - requestBody: { - parameterPath: "operationInputs", - mapper: { - ...Mappers.OperationInputs, - required: true - } - }, + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}", + httpMethod: "DELETE", responses: { - 200: { - bodyMapper: Mappers.AppAvailabilityInfo - }, + 200: {}, + 201: {}, + 202: {}, + 204: {}, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const checkSubdomainAvailabilityOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkSubdomainAvailability", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName ], - requestBody: { - parameterPath: "operationInputs", - mapper: { - ...Mappers.OperationInputs, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/iotApps", + httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.AppAvailabilityInfo + bodyMapper: Mappers.AppListResult }, default: { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const listTemplatesOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/appTemplates", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps", + httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.AppTemplatesResult + bodyMapper: Mappers.AppListResult }, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.resourceGroupName ], - requestBody: { - parameterPath: "app", - mapper: { - ...Mappers.App, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability", + httpMethod: "POST", responses: { 200: { - bodyMapper: Mappers.App - }, - 201: { - bodyMapper: Mappers.App + bodyMapper: Mappers.AppAvailabilityInfo }, - 202: {}, default: { bodyMapper: Mappers.CloudError } }, + requestBody: Parameters.operationInputs, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; - -const beginUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "appPatch", - mapper: { - ...Mappers.AppPatch, - required: true - } - }, +const checkSubdomainAvailabilityOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkSubdomainAvailability", + httpMethod: "POST", responses: { 200: { - bodyMapper: Mappers.App + bodyMapper: Mappers.AppAvailabilityInfo }, - 202: {}, default: { bodyMapper: Mappers.CloudError } }, + requestBody: Parameters.operationInputs, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps/{resourceName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], +const listTemplatesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/appTemplates", + httpMethod: "POST", responses: { - 200: {}, - 202: {}, - 204: {}, + 200: { + bodyMapper: Mappers.AppTemplatesResult + }, default: { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const listBySubscriptionNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.AppListResult @@ -665,22 +810,18 @@ const listBySubscriptionNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + 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.AppListResult @@ -689,22 +830,19 @@ const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listTemplatesNextOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - baseUrl: "https://management.azure.com", +const listTemplatesNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.AppTemplatesResult @@ -713,5 +851,12 @@ const listTemplatesNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/iotcentral/arm-iotcentral/src/operations/index.ts b/sdk/iotcentral/arm-iotcentral/src/operations/index.ts index b62f41478b0a..d1e6cfaa9a9a 100644 --- a/sdk/iotcentral/arm-iotcentral/src/operations/index.ts +++ b/sdk/iotcentral/arm-iotcentral/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 "./apps"; diff --git a/sdk/iotcentral/arm-iotcentral/src/operations/operations.ts b/sdk/iotcentral/arm-iotcentral/src/operations/operations.ts index d2b10b4f21c9..62f4054191c9 100644 --- a/sdk/iotcentral/arm-iotcentral/src/operations/operations.ts +++ b/sdk/iotcentral/arm-iotcentral/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 { IotCentralClientContext } from "../iotCentralClientContext"; +import { IotCentralClient } from "../iotCentralClient"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; -/** Class representing a Operations. */ -export class Operations { - private readonly client: IotCentralClientContext; +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: IotCentralClient; /** - * Create a Operations. - * @param {IotCentralClientContext} client Reference to the service client. + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client */ - constructor(client: IotCentralClientContext) { + constructor(client: IotCentralClient) { this.client = client; } /** - * Lists all of the available IoT Central application REST API operations. - * @param [options] The optional parameters - * @returns Promise + * Lists all of the available IoT Central Resource Provider operations. + * @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 IoT Central application 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 + * Lists all of the available IoT Central Resource Provider operations. + * @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.IoTCentral/operations", httpMethod: "GET", - path: "providers/Microsoft.IoTCentral/operations", - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.OperationListResult @@ -97,22 +114,14 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + 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.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/iotcentral/arm-iotcentral/src/operationsInterfaces/apps.ts b/sdk/iotcentral/arm-iotcentral/src/operationsInterfaces/apps.ts new file mode 100644 index 000000000000..ea4ec2d80ec1 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/src/operationsInterfaces/apps.ts @@ -0,0 +1,174 @@ +/* + * 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 { + App, + AppsListBySubscriptionOptionalParams, + AppsListByResourceGroupOptionalParams, + AppTemplate, + AppsListTemplatesOptionalParams, + AppsGetOptionalParams, + AppsGetResponse, + AppsCreateOrUpdateOptionalParams, + AppsCreateOrUpdateResponse, + AppPatch, + AppsUpdateOptionalParams, + AppsUpdateResponse, + AppsDeleteOptionalParams, + OperationInputs, + AppsCheckNameAvailabilityOptionalParams, + AppsCheckNameAvailabilityResponse, + AppsCheckSubdomainAvailabilityOptionalParams, + AppsCheckSubdomainAvailabilityResponse +} from "../models"; + +/// +/** Interface representing a Apps. */ +export interface Apps { + /** + * Get all IoT Central Applications in a subscription. + * @param options The options parameters. + */ + listBySubscription( + options?: AppsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get all the IoT Central Applications in a resource group. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: AppsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get all available application templates. + * @param options The options parameters. + */ + listTemplates( + options?: AppsListTemplatesOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get the metadata of an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + options?: AppsGetOptionalParams + ): Promise; + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property + * is to retrieve the IoT Central application metadata and security metadata, and then combine them + * with the modified values in a new body to update the IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + app: App, + options?: AppsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + AppsCreateOrUpdateResponse + > + >; + /** + * Create or update the metadata of an IoT Central application. The usual pattern to modify a property + * is to retrieve the IoT Central application metadata and security metadata, and then combine them + * with the modified values in a new body to update the IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param app The IoT Central application metadata and security metadata. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + app: App, + options?: AppsCreateOrUpdateOptionalParams + ): Promise; + /** + * Update the metadata of an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + resourceName: string, + appPatch: AppPatch, + options?: AppsUpdateOptionalParams + ): Promise< + PollerLike, AppsUpdateResponse> + >; + /** + * Update the metadata of an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param appPatch The IoT Central application metadata and security metadata. + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + resourceName: string, + appPatch: AppPatch, + options?: AppsUpdateOptionalParams + ): Promise; + /** + * Delete an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + resourceName: string, + options?: AppsDeleteOptionalParams + ): Promise, void>>; + /** + * Delete an IoT Central application. + * @param resourceGroupName The name of the resource group that contains the IoT Central application. + * @param resourceName The ARM resource name of the IoT Central application. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + options?: AppsDeleteOptionalParams + ): Promise; + /** + * Check if an IoT Central application name is available. + * @param operationInputs Set the name parameter in the OperationInputs structure to the name of the + * IoT Central application to check. + * @param options The options parameters. + */ + checkNameAvailability( + operationInputs: OperationInputs, + options?: AppsCheckNameAvailabilityOptionalParams + ): Promise; + /** + * Check if an IoT Central application subdomain is available. + * @param operationInputs Set the name parameter in the OperationInputs structure to the subdomain of + * the IoT Central application to check. + * @param options The options parameters. + */ + checkSubdomainAvailability( + operationInputs: OperationInputs, + options?: AppsCheckSubdomainAvailabilityOptionalParams + ): Promise; +} diff --git a/sdk/iotcentral/arm-iotcentral/src/models/operationsMappers.ts b/sdk/iotcentral/arm-iotcentral/src/operationsInterfaces/index.ts similarity index 68% rename from sdk/iotcentral/arm-iotcentral/src/models/operationsMappers.ts rename to sdk/iotcentral/arm-iotcentral/src/operationsInterfaces/index.ts index 938d3e665a23..d1e6cfaa9a9a 100644 --- a/sdk/iotcentral/arm-iotcentral/src/models/operationsMappers.ts +++ b/sdk/iotcentral/arm-iotcentral/src/operationsInterfaces/index.ts @@ -6,9 +6,5 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - CloudError, - Operation, - OperationDisplay, - OperationListResult -} from "../models/mappers"; +export * from "./apps"; +export * from "./operations"; diff --git a/sdk/iotcentral/arm-iotcentral/src/operationsInterfaces/operations.ts b/sdk/iotcentral/arm-iotcentral/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..9eddb83ee644 --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/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 IoT Central Resource Provider operations. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/iotcentral/arm-iotcentral/test/sampleTest.ts b/sdk/iotcentral/arm-iotcentral/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/iotcentral/arm-iotcentral/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/iotcentral/arm-iotcentral/tsconfig.json b/sdk/iotcentral/arm-iotcentral/tsconfig.json index 422b584abd5e..6e3251194117 100644 --- a/sdk/iotcentral/arm-iotcentral/tsconfig.json +++ b/sdk/iotcentral/arm-iotcentral/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/iotcentral/ci.yml b/sdk/iotcentral/ci.yml new file mode 100644 index 000000000000..130c634ddf1a --- /dev/null +++ b/sdk/iotcentral/ci.yml @@ -0,0 +1,29 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/iotcentral/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/iotcentral/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: iotcentral + Artifacts: + - name: azure-arm-iotcentral + safeName: azurearmiotcentral + \ No newline at end of file