From 4077047557de4fc975692d50751bceb55dd458a1 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 13 May 2025 23:50:43 +0000 Subject: [PATCH] CodeGen from PR 34659 in Azure/azure-rest-api-specs Merge fff39c84516f040d6e6933f4fa4a78607c098bad into 778b6f8c84f4d62e66f054e3876acff30e5bd4f9 --- common/config/rush/pnpm-lock.yaml | 4 +- sdk/sphere/arm-sphere/CHANGELOG.md | 104 +- sdk/sphere/arm-sphere/LICENSE | 2 +- sdk/sphere/arm-sphere/README.md | 56 +- sdk/sphere/arm-sphere/_meta.json | 8 - sdk/sphere/arm-sphere/assets.json | 6 - sdk/sphere/arm-sphere/eslint.config.mjs | 14 + sdk/sphere/arm-sphere/package.json | 344 +++- .../review/arm-sphere-api-catalogs.api.md | 117 ++ .../review/arm-sphere-api-certificates.api.md | 44 + .../review/arm-sphere-api-deployments.api.md | 48 + .../review/arm-sphere-api-deviceGroups.api.md | 71 + .../review/arm-sphere-api-devices.api.md | 60 + .../review/arm-sphere-api-images.api.md | 48 + .../review/arm-sphere-api-operations.api.md | 19 + .../review/arm-sphere-api-products.api.md | 66 + .../arm-sphere/review/arm-sphere-api.api.md | 27 + .../review/arm-sphere-models.api.md | 405 ++++ .../arm-sphere/review/arm-sphere.api.md | 701 ++----- sdk/sphere/arm-sphere/sample.env | 5 +- .../samples-dev/catalogsCountDevicesSample.ts | 28 +- .../catalogsCreateOrUpdateSample.ts | 36 +- .../samples-dev/catalogsDeleteSample.ts | 29 +- .../samples-dev/catalogsGetSample.ts | 28 +- .../catalogsListByResourceGroupSample.ts | 28 +- .../catalogsListBySubscriptionSample.ts | 25 +- .../catalogsListDeploymentsSample.ts | 29 +- .../catalogsListDeviceGroupsSample.ts | 37 +- .../catalogsListDeviceInsightsSample.ts | 38 +- .../samples-dev/catalogsListDevicesSample.ts | 29 +- .../samples-dev/catalogsUpdateSample.ts | 30 +- .../samples-dev/catalogsUploadImageSample.ts | 37 +- .../samples-dev/certificatesGetSample.ts | 29 +- .../certificatesListByCatalogSample.ts | 29 +- .../certificatesRetrieveCertChainSample.ts | 33 +- ...tesRetrieveProofOfPossessionNonceSample.ts | 38 +- .../deploymentsCreateOrUpdateSample.ts | 45 +- .../samples-dev/deploymentsDeleteSample.ts | 42 +- .../samples-dev/deploymentsGetSample.ts | 39 +- .../deploymentsListByDeviceGroupSample.ts | 37 +- .../deviceGroupsClaimDevicesSample.ts | 46 +- .../deviceGroupsCountDevicesSample.ts | 36 +- .../deviceGroupsCreateOrUpdateSample.ts | 54 +- .../samples-dev/deviceGroupsDeleteSample.ts | 39 +- .../samples-dev/deviceGroupsGetSample.ts | 36 +- .../deviceGroupsListByProductSample.ts | 34 +- .../samples-dev/deviceGroupsUpdateSample.ts | 42 +- .../devicesCreateOrUpdateSample.ts | 46 +- .../samples-dev/devicesDeleteSample.ts | 43 +- .../devicesGenerateCapabilityImageSample.ts | 47 +- .../samples-dev/devicesGetSample.ts | 40 +- .../devicesListByDeviceGroupSample.ts | 37 +- .../samples-dev/devicesUpdateSample.ts | 46 +- .../samples-dev/imagesCreateOrUpdateSample.ts | 39 +- .../samples-dev/imagesDeleteSample.ts | 34 +- .../arm-sphere/samples-dev/imagesGetSample.ts | 33 +- .../samples-dev/imagesListByCatalogSample.ts | 29 +- .../samples-dev/operationsListSample.ts | 25 +- .../samples-dev/productsCountDevicesSample.ts | 29 +- .../productsCreateOrUpdateSample.ts | 39 +- .../samples-dev/productsDeleteSample.ts | 34 +- ...oductsGenerateDefaultDeviceGroupsSample.ts | 36 +- .../samples-dev/productsGetSample.ts | 29 +- .../productsListByCatalogSample.ts | 29 +- .../samples-dev/productsUpdateSample.ts | 36 +- .../samples/v1/javascript/README.md | 138 -- .../javascript/catalogsCountDevicesSample.js | 36 - .../catalogsCreateOrUpdateSample.js | 41 - .../v1/javascript/catalogsDeleteSample.js | 36 - .../v1/javascript/catalogsGetSample.js | 36 - .../catalogsListByResourceGroupSample.js | 38 - .../catalogsListBySubscriptionSample.js | 37 - .../catalogsListDeploymentsSample.js | 39 - .../catalogsListDeviceGroupsSample.js | 46 - .../catalogsListDeviceInsightsSample.js | 45 - .../javascript/catalogsListDevicesSample.js | 39 - .../v1/javascript/catalogsUpdateSample.js | 37 - .../javascript/catalogsUploadImageSample.js | 43 - .../v1/javascript/certificatesGetSample.js | 37 - .../certificatesListByCatalogSample.js | 39 - .../certificatesRetrieveCertChainSample.js | 41 - ...tesRetrieveProofOfPossessionNonceSample.js | 45 - .../deploymentsCreateOrUpdateSample.js | 47 - .../v1/javascript/deploymentsDeleteSample.js | 45 - .../v1/javascript/deploymentsGetSample.js | 45 - .../deploymentsListByDeviceGroupSample.js | 46 - .../deviceGroupsClaimDevicesSample.js | 49 - .../deviceGroupsCountDevicesSample.js | 43 - .../deviceGroupsCreateOrUpdateSample.js | 51 - .../v1/javascript/deviceGroupsDeleteSample.js | 43 - .../v1/javascript/deviceGroupsGetSample.js | 43 - .../deviceGroupsListByProductSample.js | 44 - .../v1/javascript/deviceGroupsUpdateSample.js | 45 - .../javascript/devicesCreateOrUpdateSample.js | 48 - .../v1/javascript/devicesDeleteSample.js | 46 - .../devicesGenerateCapabilityImageSample.js | 50 - .../samples/v1/javascript/devicesGetSample.js | 46 - .../devicesListByDeviceGroupSample.js | 46 - .../v1/javascript/devicesUpdateSample.js | 48 - .../javascript/imagesCreateOrUpdateSample.js | 43 - .../v1/javascript/imagesDeleteSample.js | 37 - .../samples/v1/javascript/imagesGetSample.js | 37 - .../javascript/imagesListByCatalogSample.js | 39 - .../v1/javascript/operationsListSample.js | 37 - .../samples/v1/javascript/package.json | 32 - .../javascript/productsCountDevicesSample.js | 37 - .../productsCreateOrUpdateSample.js | 43 - .../v1/javascript/productsDeleteSample.js | 41 - ...oductsGenerateDefaultDeviceGroupsSample.js | 44 - .../v1/javascript/productsGetSample.js | 37 - .../javascript/productsListByCatalogSample.js | 39 - .../v1/javascript/productsUpdateSample.js | 43 - .../samples/v1/javascript/sample.env | 4 - .../samples/v1/typescript/README.md | 151 -- .../samples/v1/typescript/package.json | 41 - .../samples/v1/typescript/sample.env | 4 - .../src/catalogsCountDevicesSample.ts | 41 - .../src/catalogsCreateOrUpdateSample.ts | 43 - .../v1/typescript/src/catalogsDeleteSample.ts | 41 - .../v1/typescript/src/catalogsGetSample.ts | 38 - .../src/catalogsListByResourceGroupSample.ts | 42 - .../src/catalogsListBySubscriptionSample.ts | 38 - .../src/catalogsListDeploymentsSample.ts | 44 - .../src/catalogsListDeviceGroupsSample.ts | 51 - .../src/catalogsListDeviceInsightsSample.ts | 50 - .../src/catalogsListDevicesSample.ts | 44 - .../v1/typescript/src/catalogsUpdateSample.ts | 43 - .../src/catalogsUploadImageSample.ts | 45 - .../typescript/src/certificatesGetSample.ts | 43 - .../src/certificatesListByCatalogSample.ts | 44 - .../certificatesRetrieveCertChainSample.ts | 43 - ...tesRetrieveProofOfPossessionNonceSample.ts | 50 - .../src/deploymentsCreateOrUpdateSample.ts | 49 - .../typescript/src/deploymentsDeleteSample.ts | 47 - .../v1/typescript/src/deploymentsGetSample.ts | 47 - .../src/deploymentsListByDeviceGroupSample.ts | 48 - .../src/deviceGroupsClaimDevicesSample.ts | 54 - .../src/deviceGroupsCountDevicesSample.ts | 45 - .../src/deviceGroupsCreateOrUpdateSample.ts | 53 - .../src/deviceGroupsDeleteSample.ts | 45 - .../typescript/src/deviceGroupsGetSample.ts | 45 - .../src/deviceGroupsListByProductSample.ts | 46 - .../src/deviceGroupsUpdateSample.ts | 50 - .../src/devicesCreateOrUpdateSample.ts | 50 - .../v1/typescript/src/devicesDeleteSample.ts | 48 - .../devicesGenerateCapabilityImageSample.ts | 55 - .../v1/typescript/src/devicesGetSample.ts | 48 - .../src/devicesListByDeviceGroupSample.ts | 48 - .../v1/typescript/src/devicesUpdateSample.ts | 50 - .../src/imagesCreateOrUpdateSample.ts | 45 - .../v1/typescript/src/imagesDeleteSample.ts | 43 - .../v1/typescript/src/imagesGetSample.ts | 43 - .../src/imagesListByCatalogSample.ts | 44 - .../v1/typescript/src/operationsListSample.ts | 38 - .../src/productsCountDevicesSample.ts | 43 - .../src/productsCreateOrUpdateSample.ts | 45 - .../v1/typescript/src/productsDeleteSample.ts | 43 - ...oductsGenerateDefaultDeviceGroupsSample.ts | 46 - .../v1/typescript/src/productsGetSample.ts | 43 - .../src/productsListByCatalogSample.ts | 44 - .../v1/typescript/src/productsUpdateSample.ts | 45 - .../samples/v1/typescript/tsconfig.json | 17 - .../arm-sphere/src/api/azureSphereContext.ts | 64 + .../arm-sphere/src/api/catalogs/index.ts | 31 + .../arm-sphere/src/api/catalogs/operations.ts | 740 ++++++++ .../arm-sphere/src/api/catalogs/options.ts | 85 + .../arm-sphere/src/api/certificates/index.ts | 15 + .../src/api/certificates/operations.ts | 275 +++ .../src/api/certificates/options.ts | 26 + .../arm-sphere/src/api/deployments/index.ts | 10 + .../src/api/deployments/operations.ts | 325 ++++ .../arm-sphere/src/api/deployments/options.ts | 31 + .../arm-sphere/src/api/deviceGroups/index.ts | 21 + .../src/api/deviceGroups/operations.ts | 512 +++++ .../src/api/deviceGroups/options.ts | 46 + .../arm-sphere/src/api/devices/index.ts | 19 + .../arm-sphere/src/api/devices/operations.ts | 485 +++++ .../arm-sphere/src/api/devices/options.ts | 34 + sdk/sphere/arm-sphere/src/api/images/index.ts | 10 + .../arm-sphere/src/api/images/operations.ts | 266 +++ .../arm-sphere/src/api/images/options.ts | 31 + sdk/sphere/arm-sphere/src/api/index.ts | 8 + .../arm-sphere/src/api/operations/index.ts | 5 + .../src/api/operations/operations.ts | 71 + .../arm-sphere/src/api/operations/options.ts | 7 + .../arm-sphere/src/api/products/index.ts | 21 + .../arm-sphere/src/api/products/operations.ts | 463 +++++ .../arm-sphere/src/api/products/options.ts | 34 + .../arm-sphere/src/azureSphereClient.ts | 74 + .../src/azureSphereManagementClient.ts | 173 -- .../arm-sphere/src/classic/catalogs/index.ts | 196 ++ .../src/classic/certificates/index.ts | 98 + .../src/classic/deployments/index.ts | 143 ++ .../src/classic/deviceGroups/index.ts | 187 ++ .../arm-sphere/src/classic/devices/index.ts | 210 ++ .../arm-sphere/src/classic/images/index.ts | 86 + sdk/sphere/arm-sphere/src/classic/index.ts | 11 + .../src/classic/operations/index.ts | 26 + .../arm-sphere/src/classic/products/index.ts | 138 ++ sdk/sphere/arm-sphere/src/index.ts | 158 +- sdk/sphere/arm-sphere/src/logger.ts | 5 + sdk/sphere/arm-sphere/src/lroImpl.ts | 38 - sdk/sphere/arm-sphere/src/models/index.ts | 1670 +--------------- sdk/sphere/arm-sphere/src/models/mappers.ts | 1691 ----------------- sdk/sphere/arm-sphere/src/models/models.ts | 1399 ++++++++++++++ .../arm-sphere/src/models/parameters.ts | 326 ---- .../arm-sphere/src/operations/catalogs.ts | 1507 --------------- .../arm-sphere/src/operations/certificates.ts | 350 ---- .../arm-sphere/src/operations/deployments.ts | 603 ------ .../arm-sphere/src/operations/deviceGroups.ts | 901 --------- .../arm-sphere/src/operations/devices.ts | 908 --------- .../arm-sphere/src/operations/images.ts | 502 ----- sdk/sphere/arm-sphere/src/operations/index.ts | 16 - .../arm-sphere/src/operations/operations.ts | 149 -- .../arm-sphere/src/operations/products.ts | 874 --------- .../src/operationsInterfaces/catalogs.ts | 223 --- .../src/operationsInterfaces/certificates.ts | 80 - .../src/operationsInterfaces/deployments.ts | 144 -- .../src/operationsInterfaces/deviceGroups.ts | 233 --- .../src/operationsInterfaces/devices.ts | 235 --- .../src/operationsInterfaces/images.ts | 109 -- .../src/operationsInterfaces/index.ts | 16 - .../src/operationsInterfaces/operations.ts | 22 - .../src/operationsInterfaces/products.ts | 186 -- sdk/sphere/arm-sphere/src/pagingHelper.ts | 39 - .../arm-sphere/src/restorePollerHelpers.ts | 262 +++ .../src/static-helpers/pagingHelpers.ts | 241 +++ .../src/static-helpers/pollingHelpers.ts | 126 ++ .../src/static-helpers/urlTemplate.ts | 197 ++ .../arm-sphere/test/public/sampleTest.spec.ts | 20 + .../test/public/utils/recordedClient.ts | 23 + sdk/sphere/arm-sphere/test/snippets.spec.ts | 7 +- .../test/sphere_operations_test.spec.ts | 100 - .../arm-sphere/tsconfig.browser.config.json | 5 +- sdk/sphere/arm-sphere/tsconfig.samples.json | 4 +- sdk/sphere/arm-sphere/tsconfig.test.json | 5 +- sdk/sphere/arm-sphere/tsp-location.yaml | 4 + sdk/sphere/ci.mgmt.yml | 5 +- 238 files changed, 9340 insertions(+), 17107 deletions(-) delete mode 100644 sdk/sphere/arm-sphere/_meta.json delete mode 100644 sdk/sphere/arm-sphere/assets.json create mode 100644 sdk/sphere/arm-sphere/eslint.config.mjs create mode 100644 sdk/sphere/arm-sphere/review/arm-sphere-api-catalogs.api.md create mode 100644 sdk/sphere/arm-sphere/review/arm-sphere-api-certificates.api.md create mode 100644 sdk/sphere/arm-sphere/review/arm-sphere-api-deployments.api.md create mode 100644 sdk/sphere/arm-sphere/review/arm-sphere-api-deviceGroups.api.md create mode 100644 sdk/sphere/arm-sphere/review/arm-sphere-api-devices.api.md create mode 100644 sdk/sphere/arm-sphere/review/arm-sphere-api-images.api.md create mode 100644 sdk/sphere/arm-sphere/review/arm-sphere-api-operations.api.md create mode 100644 sdk/sphere/arm-sphere/review/arm-sphere-api-products.api.md create mode 100644 sdk/sphere/arm-sphere/review/arm-sphere-api.api.md create mode 100644 sdk/sphere/arm-sphere/review/arm-sphere-models.api.md delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/README.md delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/catalogsCountDevicesSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/catalogsCreateOrUpdateSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/catalogsDeleteSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/catalogsGetSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListByResourceGroupSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListBySubscriptionSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeploymentsSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeviceGroupsSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeviceInsightsSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDevicesSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/catalogsUpdateSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/catalogsUploadImageSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/certificatesGetSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/certificatesListByCatalogSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/certificatesRetrieveCertChainSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/certificatesRetrieveProofOfPossessionNonceSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsCreateOrUpdateSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsDeleteSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsGetSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsListByDeviceGroupSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsClaimDevicesSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsCountDevicesSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsCreateOrUpdateSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsDeleteSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsGetSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsListByProductSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsUpdateSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/devicesCreateOrUpdateSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/devicesDeleteSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/devicesGenerateCapabilityImageSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/devicesGetSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/devicesListByDeviceGroupSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/devicesUpdateSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/imagesCreateOrUpdateSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/imagesDeleteSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/imagesGetSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/imagesListByCatalogSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/operationsListSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/package.json delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/productsCountDevicesSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/productsCreateOrUpdateSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/productsDeleteSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/productsGenerateDefaultDeviceGroupsSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/productsGetSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/productsListByCatalogSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/productsUpdateSample.js delete mode 100644 sdk/sphere/arm-sphere/samples/v1/javascript/sample.env delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/README.md delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/package.json delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/sample.env delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsCountDevicesSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsCreateOrUpdateSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsDeleteSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsGetSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListByResourceGroupSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListBySubscriptionSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeploymentsSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeviceGroupsSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeviceInsightsSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDevicesSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsUpdateSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsUploadImageSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesGetSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesListByCatalogSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesRetrieveCertChainSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesRetrieveProofOfPossessionNonceSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsCreateOrUpdateSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsDeleteSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsGetSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsListByDeviceGroupSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsClaimDevicesSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsCountDevicesSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsCreateOrUpdateSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsDeleteSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsGetSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsListByProductSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsUpdateSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesCreateOrUpdateSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesDeleteSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesGenerateCapabilityImageSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesGetSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesListByDeviceGroupSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesUpdateSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesCreateOrUpdateSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesDeleteSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesGetSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesListByCatalogSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/operationsListSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/productsCountDevicesSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/productsCreateOrUpdateSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/productsDeleteSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/productsGenerateDefaultDeviceGroupsSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/productsGetSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/productsListByCatalogSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/src/productsUpdateSample.ts delete mode 100644 sdk/sphere/arm-sphere/samples/v1/typescript/tsconfig.json create mode 100644 sdk/sphere/arm-sphere/src/api/azureSphereContext.ts create mode 100644 sdk/sphere/arm-sphere/src/api/catalogs/index.ts create mode 100644 sdk/sphere/arm-sphere/src/api/catalogs/operations.ts create mode 100644 sdk/sphere/arm-sphere/src/api/catalogs/options.ts create mode 100644 sdk/sphere/arm-sphere/src/api/certificates/index.ts create mode 100644 sdk/sphere/arm-sphere/src/api/certificates/operations.ts create mode 100644 sdk/sphere/arm-sphere/src/api/certificates/options.ts create mode 100644 sdk/sphere/arm-sphere/src/api/deployments/index.ts create mode 100644 sdk/sphere/arm-sphere/src/api/deployments/operations.ts create mode 100644 sdk/sphere/arm-sphere/src/api/deployments/options.ts create mode 100644 sdk/sphere/arm-sphere/src/api/deviceGroups/index.ts create mode 100644 sdk/sphere/arm-sphere/src/api/deviceGroups/operations.ts create mode 100644 sdk/sphere/arm-sphere/src/api/deviceGroups/options.ts create mode 100644 sdk/sphere/arm-sphere/src/api/devices/index.ts create mode 100644 sdk/sphere/arm-sphere/src/api/devices/operations.ts create mode 100644 sdk/sphere/arm-sphere/src/api/devices/options.ts create mode 100644 sdk/sphere/arm-sphere/src/api/images/index.ts create mode 100644 sdk/sphere/arm-sphere/src/api/images/operations.ts create mode 100644 sdk/sphere/arm-sphere/src/api/images/options.ts create mode 100644 sdk/sphere/arm-sphere/src/api/index.ts create mode 100644 sdk/sphere/arm-sphere/src/api/operations/index.ts create mode 100644 sdk/sphere/arm-sphere/src/api/operations/operations.ts create mode 100644 sdk/sphere/arm-sphere/src/api/operations/options.ts create mode 100644 sdk/sphere/arm-sphere/src/api/products/index.ts create mode 100644 sdk/sphere/arm-sphere/src/api/products/operations.ts create mode 100644 sdk/sphere/arm-sphere/src/api/products/options.ts create mode 100644 sdk/sphere/arm-sphere/src/azureSphereClient.ts delete mode 100644 sdk/sphere/arm-sphere/src/azureSphereManagementClient.ts create mode 100644 sdk/sphere/arm-sphere/src/classic/catalogs/index.ts create mode 100644 sdk/sphere/arm-sphere/src/classic/certificates/index.ts create mode 100644 sdk/sphere/arm-sphere/src/classic/deployments/index.ts create mode 100644 sdk/sphere/arm-sphere/src/classic/deviceGroups/index.ts create mode 100644 sdk/sphere/arm-sphere/src/classic/devices/index.ts create mode 100644 sdk/sphere/arm-sphere/src/classic/images/index.ts create mode 100644 sdk/sphere/arm-sphere/src/classic/index.ts create mode 100644 sdk/sphere/arm-sphere/src/classic/operations/index.ts create mode 100644 sdk/sphere/arm-sphere/src/classic/products/index.ts create mode 100644 sdk/sphere/arm-sphere/src/logger.ts delete mode 100644 sdk/sphere/arm-sphere/src/lroImpl.ts delete mode 100644 sdk/sphere/arm-sphere/src/models/mappers.ts create mode 100644 sdk/sphere/arm-sphere/src/models/models.ts delete mode 100644 sdk/sphere/arm-sphere/src/models/parameters.ts delete mode 100644 sdk/sphere/arm-sphere/src/operations/catalogs.ts delete mode 100644 sdk/sphere/arm-sphere/src/operations/certificates.ts delete mode 100644 sdk/sphere/arm-sphere/src/operations/deployments.ts delete mode 100644 sdk/sphere/arm-sphere/src/operations/deviceGroups.ts delete mode 100644 sdk/sphere/arm-sphere/src/operations/devices.ts delete mode 100644 sdk/sphere/arm-sphere/src/operations/images.ts delete mode 100644 sdk/sphere/arm-sphere/src/operations/index.ts delete mode 100644 sdk/sphere/arm-sphere/src/operations/operations.ts delete mode 100644 sdk/sphere/arm-sphere/src/operations/products.ts delete mode 100644 sdk/sphere/arm-sphere/src/operationsInterfaces/catalogs.ts delete mode 100644 sdk/sphere/arm-sphere/src/operationsInterfaces/certificates.ts delete mode 100644 sdk/sphere/arm-sphere/src/operationsInterfaces/deployments.ts delete mode 100644 sdk/sphere/arm-sphere/src/operationsInterfaces/deviceGroups.ts delete mode 100644 sdk/sphere/arm-sphere/src/operationsInterfaces/devices.ts delete mode 100644 sdk/sphere/arm-sphere/src/operationsInterfaces/images.ts delete mode 100644 sdk/sphere/arm-sphere/src/operationsInterfaces/index.ts delete mode 100644 sdk/sphere/arm-sphere/src/operationsInterfaces/operations.ts delete mode 100644 sdk/sphere/arm-sphere/src/operationsInterfaces/products.ts delete mode 100644 sdk/sphere/arm-sphere/src/pagingHelper.ts create mode 100644 sdk/sphere/arm-sphere/src/restorePollerHelpers.ts create mode 100644 sdk/sphere/arm-sphere/src/static-helpers/pagingHelpers.ts create mode 100644 sdk/sphere/arm-sphere/src/static-helpers/pollingHelpers.ts create mode 100644 sdk/sphere/arm-sphere/src/static-helpers/urlTemplate.ts create mode 100644 sdk/sphere/arm-sphere/test/public/sampleTest.spec.ts create mode 100644 sdk/sphere/arm-sphere/test/public/utils/recordedClient.ts delete mode 100644 sdk/sphere/arm-sphere/test/sphere_operations_test.spec.ts create mode 100644 sdk/sphere/arm-sphere/tsp-location.yaml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index a55db8fb8c8c..d65aa5b9453d 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -3321,7 +3321,7 @@ packages: version: 0.0.0 '@rush-temp/arm-sphere@file:projects/arm-sphere.tgz': - resolution: {integrity: sha512-GJ9TcO/4576y2itu7jEW2ayqVPAKbmeNqrwo0e1+ixtxdTHXvVClHlDbPqDN3CozykJOTdT2hYDkQ7C0dHW05w==, tarball: file:projects/arm-sphere.tgz} + resolution: {integrity: sha512-iGYcYArLBBJk9IBAV0qCSjrBl6MJgrAJxL8bkL1HV+zn/cgj1QphYoC9Xmbio28zYqRlPP0n6tPDOBGK1m7KYA==, tarball: file:projects/arm-sphere.tgz} version: 0.0.0 '@rush-temp/arm-springappdiscovery@file:projects/arm-springappdiscovery.tgz': @@ -17253,11 +17253,11 @@ snapshots: '@rush-temp/arm-sphere@file:projects/arm-sphere.tgz(@types/debug@4.1.12)(tsx@4.19.4)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(yaml@2.7.1)': dependencies: - '@azure/core-lro': 2.7.2 '@types/node': 18.19.100 '@vitest/browser': 3.1.3(playwright@1.52.0)(vite@6.3.5(@types/node@22.7.9)(tsx@4.19.4)(yaml@2.7.1))(vitest@3.1.3) '@vitest/coverage-istanbul': 3.1.3(vitest@3.1.3) dotenv: 16.5.0 + eslint: 9.26.0 playwright: 1.52.0 tslib: 2.8.1 typescript: 5.8.3 diff --git a/sdk/sphere/arm-sphere/CHANGELOG.md b/sdk/sphere/arm-sphere/CHANGELOG.md index f549bb2cf703..bfd8288ebe04 100644 --- a/sdk/sphere/arm-sphere/CHANGELOG.md +++ b/sdk/sphere/arm-sphere/CHANGELOG.md @@ -1,15 +1,105 @@ # Release History - -## 1.0.1 (Unreleased) - + +## 2.0.0 (2025-05-13) + ### Features Added -### Breaking Changes + - Added operation CatalogsOperations.createOrUpdate + - Added operation CatalogsOperations.delete + - Added operation CatalogsOperations.uploadImage + - Added operation DeploymentsOperations.createOrUpdate + - Added operation DeploymentsOperations.delete + - Added operation DeviceGroupsOperations.claimDevices + - Added operation DeviceGroupsOperations.createOrUpdate + - Added operation DeviceGroupsOperations.delete + - Added operation DeviceGroupsOperations.update + - Added operation DevicesOperations.createOrUpdate + - Added operation DevicesOperations.delete + - Added operation DevicesOperations.generateCapabilityImage + - Added operation DevicesOperations.update + - Added operation ImagesOperations.createOrUpdate + - Added operation ImagesOperations.delete + - Added operation ProductsOperations.createOrUpdate + - Added operation ProductsOperations.delete + - Added operation ProductsOperations.generateDefaultDeviceGroups + - Added operation ProductsOperations.update + - Added Interface AzureSphereClientOptionalParams + - Added Interface PagedAsyncIterableIterator + - Added Interface PageSettings + - Added Interface RestorePollerOptions + - Added Class AzureSphereClient + - Added Type Alias ContinuablePage + - Added Enum KnownVersions + - Added function restorePoller -### Bugs Fixed - -### Other Changes +### Breaking Changes + - Removed operation Catalogs.beginCreateOrUpdate + - Removed operation Catalogs.beginCreateOrUpdateAndWait + - Removed operation Catalogs.beginDelete + - Removed operation Catalogs.beginDeleteAndWait + - Removed operation Catalogs.beginUploadImage + - Removed operation Catalogs.beginUploadImageAndWait + - Removed operation Deployments.beginCreateOrUpdate + - Removed operation Deployments.beginCreateOrUpdateAndWait + - Removed operation Deployments.beginDelete + - Removed operation Deployments.beginDeleteAndWait + - Removed operation DeviceGroups.beginClaimDevices + - Removed operation DeviceGroups.beginClaimDevicesAndWait + - Removed operation DeviceGroups.beginCreateOrUpdate + - Removed operation DeviceGroups.beginCreateOrUpdateAndWait + - Removed operation DeviceGroups.beginDelete + - Removed operation DeviceGroups.beginDeleteAndWait + - Removed operation DeviceGroups.beginUpdate + - Removed operation DeviceGroups.beginUpdateAndWait + - Removed operation Devices.beginCreateOrUpdate + - Removed operation Devices.beginCreateOrUpdateAndWait + - Removed operation Devices.beginDelete + - Removed operation Devices.beginDeleteAndWait + - Removed operation Devices.beginGenerateCapabilityImage + - Removed operation Devices.beginGenerateCapabilityImageAndWait + - Removed operation Devices.beginUpdate + - Removed operation Devices.beginUpdateAndWait + - Removed operation Images.beginCreateOrUpdate + - Removed operation Images.beginCreateOrUpdateAndWait + - Removed operation Images.beginDelete + - Removed operation Images.beginDeleteAndWait + - Removed operation Products.beginCreateOrUpdate + - Removed operation Products.beginCreateOrUpdateAndWait + - Removed operation Products.beginDelete + - Removed operation Products.beginDeleteAndWait + - Removed operation Products.beginUpdate + - Removed operation Products.beginUpdateAndWait + - Removed operation Products.listGenerateDefaultDeviceGroups + - Deleted Class AzureSphereManagementClient + - Interface CatalogsCreateOrUpdateOptionalParams no longer has parameter resumeFrom + - Interface CatalogsDeleteOptionalParams no longer has parameter resumeFrom + - Interface CatalogsUploadImageOptionalParams no longer has parameter resumeFrom + - Interface DeploymentsCreateOrUpdateOptionalParams no longer has parameter resumeFrom + - Interface DeploymentsDeleteOptionalParams no longer has parameter resumeFrom + - Interface DeviceGroupsClaimDevicesOptionalParams no longer has parameter resumeFrom + - Interface DeviceGroupsCreateOrUpdateOptionalParams no longer has parameter resumeFrom + - Interface DeviceGroupsDeleteOptionalParams no longer has parameter resumeFrom + - Interface DeviceGroupsUpdateOptionalParams no longer has parameter resumeFrom + - Interface DevicesCreateOrUpdateOptionalParams no longer has parameter resumeFrom + - Interface DevicesDeleteOptionalParams no longer has parameter resumeFrom + - Interface DevicesGenerateCapabilityImageOptionalParams no longer has parameter resumeFrom + - Interface DevicesUpdateOptionalParams no longer has parameter resumeFrom + - Interface ImagesCreateOrUpdateOptionalParams no longer has parameter resumeFrom + - Interface ImagesDeleteOptionalParams no longer has parameter resumeFrom + - Interface ProductsCreateOrUpdateOptionalParams no longer has parameter resumeFrom + - Interface ProductsDeleteOptionalParams no longer has parameter resumeFrom + - Interface ProductsUpdateOptionalParams no longer has parameter resumeFrom + - Type of parameter tags of interface CatalogUpdate is changed from { + [propertyName: string]: string; + } to Record + - Type of parameter info of interface ErrorAdditionalInfo is changed from Record to Record + - Type of parameter tags of interface TrackedResource is changed from { + [propertyName: string]: string; + } to Record + - Removed function getContinuationToken + + ## 1.0.0 (2024-03-26) The package of @azure/arm-sphere is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ). diff --git a/sdk/sphere/arm-sphere/LICENSE b/sdk/sphere/arm-sphere/LICENSE index b2f52a2bad4e..63447fd8bbbf 100644 --- a/sdk/sphere/arm-sphere/LICENSE +++ b/sdk/sphere/arm-sphere/LICENSE @@ -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/sphere/arm-sphere/README.md b/sdk/sphere/arm-sphere/README.md index f0f3d96334e5..3577e9ff5e2f 100644 --- a/sdk/sphere/arm-sphere/README.md +++ b/sdk/sphere/arm-sphere/README.md @@ -1,13 +1,15 @@ -# AzureSphereManagement client library for JavaScript +# AzureSphereProvider client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for AzureSphereManagement client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for AzureSphereProvider client. Azure Sphere resource management API. -[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/sphere/arm-sphere) | -[Package (NPM)](https://www.npmjs.com/package/@azure/arm-sphere) | -[API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-sphere) | -[Samples](https://github.com/Azure-Samples/azure-samples-js-management) +Key links: + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/sphere/arm-sphere) +- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-sphere) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-sphere?view=azure-node-preview) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/sphere/arm-sphere/samples) ## Getting started @@ -24,16 +26,16 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@azure/arm-sphere` package -Install the AzureSphereManagement client library for JavaScript with `npm`: +Install the AzureSphereProvider client library for JavaScript with `npm`: ```bash npm install @azure/arm-sphere ``` -### Create and authenticate a `AzureSphereManagementClient` +### Create and authenticate a `AzureSphereClient` -To create a client object to access the AzureSphereManagement API, you will need the `endpoint` of your AzureSphereManagement resource and a `credential`. The AzureSphereManagement client can use Azure Active Directory credentials to authenticate. -You can find the endpoint for your AzureSphereManagement resource in the [Azure Portal][azure_portal]. +To create a client object to access the AzureSphereProvider API, you will need the `endpoint` of your AzureSphereProvider resource and a `credential`. The AzureSphereProvider client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your AzureSphereProvider resource in the [Azure Portal][azure_portal]. You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). @@ -43,44 +45,42 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below npm install @azure/identity ``` -You will also need to **register a new AAD application and grant access to AzureSphereManagement** 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`. +You will also need to **register a new AAD application and grant access to AzureSphereProvider** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). Using Node.js and Node-like environments, you can use the `DefaultAzureCredential` class to authenticate the client. - + ```ts snippet:ReadmeSampleCreateClient_Node -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; const subscriptionId = "00000000-0000-0000-0000-000000000000"; -const client = new AzureSphereManagementClient(new DefaultAzureCredential(), subscriptionId); +const client = new AzureSphereClient(new DefaultAzureCredential(), subscriptionId); ``` - + For browser environments, use the `InteractiveBrowserCredential` from the `@azure/identity` package to authenticate. - + ```ts snippet:ReadmeSampleCreateClient_Browser import { InteractiveBrowserCredential } from "@azure/identity"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +import { AzureSphereClient } from "@azure/arm-sphere"; -const subscriptionId = "00000000-0000-0000-0000-000000000000"; const credential = new InteractiveBrowserCredential({ tenantId: "", - clientId: "", -}); -const client = new AzureSphereManagementClient(credential, subscriptionId); + clientId: "" + }); +const client = new AzureSphereClient(credential, subscriptionId); ``` -### JavaScript Bundle +### JavaScript Bundle To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). ## Key concepts -### AzureSphereManagementClient +### AzureSphereClient -`AzureSphereManagementClient` is the primary interface for developers using the AzureSphereManagement client library. Explore the methods on this client object to understand the different features of the AzureSphereManagement service that you can access. +`AzureSphereClient` is the primary interface for developers using the AzureSphereProvider client library. Explore the methods on this client object to understand the different features of the AzureSphereProvider service that you can access. ## Troubleshooting @@ -98,7 +98,7 @@ For more detailed instructions on how to enable logs, you can look at the [@azur ## 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. +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/sphere/arm-sphere/samples) directory for detailed examples on how to use this library. ## Contributing @@ -108,10 +108,6 @@ If you'd like to contribute to this library, please read the [contributing guide - [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) - - -[azure_cli]: https://learn.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 diff --git a/sdk/sphere/arm-sphere/_meta.json b/sdk/sphere/arm-sphere/_meta.json deleted file mode 100644 index 6ce5ac7d2d14..000000000000 --- a/sdk/sphere/arm-sphere/_meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "commit": "589cb3afdc76fe9a989ef36952eec816906d481f", - "readme": "specification/sphere/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\sphere\\resource-manager\\readme.md --use=@autorest/typescript@6.0.18 --generate-sample=true", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.4", - "use": "@autorest/typescript@6.0.18" -} \ No newline at end of file diff --git a/sdk/sphere/arm-sphere/assets.json b/sdk/sphere/arm-sphere/assets.json deleted file mode 100644 index d4ef87d6ae43..000000000000 --- a/sdk/sphere/arm-sphere/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "js", - "TagPrefix": "js/sphere/arm-sphere", - "Tag": "js/sphere/arm-sphere_af30997bec" -} diff --git a/sdk/sphere/arm-sphere/eslint.config.mjs b/sdk/sphere/arm-sphere/eslint.config.mjs new file mode 100644 index 000000000000..6d2f8a5914c3 --- /dev/null +++ b/sdk/sphere/arm-sphere/eslint.config.mjs @@ -0,0 +1,14 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default azsdkEslint.config([ + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn", + }, + }, +]); diff --git a/sdk/sphere/arm-sphere/package.json b/sdk/sphere/arm-sphere/package.json index 71171379dd25..a0ed3ef939b7 100644 --- a/sdk/sphere/arm-sphere/package.json +++ b/sdk/sphere/arm-sphere/package.json @@ -1,114 +1,131 @@ { "name": "@azure/arm-sphere", - "sdk-type": "mgmt", - "author": "Microsoft Corporation", - "description": "A generated SDK for AzureSphereManagementClient.", - "version": "1.0.1", + "version": "2.0.0", + "description": "A generated SDK for AzureSphereClient.", "engines": { "node": ">=18.0.0" }, - "dependencies": { - "@azure/abort-controller": "^2.1.2", - "@azure/core-auth": "^1.9.0", - "@azure/core-client": "^1.9.2", - "@azure/core-lro": "^2.5.4", - "@azure/core-paging": "^1.6.2", - "@azure/core-rest-pipeline": "^1.19.0", - "tslib": "^2.8.1" + "sideEffects": false, + "autoPublish": false, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./api/devices": "./src/api/devices/index.ts", + "./api/deployments": "./src/api/deployments/index.ts", + "./api/deviceGroups": "./src/api/deviceGroups/index.ts", + "./api/products": "./src/api/products/index.ts", + "./api/images": "./src/api/images/index.ts", + "./api/certificates": "./src/api/certificates/index.ts", + "./api/catalogs": "./src/api/catalogs/index.ts", + "./api/operations": "./src/api/operations/index.ts", + "./models": "./src/models/index.ts" + }, + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], + "selfLink": false, + "project": "./tsconfig.src.json" }, + "type": "module", "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/commonjs/index.js", - "module": "./dist/esm/index.js", - "types": "./dist/commonjs/index.d.ts", + "files": [ + "dist/", + "README.md", + "LICENSE", + "review/", + "CHANGELOG.md" + ], + "sdk-type": "mgmt", + "repository": "github:Azure/azure-sdk-for-js", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/sphere/arm-sphere/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/azureSphereContext.ts", + "prefix": "userAgentInfo" + } + ] + }, + "dependencies": { + "@azure-rest/core-client": "^2.3.1", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.9.0", + "@azure/core-lro": "^3.1.0", + "@azure/core-rest-pipeline": "^1.20.0", + "@azure/core-util": "^1.12.0", + "@azure/logger": "^1.2.0", + "tslib": "^2.8.1" + }, "devDependencies": { "@azure-tools/test-credential": "^2.0.0", "@azure-tools/test-recorder": "^4.1.0", "@azure-tools/test-utils-vitest": "^1.0.0", "@azure/dev-tool": "^1.0.0", - "@azure/identity": "^4.6.0", - "@azure/logger": "^1.1.4", + "@azure/eslint-plugin-azure-sdk": "^3.0.0", + "@azure/identity": "^4.9.1", "@types/node": "^18.0.0", "@vitest/browser": "^3.0.9", "@vitest/coverage-istanbul": "^3.0.9", "dotenv": "^16.0.0", - "playwright": "^1.50.1", + "eslint": "^9.9.0", + "playwright": "^1.52.0", "typescript": "~5.8.2", "vitest": "^3.0.9" }, - "repository": { - "type": "git", - "url": "https://github.com/Azure/azure-sdk-for-js.git" - }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "files": [ - "dist/", - "README.md", - "LICENSE", - "review/", - "CHANGELOG.md" - ], "scripts": { "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", - "build:samples": "echo skipped.", - "check-format": "echo skipped", + "build:samples": "tsc -p tsconfig.samples.json && dev-tool samples publish -f", + "build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test", + "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", "clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "execute:samples": "echo skipped", - "extract-api": "dev-tool run extract-api", - "format": "echo skipped", - "lint": "echo skipped", + "execute:samples": "dev-tool samples run samples-dev", + "extract-api": "dev-tool run vendored rimraf review && dev-tool run extract-api", + "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "generate:client": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:browser": "echo skipped", + "integration-test:node": "echo skipped", + "lint": "eslint package.json api-extractor.json src test", + "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", + "minify": "dev-tool run vendored uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "pack": "npm pack 2>&1", - "prepack": "npm run build", - "test": "npm run test:node && npm run test:browser", + "test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", "test:browser": "echo skipped", "test:node": "dev-tool run test:vitest", - "test:node:esm": "dev-tool run test:vitest --esm", - "update-snippets": "dev-tool run update-snippets" - }, - "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/azureSphereManagementClient.ts", - "prefix": "packageDetails" - } - ] + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser", + "unit-test:node": "dev-tool run test:vitest", + "update-snippets": "dev-tool run update-snippets", + "test:node:esm": "dev-tool run test:vitest --esm" }, - "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/sphere/arm-sphere", "//sampleConfiguration": { - "productName": "", + "productName": "@azure/arm-sphere", "productSlugs": [ "azure" ], "disableDocsMs": true, "apiRefLink": "https://learn.microsoft.com/javascript/api/@azure/arm-sphere?view=azure-node-preview" }, - "type": "module", - "tshy": { - "project": "./tsconfig.src.json", - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts" - }, - "dialects": [ - "esm", - "commonjs" - ], - "esmDialects": [ - "browser", - "react-native" - ], - "selfLink": false - }, "browser": "./dist/browser/index.js", "react-native": "./dist/react-native/index.js", "exports": { @@ -130,6 +147,189 @@ "types": "./dist/commonjs/index.d.ts", "default": "./dist/commonjs/index.js" } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./api/devices": { + "browser": { + "types": "./dist/browser/api/devices/index.d.ts", + "default": "./dist/browser/api/devices/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/devices/index.d.ts", + "default": "./dist/react-native/api/devices/index.js" + }, + "import": { + "types": "./dist/esm/api/devices/index.d.ts", + "default": "./dist/esm/api/devices/index.js" + }, + "require": { + "types": "./dist/commonjs/api/devices/index.d.ts", + "default": "./dist/commonjs/api/devices/index.js" + } + }, + "./api/deployments": { + "browser": { + "types": "./dist/browser/api/deployments/index.d.ts", + "default": "./dist/browser/api/deployments/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/deployments/index.d.ts", + "default": "./dist/react-native/api/deployments/index.js" + }, + "import": { + "types": "./dist/esm/api/deployments/index.d.ts", + "default": "./dist/esm/api/deployments/index.js" + }, + "require": { + "types": "./dist/commonjs/api/deployments/index.d.ts", + "default": "./dist/commonjs/api/deployments/index.js" + } + }, + "./api/deviceGroups": { + "browser": { + "types": "./dist/browser/api/deviceGroups/index.d.ts", + "default": "./dist/browser/api/deviceGroups/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/deviceGroups/index.d.ts", + "default": "./dist/react-native/api/deviceGroups/index.js" + }, + "import": { + "types": "./dist/esm/api/deviceGroups/index.d.ts", + "default": "./dist/esm/api/deviceGroups/index.js" + }, + "require": { + "types": "./dist/commonjs/api/deviceGroups/index.d.ts", + "default": "./dist/commonjs/api/deviceGroups/index.js" + } + }, + "./api/products": { + "browser": { + "types": "./dist/browser/api/products/index.d.ts", + "default": "./dist/browser/api/products/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/products/index.d.ts", + "default": "./dist/react-native/api/products/index.js" + }, + "import": { + "types": "./dist/esm/api/products/index.d.ts", + "default": "./dist/esm/api/products/index.js" + }, + "require": { + "types": "./dist/commonjs/api/products/index.d.ts", + "default": "./dist/commonjs/api/products/index.js" + } + }, + "./api/images": { + "browser": { + "types": "./dist/browser/api/images/index.d.ts", + "default": "./dist/browser/api/images/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/images/index.d.ts", + "default": "./dist/react-native/api/images/index.js" + }, + "import": { + "types": "./dist/esm/api/images/index.d.ts", + "default": "./dist/esm/api/images/index.js" + }, + "require": { + "types": "./dist/commonjs/api/images/index.d.ts", + "default": "./dist/commonjs/api/images/index.js" + } + }, + "./api/certificates": { + "browser": { + "types": "./dist/browser/api/certificates/index.d.ts", + "default": "./dist/browser/api/certificates/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/certificates/index.d.ts", + "default": "./dist/react-native/api/certificates/index.js" + }, + "import": { + "types": "./dist/esm/api/certificates/index.d.ts", + "default": "./dist/esm/api/certificates/index.js" + }, + "require": { + "types": "./dist/commonjs/api/certificates/index.d.ts", + "default": "./dist/commonjs/api/certificates/index.js" + } + }, + "./api/catalogs": { + "browser": { + "types": "./dist/browser/api/catalogs/index.d.ts", + "default": "./dist/browser/api/catalogs/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/catalogs/index.d.ts", + "default": "./dist/react-native/api/catalogs/index.js" + }, + "import": { + "types": "./dist/esm/api/catalogs/index.d.ts", + "default": "./dist/esm/api/catalogs/index.js" + }, + "require": { + "types": "./dist/commonjs/api/catalogs/index.d.ts", + "default": "./dist/commonjs/api/catalogs/index.js" + } + }, + "./api/operations": { + "browser": { + "types": "./dist/browser/api/operations/index.d.ts", + "default": "./dist/browser/api/operations/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/operations/index.d.ts", + "default": "./dist/react-native/api/operations/index.js" + }, + "import": { + "types": "./dist/esm/api/operations/index.d.ts", + "default": "./dist/esm/api/operations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/operations/index.d.ts", + "default": "./dist/commonjs/api/operations/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } } - } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" } diff --git a/sdk/sphere/arm-sphere/review/arm-sphere-api-catalogs.api.md b/sdk/sphere/arm-sphere/review/arm-sphere-api-catalogs.api.md new file mode 100644 index 000000000000..e265a50c130d --- /dev/null +++ b/sdk/sphere/arm-sphere/review/arm-sphere-api-catalogs.api.md @@ -0,0 +1,117 @@ +## API Report File for "@azure/arm-sphere" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: AzureSphereContext, resourceGroupName: string, catalogName: string, options?: CatalogsDeleteOptionalParams): PollerLike, void>; + +// @public +export interface CatalogsCountDevicesOptionalParams extends OperationOptions { +} + +// @public +export interface CatalogsCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface CatalogsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface CatalogsGetOptionalParams extends OperationOptions { +} + +// @public +export interface CatalogsListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface CatalogsListBySubscriptionOptionalParams extends OperationOptions { +} + +// @public +export interface CatalogsListDeploymentsOptionalParams extends OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export interface CatalogsListDeviceGroupsOptionalParams extends OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export interface CatalogsListDeviceInsightsOptionalParams extends OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export interface CatalogsListDevicesOptionalParams extends OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export interface CatalogsUpdateOptionalParams extends OperationOptions { +} + +// @public +export interface CatalogsUploadImageOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function countDevices(context: AzureSphereContext, resourceGroupName: string, catalogName: string, options?: CatalogsCountDevicesOptionalParams): Promise; + +// @public +export function createOrUpdate(context: AzureSphereContext, resourceGroupName: string, catalogName: string, resource: Catalog, options?: CatalogsCreateOrUpdateOptionalParams): PollerLike, Catalog>; + +// @public +export function get(context: AzureSphereContext, resourceGroupName: string, catalogName: string, options?: CatalogsGetOptionalParams): Promise; + +// @public +export function listByResourceGroup(context: AzureSphereContext, resourceGroupName: string, options?: CatalogsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listBySubscription(context: AzureSphereContext, options?: CatalogsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listDeployments(context: AzureSphereContext, resourceGroupName: string, catalogName: string, options?: CatalogsListDeploymentsOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listDeviceGroups(context: AzureSphereContext, resourceGroupName: string, catalogName: string, listDeviceGroupsRequest: ListDeviceGroupsRequest, options?: CatalogsListDeviceGroupsOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listDeviceInsights(context: AzureSphereContext, resourceGroupName: string, catalogName: string, options?: CatalogsListDeviceInsightsOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listDevices(context: AzureSphereContext, resourceGroupName: string, catalogName: string, options?: CatalogsListDevicesOptionalParams): PagedAsyncIterableIterator; + +// @public +export function update(context: AzureSphereContext, resourceGroupName: string, catalogName: string, properties: CatalogUpdate, options?: CatalogsUpdateOptionalParams): Promise; + +// @public +export function uploadImage(context: AzureSphereContext, resourceGroupName: string, catalogName: string, uploadImageRequest: Image_2, options?: CatalogsUploadImageOptionalParams): PollerLike, void>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/sphere/arm-sphere/review/arm-sphere-api-certificates.api.md b/sdk/sphere/arm-sphere/review/arm-sphere-api-certificates.api.md new file mode 100644 index 000000000000..9fca9fc368d5 --- /dev/null +++ b/sdk/sphere/arm-sphere/review/arm-sphere-api-certificates.api.md @@ -0,0 +1,44 @@ +## API Report File for "@azure/arm-sphere" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; + +// @public +export interface CertificatesGetOptionalParams extends OperationOptions { +} + +// @public +export interface CertificatesListByCatalogOptionalParams extends OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export interface CertificatesRetrieveCertChainOptionalParams extends OperationOptions { +} + +// @public +export interface CertificatesRetrieveProofOfPossessionNonceOptionalParams extends OperationOptions { +} + +// @public +export function get(context: AzureSphereContext, resourceGroupName: string, catalogName: string, serialNumber: string, options?: CertificatesGetOptionalParams): Promise; + +// @public +export function listByCatalog(context: AzureSphereContext, resourceGroupName: string, catalogName: string, options?: CertificatesListByCatalogOptionalParams): PagedAsyncIterableIterator; + +// @public +export function retrieveCertChain(context: AzureSphereContext, resourceGroupName: string, catalogName: string, serialNumber: string, options?: CertificatesRetrieveCertChainOptionalParams): Promise; + +// @public +export function retrieveProofOfPossessionNonce(context: AzureSphereContext, resourceGroupName: string, catalogName: string, serialNumber: string, proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, options?: CertificatesRetrieveProofOfPossessionNonceOptionalParams): Promise; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/sphere/arm-sphere/review/arm-sphere-api-deployments.api.md b/sdk/sphere/arm-sphere/review/arm-sphere-api-deployments.api.md new file mode 100644 index 000000000000..1dfa50c23fc3 --- /dev/null +++ b/sdk/sphere/arm-sphere/review/arm-sphere-api-deployments.api.md @@ -0,0 +1,48 @@ +## API Report File for "@azure/arm-sphere" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, options?: DeploymentsDeleteOptionalParams): PollerLike, void>; + +// @public +export function createOrUpdate(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, resource: Deployment, options?: DeploymentsCreateOrUpdateOptionalParams): PollerLike, Deployment>; + +// @public +export interface DeploymentsCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DeploymentsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DeploymentsGetOptionalParams extends OperationOptions { +} + +// @public +export interface DeploymentsListByDeviceGroupOptionalParams extends OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export function get(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, options?: DeploymentsGetOptionalParams): Promise; + +// @public +export function listByDeviceGroup(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeploymentsListByDeviceGroupOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/sphere/arm-sphere/review/arm-sphere-api-deviceGroups.api.md b/sdk/sphere/arm-sphere/review/arm-sphere-api-deviceGroups.api.md new file mode 100644 index 000000000000..7742ecb783bb --- /dev/null +++ b/sdk/sphere/arm-sphere/review/arm-sphere-api-deviceGroups.api.md @@ -0,0 +1,71 @@ +## API Report File for "@azure/arm-sphere" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsDeleteOptionalParams): PollerLike, void>; + +// @public +export function claimDevices(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, claimDevicesRequest: ClaimDevicesRequest, options?: DeviceGroupsClaimDevicesOptionalParams): PollerLike, void>; + +// @public +export function countDevices(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsCountDevicesOptionalParams): Promise; + +// @public +export function createOrUpdate(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, resource: DeviceGroup, options?: DeviceGroupsCreateOrUpdateOptionalParams): PollerLike, DeviceGroup>; + +// @public +export interface DeviceGroupsClaimDevicesOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DeviceGroupsCountDevicesOptionalParams extends OperationOptions { +} + +// @public +export interface DeviceGroupsCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DeviceGroupsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DeviceGroupsGetOptionalParams extends OperationOptions { +} + +// @public +export interface DeviceGroupsListByProductOptionalParams extends OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export interface DeviceGroupsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function get(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsGetOptionalParams): Promise; + +// @public +export function listByProduct(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, options?: DeviceGroupsListByProductOptionalParams): PagedAsyncIterableIterator; + +// @public +export function update(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, properties: DeviceGroupUpdate, options?: DeviceGroupsUpdateOptionalParams): PollerLike, DeviceGroup>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/sphere/arm-sphere/review/arm-sphere-api-devices.api.md b/sdk/sphere/arm-sphere/review/arm-sphere-api-devices.api.md new file mode 100644 index 000000000000..51e98a825737 --- /dev/null +++ b/sdk/sphere/arm-sphere/review/arm-sphere-api-devices.api.md @@ -0,0 +1,60 @@ +## API Report File for "@azure/arm-sphere" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, options?: DevicesDeleteOptionalParams): PollerLike, void>; + +// @public +export function createOrUpdate(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, resource: Device, options?: DevicesCreateOrUpdateOptionalParams): PollerLike, Device>; + +// @public +export interface DevicesCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DevicesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DevicesGenerateCapabilityImageOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DevicesGetOptionalParams extends OperationOptions { +} + +// @public +export interface DevicesListByDeviceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface DevicesUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function generateCapabilityImage(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, options?: DevicesGenerateCapabilityImageOptionalParams): PollerLike, SignedCapabilityImageResponse>; + +// @public +export function get(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, options?: DevicesGetOptionalParams): Promise; + +// @public +export function listByDeviceGroup(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DevicesListByDeviceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function update(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, properties: DeviceUpdate, options?: DevicesUpdateOptionalParams): PollerLike, Device>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/sphere/arm-sphere/review/arm-sphere-api-images.api.md b/sdk/sphere/arm-sphere/review/arm-sphere-api-images.api.md new file mode 100644 index 000000000000..7983a618e254 --- /dev/null +++ b/sdk/sphere/arm-sphere/review/arm-sphere-api-images.api.md @@ -0,0 +1,48 @@ +## API Report File for "@azure/arm-sphere" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: AzureSphereContext, resourceGroupName: string, catalogName: string, imageName: string, options?: ImagesDeleteOptionalParams): PollerLike, void>; + +// @public +export function createOrUpdate(context: AzureSphereContext, resourceGroupName: string, catalogName: string, imageName: string, resource: Image_2, options?: ImagesCreateOrUpdateOptionalParams): PollerLike, Image_2>; + +// @public +export function get(context: AzureSphereContext, resourceGroupName: string, catalogName: string, imageName: string, options?: ImagesGetOptionalParams): Promise; + +// @public +export interface ImagesCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface ImagesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface ImagesGetOptionalParams extends OperationOptions { +} + +// @public +export interface ImagesListByCatalogOptionalParams extends OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export function listByCatalog(context: AzureSphereContext, resourceGroupName: string, catalogName: string, options?: ImagesListByCatalogOptionalParams): PagedAsyncIterableIterator; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/sphere/arm-sphere/review/arm-sphere-api-operations.api.md b/sdk/sphere/arm-sphere/review/arm-sphere-api-operations.api.md new file mode 100644 index 000000000000..499bb9418c56 --- /dev/null +++ b/sdk/sphere/arm-sphere/review/arm-sphere-api-operations.api.md @@ -0,0 +1,19 @@ +## API Report File for "@azure/arm-sphere" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function list(context: AzureSphereContext, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface OperationsListOptionalParams extends OperationOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/sphere/arm-sphere/review/arm-sphere-api-products.api.md b/sdk/sphere/arm-sphere/review/arm-sphere-api-products.api.md new file mode 100644 index 000000000000..c1932748b478 --- /dev/null +++ b/sdk/sphere/arm-sphere/review/arm-sphere-api-products.api.md @@ -0,0 +1,66 @@ +## API Report File for "@azure/arm-sphere" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, options?: ProductsDeleteOptionalParams): PollerLike, void>; + +// @public +export function countDevices(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, options?: ProductsCountDevicesOptionalParams): Promise; + +// @public +export function createOrUpdate(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, resource: Product, options?: ProductsCreateOrUpdateOptionalParams): PollerLike, Product>; + +// @public +export function generateDefaultDeviceGroups(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, options?: ProductsGenerateDefaultDeviceGroupsOptionalParams): PagedAsyncIterableIterator; + +// @public +export function get(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, options?: ProductsGetOptionalParams): Promise; + +// @public +export function listByCatalog(context: AzureSphereContext, resourceGroupName: string, catalogName: string, options?: ProductsListByCatalogOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface ProductsCountDevicesOptionalParams extends OperationOptions { +} + +// @public +export interface ProductsCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface ProductsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface ProductsGenerateDefaultDeviceGroupsOptionalParams extends OperationOptions { +} + +// @public +export interface ProductsGetOptionalParams extends OperationOptions { +} + +// @public +export interface ProductsListByCatalogOptionalParams extends OperationOptions { +} + +// @public +export interface ProductsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function update(context: AzureSphereContext, resourceGroupName: string, catalogName: string, productName: string, properties: ProductUpdate, options?: ProductsUpdateOptionalParams): PollerLike, Product>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/sphere/arm-sphere/review/arm-sphere-api.api.md b/sdk/sphere/arm-sphere/review/arm-sphere-api.api.md new file mode 100644 index 000000000000..56e28dd5e7fa --- /dev/null +++ b/sdk/sphere/arm-sphere/review/arm-sphere-api.api.md @@ -0,0 +1,27 @@ +## API Report File for "@azure/arm-sphere" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { ClientOptions } from '@azure-rest/core-client'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export interface AzureSphereClientOptionalParams extends ClientOptions { + apiVersion?: string; +} + +// @public +export interface AzureSphereContext extends Client { + apiVersion: string; + subscriptionId: string; +} + +// @public +export function createAzureSphere(credential: TokenCredential, subscriptionId: string, options?: AzureSphereClientOptionalParams): AzureSphereContext; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/sphere/arm-sphere/review/arm-sphere-models.api.md b/sdk/sphere/arm-sphere/review/arm-sphere-models.api.md new file mode 100644 index 000000000000..a68c45e6207d --- /dev/null +++ b/sdk/sphere/arm-sphere/review/arm-sphere-models.api.md @@ -0,0 +1,405 @@ +## API Report File for "@azure/arm-sphere" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +// @public +export type ActionType = string; + +// @public +export type AllowCrashDumpCollection = string; + +// @public +export type CapabilityType = string; + +// @public +export interface Catalog extends TrackedResource { + properties?: CatalogProperties; +} + +// @public +export interface CatalogProperties { + readonly provisioningState?: ProvisioningState; + readonly tenantId?: string; +} + +// @public +export interface CatalogUpdate { + tags?: Record; +} + +// @public +export interface Certificate extends ProxyResource { + properties?: CertificateProperties; +} + +// @public +export interface CertificateChainResponse { + readonly certificateChain?: string; +} + +// @public +export interface CertificateProperties { + readonly certificate?: string; + readonly expiryUtc?: Date; + readonly notBeforeUtc?: Date; + readonly provisioningState?: ProvisioningState; + readonly status?: CertificateStatus; + readonly subject?: string; + readonly thumbprint?: string; +} + +// @public +export type CertificateStatus = string; + +// @public +export interface ClaimDevicesRequest { + deviceIdentifiers: string[]; +} + +// @public +export interface CountDevicesResponse extends CountElementsResponse { +} + +// @public +export interface CountElementsResponse { + value: number; +} + +// @public +export type CreatedByType = string; + +// @public +export interface Deployment extends ProxyResource { + properties?: DeploymentProperties; +} + +// @public +export interface DeploymentProperties { + deployedImages?: Image_2[]; + readonly deploymentDateUtc?: Date; + deploymentId?: string; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface Device extends ProxyResource { + properties?: DeviceProperties; +} + +// @public +export interface DeviceGroup extends ProxyResource { + properties?: DeviceGroupProperties; +} + +// @public +export interface DeviceGroupProperties { + allowCrashDumpsCollection?: AllowCrashDumpCollection; + description?: string; + readonly hasDeployment?: boolean; + osFeedType?: OSFeedType; + readonly provisioningState?: ProvisioningState; + regionalDataBoundary?: RegionalDataBoundary; + updatePolicy?: UpdatePolicy; +} + +// @public +export interface DeviceGroupUpdate { + properties?: DeviceGroupUpdateProperties; +} + +// @public +export interface DeviceGroupUpdateProperties { + allowCrashDumpsCollection?: AllowCrashDumpCollection; + description?: string; + osFeedType?: OSFeedType; + regionalDataBoundary?: RegionalDataBoundary; + updatePolicy?: UpdatePolicy; +} + +// @public +export interface DeviceInsight { + description: string; + deviceId: string; + endTimestampUtc: Date; + eventCategory: string; + eventClass: string; + eventCount: number; + eventType: string; + startTimestampUtc: Date; +} + +// @public +export interface DeviceProperties { + readonly chipSku?: string; + deviceId?: string; + readonly lastAvailableOsVersion?: string; + readonly lastInstalledOsVersion?: string; + readonly lastOsUpdateUtc?: Date; + readonly lastUpdateRequestUtc?: Date; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface DeviceUpdate { + properties?: DeviceUpdateProperties; +} + +// @public +export interface DeviceUpdateProperties { + deviceGroupId?: string; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export interface GenerateCapabilityImageRequest { + capabilities: CapabilityType[]; +} + +// @public +interface Image_2 extends ProxyResource { + properties?: ImageProperties; +} +export { Image_2 as Image } + +// @public +export interface ImageProperties { + readonly componentId?: string; + readonly description?: string; + image?: string; + imageId?: string; + readonly imageName?: string; + readonly imageType?: ImageType; + readonly provisioningState?: ProvisioningState; + regionalDataBoundary?: RegionalDataBoundary; + readonly uri?: string; +} + +// @public +export type ImageType = string; + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownAllowCrashDumpCollection { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownCapabilityType { + ApplicationDevelopment = "ApplicationDevelopment", + FieldServicing = "FieldServicing" +} + +// @public +export enum KnownCertificateStatus { + Active = "Active", + Expired = "Expired", + Inactive = "Inactive", + Revoked = "Revoked" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownImageType { + Applications = "Applications", + BaseSystemUpdateManifest = "BaseSystemUpdateManifest", + BootManifest = "BootManifest", + CustomerBoardConfig = "CustomerBoardConfig", + CustomerUpdateManifest = "CustomerUpdateManifest", + FirmwareUpdateManifest = "FirmwareUpdateManifest", + FwConfig = "FwConfig", + InvalidImageType = "InvalidImageType", + ManifestSet = "ManifestSet", + NormalWorldDtb = "NormalWorldDtb", + NormalWorldKernel = "NormalWorldKernel", + NormalWorldLoader = "NormalWorldLoader", + Nwfs = "Nwfs", + OneBl = "OneBl", + Other = "Other", + PlutonRuntime = "PlutonRuntime", + Policy = "Policy", + RecoveryManifest = "RecoveryManifest", + RootFs = "RootFs", + SecurityMonitor = "SecurityMonitor", + Services = "Services", + TrustedKeystore = "TrustedKeystore", + UpdateCertStore = "UpdateCertStore", + WifiFirmware = "WifiFirmware" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownOSFeedType { + Retail = "Retail", + RetailEval = "RetailEval" +} + +// @public +export enum KnownProvisioningState { + Accepted = "Accepted", + Canceled = "Canceled", + Deleting = "Deleting", + Failed = "Failed", + Provisioning = "Provisioning", + Succeeded = "Succeeded", + Updating = "Updating" +} + +// @public +export enum KnownRegionalDataBoundary { + EU = "EU", + None = "None" +} + +// @public +export enum KnownUpdatePolicy { + No3RdPartyAppUpdates = "No3rdPartyAppUpdates", + UpdateAll = "UpdateAll" +} + +// @public +export enum KnownVersions { + V20240401 = "2024-04-01" +} + +// @public +export interface ListDeviceGroupsRequest { + deviceGroupName?: string; +} + +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export type Origin = string; + +// @public +export type OSFeedType = string; + +// @public +export interface Product extends ProxyResource { + properties?: ProductProperties; +} + +// @public +export interface ProductProperties { + description?: string; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface ProductUpdate { + properties?: ProductUpdateProperties; +} + +// @public +export interface ProductUpdateProperties { + description?: string; +} + +// @public +export interface ProofOfPossessionNonceRequest { + proofOfPossessionNonce: string; +} + +// @public +export interface ProofOfPossessionNonceResponse extends CertificateProperties { +} + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export type RegionalDataBoundary = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface SignedCapabilityImageResponse { + readonly image?: string; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @public +export type UpdatePolicy = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/sphere/arm-sphere/review/arm-sphere.api.md b/sdk/sphere/arm-sphere/review/arm-sphere.api.md index 06147ece81e6..2fcada2c608a 100644 --- a/sdk/sphere/arm-sphere/review/arm-sphere.api.md +++ b/sdk/sphere/arm-sphere/review/arm-sphere.api.md @@ -4,11 +4,14 @@ ```ts -import * as coreAuth from '@azure/core-auth'; -import * as coreClient from '@azure/core-client'; +import { AbortSignalLike } from '@azure/abort-controller'; +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; import { OperationState } from '@azure/core-lro'; -import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { SimplePollerLike } from '@azure/core-lro'; +import { PathUncheckedResponse } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { PollerLike } from '@azure/core-lro'; +import { TokenCredential } from '@azure/core-auth'; // @public export type ActionType = string; @@ -17,37 +20,22 @@ export type ActionType = string; export type AllowCrashDumpCollection = string; // @public (undocumented) -export class AzureSphereManagementClient extends coreClient.ServiceClient { - // (undocumented) - $host: string; - constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: AzureSphereManagementClientOptionalParams); - // (undocumented) - apiVersion: string; - // (undocumented) - catalogs: Catalogs; - // (undocumented) - certificates: Certificates; - // (undocumented) - deployments: Deployments; - // (undocumented) - deviceGroups: DeviceGroups; - // (undocumented) - devices: Devices; - // (undocumented) - images: Images; - // (undocumented) - operations: Operations; - // (undocumented) - products: Products; - // (undocumented) - subscriptionId: string; -} - -// @public -export interface AzureSphereManagementClientOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; +export class AzureSphereClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: AzureSphereClientOptionalParams); + readonly catalogs: CatalogsOperations; + readonly certificates: CertificatesOperations; + readonly deployments: DeploymentsOperations; + readonly deviceGroups: DeviceGroupsOperations; + readonly devices: DevicesOperations; + readonly images: ImagesOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; + readonly products: ProductsOperations; +} + +// @public +export interface AzureSphereClientOptionalParams extends ClientOptions { apiVersion?: string; - endpoint?: string; } // @public @@ -58,12 +46,6 @@ export interface Catalog extends TrackedResource { properties?: CatalogProperties; } -// @public -export interface CatalogListResult { - readonly nextLink?: string; - value: Catalog[]; -} - // @public export interface CatalogProperties { readonly provisioningState?: ProvisioningState; @@ -71,101 +53,33 @@ export interface CatalogProperties { } // @public -export interface Catalogs { - beginCreateOrUpdate(resourceGroupName: string, catalogName: string, resource: Catalog, options?: CatalogsCreateOrUpdateOptionalParams): Promise, CatalogsCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, catalogName: string, resource: Catalog, options?: CatalogsCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, catalogName: string, options?: CatalogsDeleteOptionalParams): Promise, void>>; - beginDeleteAndWait(resourceGroupName: string, catalogName: string, options?: CatalogsDeleteOptionalParams): Promise; - beginUploadImage(resourceGroupName: string, catalogName: string, uploadImageRequest: Image_2, options?: CatalogsUploadImageOptionalParams): Promise, CatalogsUploadImageResponse>>; - beginUploadImageAndWait(resourceGroupName: string, catalogName: string, uploadImageRequest: Image_2, options?: CatalogsUploadImageOptionalParams): Promise; - countDevices(resourceGroupName: string, catalogName: string, options?: CatalogsCountDevicesOptionalParams): Promise; - get(resourceGroupName: string, catalogName: string, options?: CatalogsGetOptionalParams): Promise; - listByResourceGroup(resourceGroupName: string, options?: CatalogsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; - listBySubscription(options?: CatalogsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; - listDeployments(resourceGroupName: string, catalogName: string, options?: CatalogsListDeploymentsOptionalParams): PagedAsyncIterableIterator; - listDeviceGroups(resourceGroupName: string, catalogName: string, listDeviceGroupsRequest: ListDeviceGroupsRequest, options?: CatalogsListDeviceGroupsOptionalParams): PagedAsyncIterableIterator; - listDeviceInsights(resourceGroupName: string, catalogName: string, options?: CatalogsListDeviceInsightsOptionalParams): PagedAsyncIterableIterator; - listDevices(resourceGroupName: string, catalogName: string, options?: CatalogsListDevicesOptionalParams): PagedAsyncIterableIterator; - update(resourceGroupName: string, catalogName: string, properties: CatalogUpdate, options?: CatalogsUpdateOptionalParams): Promise; -} - -// @public -export interface CatalogsCountDevicesOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type CatalogsCountDevicesResponse = CountDevicesResponse; - -// @public -export interface CatalogsCreateOrUpdateHeaders { - retryAfter?: number; +export interface CatalogsCountDevicesOptionalParams extends OperationOptions { } // @public -export interface CatalogsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface CatalogsCreateOrUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type CatalogsCreateOrUpdateResponse = Catalog; - -// @public -export interface CatalogsDeleteHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface CatalogsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface CatalogsDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export interface CatalogsGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type CatalogsGetResponse = Catalog; - -// @public -export interface CatalogsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type CatalogsListByResourceGroupNextResponse = CatalogListResult; - -// @public -export interface CatalogsListByResourceGroupOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type CatalogsListByResourceGroupResponse = CatalogListResult; - -// @public -export interface CatalogsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +export interface CatalogsGetOptionalParams extends OperationOptions { } // @public -export type CatalogsListBySubscriptionNextResponse = CatalogListResult; - -// @public -export interface CatalogsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +export interface CatalogsListByResourceGroupOptionalParams extends OperationOptions { } // @public -export type CatalogsListBySubscriptionResponse = CatalogListResult; - -// @public -export interface CatalogsListDeploymentsNextOptionalParams extends coreClient.OperationOptions { +export interface CatalogsListBySubscriptionOptionalParams extends OperationOptions { } // @public -export type CatalogsListDeploymentsNextResponse = DeploymentListResult; - -// @public -export interface CatalogsListDeploymentsOptionalParams extends coreClient.OperationOptions { +export interface CatalogsListDeploymentsOptionalParams extends OperationOptions { filter?: string; maxpagesize?: number; skip?: number; @@ -173,17 +87,7 @@ export interface CatalogsListDeploymentsOptionalParams extends coreClient.Operat } // @public -export type CatalogsListDeploymentsResponse = DeploymentListResult; - -// @public -export interface CatalogsListDeviceGroupsNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type CatalogsListDeviceGroupsNextResponse = DeviceGroupListResult; - -// @public -export interface CatalogsListDeviceGroupsOptionalParams extends coreClient.OperationOptions { +export interface CatalogsListDeviceGroupsOptionalParams extends OperationOptions { filter?: string; maxpagesize?: number; skip?: number; @@ -191,17 +95,7 @@ export interface CatalogsListDeviceGroupsOptionalParams extends coreClient.Opera } // @public -export type CatalogsListDeviceGroupsResponse = DeviceGroupListResult; - -// @public -export interface CatalogsListDeviceInsightsNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type CatalogsListDeviceInsightsNextResponse = PagedDeviceInsight; - -// @public -export interface CatalogsListDeviceInsightsOptionalParams extends coreClient.OperationOptions { +export interface CatalogsListDeviceInsightsOptionalParams extends OperationOptions { filter?: string; maxpagesize?: number; skip?: number; @@ -209,17 +103,7 @@ export interface CatalogsListDeviceInsightsOptionalParams extends coreClient.Ope } // @public -export type CatalogsListDeviceInsightsResponse = PagedDeviceInsight; - -// @public -export interface CatalogsListDevicesNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type CatalogsListDevicesNextResponse = DeviceListResult; - -// @public -export interface CatalogsListDevicesOptionalParams extends coreClient.OperationOptions { +export interface CatalogsListDevicesOptionalParams extends OperationOptions { filter?: string; maxpagesize?: number; skip?: number; @@ -227,35 +111,33 @@ export interface CatalogsListDevicesOptionalParams extends coreClient.OperationO } // @public -export type CatalogsListDevicesResponse = DeviceListResult; - -// @public -export interface CatalogsUpdateOptionalParams extends coreClient.OperationOptions { +export interface CatalogsOperations { + countDevices: (resourceGroupName: string, catalogName: string, options?: CatalogsCountDevicesOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, catalogName: string, resource: Catalog, options?: CatalogsCreateOrUpdateOptionalParams) => PollerLike, Catalog>; + delete: (resourceGroupName: string, catalogName: string, options?: CatalogsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, catalogName: string, options?: CatalogsGetOptionalParams) => Promise; + listByResourceGroup: (resourceGroupName: string, options?: CatalogsListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listBySubscription: (options?: CatalogsListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; + listDeployments: (resourceGroupName: string, catalogName: string, options?: CatalogsListDeploymentsOptionalParams) => PagedAsyncIterableIterator; + listDeviceGroups: (resourceGroupName: string, catalogName: string, listDeviceGroupsRequest: ListDeviceGroupsRequest, options?: CatalogsListDeviceGroupsOptionalParams) => PagedAsyncIterableIterator; + listDeviceInsights: (resourceGroupName: string, catalogName: string, options?: CatalogsListDeviceInsightsOptionalParams) => PagedAsyncIterableIterator; + listDevices: (resourceGroupName: string, catalogName: string, options?: CatalogsListDevicesOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, catalogName: string, properties: CatalogUpdate, options?: CatalogsUpdateOptionalParams) => Promise; + uploadImage: (resourceGroupName: string, catalogName: string, uploadImageRequest: Image_2, options?: CatalogsUploadImageOptionalParams) => PollerLike, void>; } // @public -export type CatalogsUpdateResponse = Catalog; - -// @public -export interface CatalogsUploadImageHeaders { - location?: string; - retryAfter?: number; +export interface CatalogsUpdateOptionalParams extends OperationOptions { } // @public -export interface CatalogsUploadImageOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface CatalogsUploadImageOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type CatalogsUploadImageResponse = CatalogsUploadImageHeaders; - // @public export interface CatalogUpdate { - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } // @public @@ -268,12 +150,6 @@ export interface CertificateChainResponse { readonly certificateChain?: string; } -// @public -export interface CertificateListResult { - readonly nextLink?: string; - value: Certificate[]; -} - // @public export interface CertificateProperties { readonly certificate?: string; @@ -286,29 +162,11 @@ export interface CertificateProperties { } // @public -export interface Certificates { - get(resourceGroupName: string, catalogName: string, serialNumber: string, options?: CertificatesGetOptionalParams): Promise; - listByCatalog(resourceGroupName: string, catalogName: string, options?: CertificatesListByCatalogOptionalParams): PagedAsyncIterableIterator; - retrieveCertChain(resourceGroupName: string, catalogName: string, serialNumber: string, options?: CertificatesRetrieveCertChainOptionalParams): Promise; - retrieveProofOfPossessionNonce(resourceGroupName: string, catalogName: string, serialNumber: string, proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, options?: CertificatesRetrieveProofOfPossessionNonceOptionalParams): Promise; -} - -// @public -export interface CertificatesGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type CertificatesGetResponse = Certificate; - -// @public -export interface CertificatesListByCatalogNextOptionalParams extends coreClient.OperationOptions { +export interface CertificatesGetOptionalParams extends OperationOptions { } // @public -export type CertificatesListByCatalogNextResponse = CertificateListResult; - -// @public -export interface CertificatesListByCatalogOptionalParams extends coreClient.OperationOptions { +export interface CertificatesListByCatalogOptionalParams extends OperationOptions { filter?: string; maxpagesize?: number; skip?: number; @@ -316,21 +174,20 @@ export interface CertificatesListByCatalogOptionalParams extends coreClient.Oper } // @public -export type CertificatesListByCatalogResponse = CertificateListResult; - -// @public -export interface CertificatesRetrieveCertChainOptionalParams extends coreClient.OperationOptions { +export interface CertificatesOperations { + get: (resourceGroupName: string, catalogName: string, serialNumber: string, options?: CertificatesGetOptionalParams) => Promise; + listByCatalog: (resourceGroupName: string, catalogName: string, options?: CertificatesListByCatalogOptionalParams) => PagedAsyncIterableIterator; + retrieveCertChain: (resourceGroupName: string, catalogName: string, serialNumber: string, options?: CertificatesRetrieveCertChainOptionalParams) => Promise; + retrieveProofOfPossessionNonce: (resourceGroupName: string, catalogName: string, serialNumber: string, proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, options?: CertificatesRetrieveProofOfPossessionNonceOptionalParams) => Promise; } // @public -export type CertificatesRetrieveCertChainResponse = CertificateChainResponse; - -// @public -export interface CertificatesRetrieveProofOfPossessionNonceOptionalParams extends coreClient.OperationOptions { +export interface CertificatesRetrieveCertChainOptionalParams extends OperationOptions { } // @public -export type CertificatesRetrieveProofOfPossessionNonceResponse = ProofOfPossessionNonceResponse; +export interface CertificatesRetrieveProofOfPossessionNonceOptionalParams extends OperationOptions { +} // @public export type CertificateStatus = string; @@ -341,8 +198,9 @@ export interface ClaimDevicesRequest { } // @public -export interface CountDeviceResponse extends CountElementsResponse { -} +export type ContinuablePage = TPage & { + continuationToken?: string; +}; // @public export interface CountDevicesResponse extends CountElementsResponse { @@ -361,12 +219,6 @@ export interface Deployment extends ProxyResource { properties?: DeploymentProperties; } -// @public -export interface DeploymentListResult { - readonly nextLink?: string; - value: Deployment[]; -} - // @public export interface DeploymentProperties { deployedImages?: Image_2[]; @@ -376,57 +228,21 @@ export interface DeploymentProperties { } // @public -export interface Deployments { - beginCreateOrUpdate(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, resource: Deployment, options?: DeploymentsCreateOrUpdateOptionalParams): Promise, DeploymentsCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, resource: Deployment, options?: DeploymentsCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, options?: DeploymentsDeleteOptionalParams): Promise, void>>; - beginDeleteAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, options?: DeploymentsDeleteOptionalParams): Promise; - get(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, options?: DeploymentsGetOptionalParams): Promise; - listByDeviceGroup(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeploymentsListByDeviceGroupOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface DeploymentsCreateOrUpdateHeaders { - retryAfter?: number; -} - -// @public -export interface DeploymentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DeploymentsCreateOrUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type DeploymentsCreateOrUpdateResponse = Deployment; - -// @public -export interface DeploymentsDeleteHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface DeploymentsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DeploymentsDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export interface DeploymentsGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type DeploymentsGetResponse = Deployment; - -// @public -export interface DeploymentsListByDeviceGroupNextOptionalParams extends coreClient.OperationOptions { +export interface DeploymentsGetOptionalParams extends OperationOptions { } // @public -export type DeploymentsListByDeviceGroupNextResponse = DeploymentListResult; - -// @public -export interface DeploymentsListByDeviceGroupOptionalParams extends coreClient.OperationOptions { +export interface DeploymentsListByDeviceGroupOptionalParams extends OperationOptions { filter?: string; maxpagesize?: number; skip?: number; @@ -434,7 +250,12 @@ export interface DeploymentsListByDeviceGroupOptionalParams extends coreClient.O } // @public -export type DeploymentsListByDeviceGroupResponse = DeploymentListResult; +export interface DeploymentsOperations { + createOrUpdate: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, resource: Deployment, options?: DeploymentsCreateOrUpdateOptionalParams) => PollerLike, Deployment>; + delete: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, options?: DeploymentsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, options?: DeploymentsGetOptionalParams) => Promise; + listByDeviceGroup: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeploymentsListByDeviceGroupOptionalParams) => PagedAsyncIterableIterator; +} // @public export interface Device extends ProxyResource { @@ -446,12 +267,6 @@ export interface DeviceGroup extends ProxyResource { properties?: DeviceGroupProperties; } -// @public -export interface DeviceGroupListResult { - readonly nextLink?: string; - value: DeviceGroup[]; -} - // @public export interface DeviceGroupProperties { allowCrashDumpsCollection?: AllowCrashDumpCollection; @@ -464,84 +279,30 @@ export interface DeviceGroupProperties { } // @public -export interface DeviceGroups { - beginClaimDevices(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, claimDevicesRequest: ClaimDevicesRequest, options?: DeviceGroupsClaimDevicesOptionalParams): Promise, DeviceGroupsClaimDevicesResponse>>; - beginClaimDevicesAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, claimDevicesRequest: ClaimDevicesRequest, options?: DeviceGroupsClaimDevicesOptionalParams): Promise; - beginCreateOrUpdate(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, resource: DeviceGroup, options?: DeviceGroupsCreateOrUpdateOptionalParams): Promise, DeviceGroupsCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, resource: DeviceGroup, options?: DeviceGroupsCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsDeleteOptionalParams): Promise, void>>; - beginDeleteAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, properties: DeviceGroupUpdate, options?: DeviceGroupsUpdateOptionalParams): Promise, DeviceGroupsUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, properties: DeviceGroupUpdate, options?: DeviceGroupsUpdateOptionalParams): Promise; - countDevices(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsCountDevicesOptionalParams): Promise; - get(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsGetOptionalParams): Promise; - listByProduct(resourceGroupName: string, catalogName: string, productName: string, options?: DeviceGroupsListByProductOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface DeviceGroupsClaimDevicesHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface DeviceGroupsClaimDevicesOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DeviceGroupsClaimDevicesOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type DeviceGroupsClaimDevicesResponse = DeviceGroupsClaimDevicesHeaders; - -// @public -export interface DeviceGroupsCountDevicesOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type DeviceGroupsCountDevicesResponse = CountDevicesResponse; - -// @public -export interface DeviceGroupsCreateOrUpdateHeaders { - retryAfter?: number; +export interface DeviceGroupsCountDevicesOptionalParams extends OperationOptions { } // @public -export interface DeviceGroupsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DeviceGroupsCreateOrUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type DeviceGroupsCreateOrUpdateResponse = DeviceGroup; - -// @public -export interface DeviceGroupsDeleteHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface DeviceGroupsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DeviceGroupsDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export interface DeviceGroupsGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type DeviceGroupsGetResponse = DeviceGroup; - -// @public -export interface DeviceGroupsListByProductNextOptionalParams extends coreClient.OperationOptions { +export interface DeviceGroupsGetOptionalParams extends OperationOptions { } // @public -export type DeviceGroupsListByProductNextResponse = DeviceGroupListResult; - -// @public -export interface DeviceGroupsListByProductOptionalParams extends coreClient.OperationOptions { +export interface DeviceGroupsListByProductOptionalParams extends OperationOptions { filter?: string; maxpagesize?: number; skip?: number; @@ -549,23 +310,21 @@ export interface DeviceGroupsListByProductOptionalParams extends coreClient.Oper } // @public -export type DeviceGroupsListByProductResponse = DeviceGroupListResult; - -// @public -export interface DeviceGroupsUpdateHeaders { - location?: string; - retryAfter?: number; +export interface DeviceGroupsOperations { + claimDevices: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, claimDevicesRequest: ClaimDevicesRequest, options?: DeviceGroupsClaimDevicesOptionalParams) => PollerLike, void>; + countDevices: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsCountDevicesOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, resource: DeviceGroup, options?: DeviceGroupsCreateOrUpdateOptionalParams) => PollerLike, DeviceGroup>; + delete: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsGetOptionalParams) => Promise; + listByProduct: (resourceGroupName: string, catalogName: string, productName: string, options?: DeviceGroupsListByProductOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, properties: DeviceGroupUpdate, options?: DeviceGroupsUpdateOptionalParams) => PollerLike, DeviceGroup>; } // @public -export interface DeviceGroupsUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DeviceGroupsUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type DeviceGroupsUpdateResponse = DeviceGroup; - // @public export interface DeviceGroupUpdate { properties?: DeviceGroupUpdateProperties; @@ -592,12 +351,6 @@ export interface DeviceInsight { startTimestampUtc: Date; } -// @public -export interface DeviceListResult { - readonly nextLink?: string; - value: Device[]; -} - // @public export interface DeviceProperties { readonly chipSku?: string; @@ -610,95 +363,43 @@ export interface DeviceProperties { } // @public -export interface Devices { - beginCreateOrUpdate(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, resource: Device, options?: DevicesCreateOrUpdateOptionalParams): Promise, DevicesCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, resource: Device, options?: DevicesCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, options?: DevicesDeleteOptionalParams): Promise, void>>; - beginDeleteAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, options?: DevicesDeleteOptionalParams): Promise; - beginGenerateCapabilityImage(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, options?: DevicesGenerateCapabilityImageOptionalParams): Promise, DevicesGenerateCapabilityImageResponse>>; - beginGenerateCapabilityImageAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, options?: DevicesGenerateCapabilityImageOptionalParams): Promise; - beginUpdate(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, properties: DeviceUpdate, options?: DevicesUpdateOptionalParams): Promise, DevicesUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, properties: DeviceUpdate, options?: DevicesUpdateOptionalParams): Promise; - get(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, options?: DevicesGetOptionalParams): Promise; - listByDeviceGroup(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DevicesListByDeviceGroupOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface DevicesCreateOrUpdateHeaders { - retryAfter?: number; -} - -// @public -export interface DevicesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DevicesCreateOrUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type DevicesCreateOrUpdateResponse = Device; - -// @public -export interface DevicesDeleteHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface DevicesDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DevicesDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export interface DevicesGenerateCapabilityImageHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface DevicesGenerateCapabilityImageOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DevicesGenerateCapabilityImageOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type DevicesGenerateCapabilityImageResponse = SignedCapabilityImageResponse; - -// @public -export interface DevicesGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type DevicesGetResponse = Device; - -// @public -export interface DevicesListByDeviceGroupNextOptionalParams extends coreClient.OperationOptions { +export interface DevicesGetOptionalParams extends OperationOptions { } // @public -export type DevicesListByDeviceGroupNextResponse = DeviceListResult; - -// @public -export interface DevicesListByDeviceGroupOptionalParams extends coreClient.OperationOptions { +export interface DevicesListByDeviceGroupOptionalParams extends OperationOptions { } // @public -export type DevicesListByDeviceGroupResponse = DeviceListResult; - -// @public -export interface DevicesUpdateHeaders { - retryAfter?: number; +export interface DevicesOperations { + createOrUpdate: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, resource: Device, options?: DevicesCreateOrUpdateOptionalParams) => PollerLike, Device>; + delete: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, options?: DevicesDeleteOptionalParams) => PollerLike, void>; + generateCapabilityImage: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, options?: DevicesGenerateCapabilityImageOptionalParams) => PollerLike, SignedCapabilityImageResponse>; + get: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, options?: DevicesGetOptionalParams) => Promise; + listByDeviceGroup: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DevicesListByDeviceGroupOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, properties: DeviceUpdate, options?: DevicesUpdateOptionalParams) => PollerLike, Device>; } // @public -export interface DevicesUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DevicesUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type DevicesUpdateResponse = Device; - // @public export interface DeviceUpdate { properties?: DeviceUpdateProperties; @@ -711,7 +412,7 @@ export interface DeviceUpdateProperties { // @public export interface ErrorAdditionalInfo { - readonly info?: Record; + readonly info?: Record; readonly type?: string; } @@ -734,21 +435,12 @@ export interface GenerateCapabilityImageRequest { capabilities: CapabilityType[]; } -// @public -export function getContinuationToken(page: unknown): string | undefined; - // @public interface Image_2 extends ProxyResource { properties?: ImageProperties; } export { Image_2 as Image } -// @public -export interface ImageListResult { - readonly nextLink?: string; - value: Image_2[]; -} - // @public export interface ImageProperties { readonly componentId?: string; @@ -763,57 +455,21 @@ export interface ImageProperties { } // @public -export interface Images { - beginCreateOrUpdate(resourceGroupName: string, catalogName: string, imageName: string, resource: Image_2, options?: ImagesCreateOrUpdateOptionalParams): Promise, ImagesCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, catalogName: string, imageName: string, resource: Image_2, options?: ImagesCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, catalogName: string, imageName: string, options?: ImagesDeleteOptionalParams): Promise, void>>; - beginDeleteAndWait(resourceGroupName: string, catalogName: string, imageName: string, options?: ImagesDeleteOptionalParams): Promise; - get(resourceGroupName: string, catalogName: string, imageName: string, options?: ImagesGetOptionalParams): Promise; - listByCatalog(resourceGroupName: string, catalogName: string, options?: ImagesListByCatalogOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface ImagesCreateOrUpdateHeaders { - retryAfter?: number; -} - -// @public -export interface ImagesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ImagesCreateOrUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type ImagesCreateOrUpdateResponse = Image_2; - -// @public -export interface ImagesDeleteHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface ImagesDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ImagesDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export interface ImagesGetOptionalParams extends coreClient.OperationOptions { +export interface ImagesGetOptionalParams extends OperationOptions { } // @public -export type ImagesGetResponse = Image_2; - -// @public -export interface ImagesListByCatalogNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ImagesListByCatalogNextResponse = ImageListResult; - -// @public -export interface ImagesListByCatalogOptionalParams extends coreClient.OperationOptions { +export interface ImagesListByCatalogOptionalParams extends OperationOptions { filter?: string; maxpagesize?: number; skip?: number; @@ -821,7 +477,12 @@ export interface ImagesListByCatalogOptionalParams extends coreClient.OperationO } // @public -export type ImagesListByCatalogResponse = ImageListResult; +export interface ImagesOperations { + createOrUpdate: (resourceGroupName: string, catalogName: string, imageName: string, resource: Image_2, options?: ImagesCreateOrUpdateOptionalParams) => PollerLike, Image_2>; + delete: (resourceGroupName: string, catalogName: string, imageName: string, options?: ImagesDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, catalogName: string, imageName: string, options?: ImagesGetOptionalParams) => Promise; + listByCatalog: (resourceGroupName: string, catalogName: string, options?: ImagesListByCatalogOptionalParams) => PagedAsyncIterableIterator; +} // @public export type ImageType = string; @@ -923,6 +584,11 @@ export enum KnownUpdatePolicy { UpdateAll = "UpdateAll" } +// @public +export enum KnownVersions { + V20240401 = "2024-04-01" +} + // @public export interface ListDeviceGroupsRequest { deviceGroupName?: string; @@ -946,30 +612,14 @@ export interface OperationDisplay { } // @public -export interface OperationListResult { - readonly nextLink?: string; - readonly value?: Operation[]; -} - -// @public -export interface Operations { - list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +export interface OperationsListOptionalParams extends OperationOptions { } // @public -export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +export interface OperationsOperations { + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type OperationsListNextResponse = OperationListResult; - -// @public -export interface OperationsListOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type OperationsListResponse = OperationListResult; - // @public export type Origin = string; @@ -977,20 +627,20 @@ export type Origin = string; export type OSFeedType = string; // @public -export interface PagedDeviceInsight { - readonly nextLink?: string; - value: DeviceInsight[]; +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; } // @public -export interface Product extends ProxyResource { - properties?: ProductProperties; +export interface PageSettings { + continuationToken?: string; } // @public -export interface ProductListResult { - readonly nextLink?: string; - value: Product[]; +export interface Product extends ProxyResource { + properties?: ProductProperties; } // @public @@ -1000,102 +650,47 @@ export interface ProductProperties { } // @public -export interface Products { - beginCreateOrUpdate(resourceGroupName: string, catalogName: string, productName: string, resource: Product, options?: ProductsCreateOrUpdateOptionalParams): Promise, ProductsCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, resource: Product, options?: ProductsCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, catalogName: string, productName: string, options?: ProductsDeleteOptionalParams): Promise, void>>; - beginDeleteAndWait(resourceGroupName: string, catalogName: string, productName: string, options?: ProductsDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, catalogName: string, productName: string, properties: ProductUpdate, options?: ProductsUpdateOptionalParams): Promise, ProductsUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, properties: ProductUpdate, options?: ProductsUpdateOptionalParams): Promise; - countDevices(resourceGroupName: string, catalogName: string, productName: string, options?: ProductsCountDevicesOptionalParams): Promise; - get(resourceGroupName: string, catalogName: string, productName: string, options?: ProductsGetOptionalParams): Promise; - listByCatalog(resourceGroupName: string, catalogName: string, options?: ProductsListByCatalogOptionalParams): PagedAsyncIterableIterator; - listGenerateDefaultDeviceGroups(resourceGroupName: string, catalogName: string, productName: string, options?: ProductsGenerateDefaultDeviceGroupsOptionalParams): PagedAsyncIterableIterator; -} - -// @public -export interface ProductsCountDevicesOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ProductsCountDevicesResponse = CountDevicesResponse; - -// @public -export interface ProductsCreateOrUpdateHeaders { - retryAfter?: number; +export interface ProductsCountDevicesOptionalParams extends OperationOptions { } // @public -export interface ProductsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ProductsCreateOrUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type ProductsCreateOrUpdateResponse = Product; - -// @public -export interface ProductsDeleteHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface ProductsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ProductsDeleteOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export interface ProductsGenerateDefaultDeviceGroupsNextOptionalParams extends coreClient.OperationOptions { +export interface ProductsGenerateDefaultDeviceGroupsOptionalParams extends OperationOptions { } // @public -export type ProductsGenerateDefaultDeviceGroupsNextResponse = DeviceGroupListResult; - -// @public -export interface ProductsGenerateDefaultDeviceGroupsOptionalParams extends coreClient.OperationOptions { +export interface ProductsGetOptionalParams extends OperationOptions { } // @public -export type ProductsGenerateDefaultDeviceGroupsResponse = DeviceGroupListResult; - -// @public -export interface ProductsGetOptionalParams extends coreClient.OperationOptions { +export interface ProductsListByCatalogOptionalParams extends OperationOptions { } // @public -export type ProductsGetResponse = Product; - -// @public -export interface ProductsListByCatalogNextOptionalParams extends coreClient.OperationOptions { +export interface ProductsOperations { + countDevices: (resourceGroupName: string, catalogName: string, productName: string, options?: ProductsCountDevicesOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, catalogName: string, productName: string, resource: Product, options?: ProductsCreateOrUpdateOptionalParams) => PollerLike, Product>; + delete: (resourceGroupName: string, catalogName: string, productName: string, options?: ProductsDeleteOptionalParams) => PollerLike, void>; + generateDefaultDeviceGroups: (resourceGroupName: string, catalogName: string, productName: string, options?: ProductsGenerateDefaultDeviceGroupsOptionalParams) => PagedAsyncIterableIterator; + get: (resourceGroupName: string, catalogName: string, productName: string, options?: ProductsGetOptionalParams) => Promise; + listByCatalog: (resourceGroupName: string, catalogName: string, options?: ProductsListByCatalogOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, catalogName: string, productName: string, properties: ProductUpdate, options?: ProductsUpdateOptionalParams) => PollerLike, Product>; } // @public -export type ProductsListByCatalogNextResponse = ProductListResult; - -// @public -export interface ProductsListByCatalogOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type ProductsListByCatalogResponse = ProductListResult; - -// @public -export interface ProductsUpdateHeaders { - location?: string; - retryAfter?: number; -} - -// @public -export interface ProductsUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface ProductsUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } -// @public -export type ProductsUpdateResponse = Product; - // @public export interface ProductUpdate { properties?: ProductUpdateProperties; @@ -1133,6 +728,16 @@ export interface Resource { readonly type?: string; } +// @public +export function restorePoller(client: AzureSphereClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; + +// @public (undocumented) +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; +} + // @public export interface SignedCapabilityImageResponse { readonly image?: string; @@ -1151,9 +756,7 @@ export interface SystemData { // @public export interface TrackedResource extends Resource { location: string; - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } // @public diff --git a/sdk/sphere/arm-sphere/sample.env b/sdk/sphere/arm-sphere/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/sphere/arm-sphere/sample.env +++ b/sdk/sphere/arm-sphere/sample.env @@ -1,4 +1 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/sphere/arm-sphere/samples-dev/catalogsCountDevicesSample.ts b/sdk/sphere/arm-sphere/samples-dev/catalogsCountDevicesSample.ts index 90657cf8f718..c694f4b3d1ee 100644 --- a/sdk/sphere/arm-sphere/samples-dev/catalogsCountDevicesSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/catalogsCountDevicesSample.ts @@ -1,28 +1,20 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Counts devices in catalog. + * This sample demonstrates how to counts devices in catalog. * - * @summary Counts devices in catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesCatalog.json + * @summary counts devices in catalog. + * x-ms-original-file: 2024-04-01/PostCountDevicesCatalog.json */ async function catalogsCountDevices(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.countDevices(resourceGroupName, catalogName); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.catalogs.countDevices("MyResourceGroup1", "MyCatalog1"); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/catalogsCreateOrUpdateSample.ts b/sdk/sphere/arm-sphere/samples-dev/catalogsCreateOrUpdateSample.ts index 7992bfda5642..0824fa0102d9 100644 --- a/sdk/sphere/arm-sphere/samples-dev/catalogsCreateOrUpdateSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/catalogsCreateOrUpdateSample.ts @@ -1,34 +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 type { Catalog } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create a Catalog + * This sample demonstrates how to create a Catalog * - * @summary Create a Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutCatalog.json + * @summary create a Catalog + * x-ms-original-file: 2024-04-01/PutCatalog.json */ async function catalogsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const resource: Catalog = { location: "global" }; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - resource, - ); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.catalogs.createOrUpdate("MyResourceGroup1", "MyCatalog1", { + location: "global", + }); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/catalogsDeleteSample.ts b/sdk/sphere/arm-sphere/samples-dev/catalogsDeleteSample.ts index a40ad6393e1c..5d9334653e19 100644 --- a/sdk/sphere/arm-sphere/samples-dev/catalogsDeleteSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/catalogsDeleteSample.ts @@ -1,29 +1,20 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Delete a Catalog + * This sample demonstrates how to delete a Catalog * - * @summary Delete a Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteCatalog.json + * @summary delete a Catalog + * x-ms-original-file: 2024-04-01/DeleteCatalog.json */ async function catalogsDelete(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.beginDeleteAndWait(resourceGroupName, catalogName); - console.log(result); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + await client.catalogs.delete("MyResourceGroup1", "MyCatalog1"); } async function main(): Promise { diff --git a/sdk/sphere/arm-sphere/samples-dev/catalogsGetSample.ts b/sdk/sphere/arm-sphere/samples-dev/catalogsGetSample.ts index 1d637ceffe3b..58ffd41b05cc 100644 --- a/sdk/sphere/arm-sphere/samples-dev/catalogsGetSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/catalogsGetSample.ts @@ -1,28 +1,20 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get a Catalog + * This sample demonstrates how to get a Catalog * - * @summary Get a Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalog.json + * @summary get a Catalog + * x-ms-original-file: 2024-04-01/GetCatalog.json */ async function catalogsGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.get(resourceGroupName, catalogName); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.catalogs.get("MyResourceGroup1", "MyCatalog1"); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/catalogsListByResourceGroupSample.ts b/sdk/sphere/arm-sphere/samples-dev/catalogsListByResourceGroupSample.ts index 6ef02ea7ace6..02de9bace6b1 100644 --- a/sdk/sphere/arm-sphere/samples-dev/catalogsListByResourceGroupSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/catalogsListByResourceGroupSample.ts @@ -1,30 +1,24 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List Catalog resources by resource group + * This sample demonstrates how to list Catalog resources by resource group * - * @summary List Catalog resources by resource group - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsRG.json + * @summary list Catalog resources by resource group + * x-ms-original-file: 2024-04-01/GetCatalogsRG.json */ async function catalogsListByResourceGroup(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.catalogs.listByResourceGroup(resourceGroupName)) { + for await (const item of client.catalogs.listByResourceGroup("MyResourceGroup1")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/catalogsListBySubscriptionSample.ts b/sdk/sphere/arm-sphere/samples-dev/catalogsListBySubscriptionSample.ts index 50ec509a677a..57d55b0e7ee0 100644 --- a/sdk/sphere/arm-sphere/samples-dev/catalogsListBySubscriptionSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/catalogsListBySubscriptionSample.ts @@ -1,29 +1,24 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List Catalog resources by subscription ID + * This sample demonstrates how to list Catalog resources by subscription ID * - * @summary List Catalog resources by subscription ID - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsSub.json + * @summary list Catalog resources by subscription ID + * x-ms-original-file: 2024-04-01/GetCatalogsSub.json */ async function catalogsListBySubscription(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.catalogs.listBySubscription()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/catalogsListDeploymentsSample.ts b/sdk/sphere/arm-sphere/samples-dev/catalogsListDeploymentsSample.ts index 5b0bccb487d6..4cc08f8b3ac2 100644 --- a/sdk/sphere/arm-sphere/samples-dev/catalogsListDeploymentsSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/catalogsListDeploymentsSample.ts @@ -1,31 +1,24 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists deployments for catalog. + * This sample demonstrates how to lists deployments for catalog. * - * @summary Lists deployments for catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeploymentsByCatalog.json + * @summary lists deployments for catalog. + * x-ms-original-file: 2024-04-01/PostListDeploymentsByCatalog.json */ async function catalogsListDeployments(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.catalogs.listDeployments(resourceGroupName, catalogName)) { + for await (const item of client.catalogs.listDeployments("MyResourceGroup1", "MyCatalog1")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/catalogsListDeviceGroupsSample.ts b/sdk/sphere/arm-sphere/samples-dev/catalogsListDeviceGroupsSample.ts index 17b0d0c57b63..9ab0ea8e8b35 100644 --- a/sdk/sphere/arm-sphere/samples-dev/catalogsListDeviceGroupsSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/catalogsListDeviceGroupsSample.ts @@ -1,39 +1,24 @@ -/* - * 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 type { ListDeviceGroupsRequest } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List the device groups for the catalog. + * This sample demonstrates how to list the device groups for the catalog. * - * @summary List the device groups for the catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceGroupsCatalog.json + * @summary list the device groups for the catalog. + * x-ms-original-file: 2024-04-01/PostListDeviceGroupsCatalog.json */ async function catalogsListDeviceGroups(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const listDeviceGroupsRequest: ListDeviceGroupsRequest = { - deviceGroupName: "MyDeviceGroup1", - }; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.catalogs.listDeviceGroups( - resourceGroupName, - catalogName, - listDeviceGroupsRequest, - )) { + for await (const item of client.catalogs.listDeviceGroups("MyResourceGroup1", "MyCatalog1")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/catalogsListDeviceInsightsSample.ts b/sdk/sphere/arm-sphere/samples-dev/catalogsListDeviceInsightsSample.ts index 13f46cec315e..48f49537f15f 100644 --- a/sdk/sphere/arm-sphere/samples-dev/catalogsListDeviceInsightsSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/catalogsListDeviceInsightsSample.ts @@ -1,38 +1,26 @@ -/* - * 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 type { CatalogsListDeviceInsightsOptionalParams } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists device insights for catalog. + * This sample demonstrates how to lists device insights for catalog. * - * @summary Lists device insights for catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceInsightsCatalog.json + * @summary lists device insights for catalog. + * x-ms-original-file: 2024-04-01/PostListDeviceInsightsCatalog.json */ async function catalogsListDeviceInsights(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const top = 10; - const catalogName = "MyCatalog1"; - const options: CatalogsListDeviceInsightsOptionalParams = { top }; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.catalogs.listDeviceInsights( - resourceGroupName, - catalogName, - options, - )) { + for await (const item of client.catalogs.listDeviceInsights("MyResourceGroup1", "MyCatalog1", { + top: 10, + })) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/catalogsListDevicesSample.ts b/sdk/sphere/arm-sphere/samples-dev/catalogsListDevicesSample.ts index 297ee705e96a..1cb1761d474c 100644 --- a/sdk/sphere/arm-sphere/samples-dev/catalogsListDevicesSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/catalogsListDevicesSample.ts @@ -1,31 +1,24 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Lists devices for catalog. + * This sample demonstrates how to lists devices for catalog. * - * @summary Lists devices for catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDevicesByCatalog.json + * @summary lists devices for catalog. + * x-ms-original-file: 2024-04-01/PostListDevicesByCatalog.json */ async function catalogsListDevices(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.catalogs.listDevices(resourceGroupName, catalogName)) { + for await (const item of client.catalogs.listDevices("MyResourceGroup1", "MyCatalog1")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/catalogsUpdateSample.ts b/sdk/sphere/arm-sphere/samples-dev/catalogsUpdateSample.ts index 493c109101de..6cdc355ac9b6 100644 --- a/sdk/sphere/arm-sphere/samples-dev/catalogsUpdateSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/catalogsUpdateSample.ts @@ -1,30 +1,20 @@ -/* - * 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 type { CatalogUpdate } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Update a Catalog + * This sample demonstrates how to update a Catalog * - * @summary Update a Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchCatalog.json + * @summary update a Catalog + * x-ms-original-file: 2024-04-01/PatchCatalog.json */ async function catalogsUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const properties: CatalogUpdate = {}; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.update(resourceGroupName, catalogName, properties); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.catalogs.update("MyResourceGroup1", "MyCatalog1", {}); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/catalogsUploadImageSample.ts b/sdk/sphere/arm-sphere/samples-dev/catalogsUploadImageSample.ts index 2002621f250f..c8036b633e36 100644 --- a/sdk/sphere/arm-sphere/samples-dev/catalogsUploadImageSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/catalogsUploadImageSample.ts @@ -1,37 +1,20 @@ -/* - * 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 type { Image } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Creates an image. Use this action when the image ID is unknown. + * This sample demonstrates how to creates an image. Use this action when the image ID is unknown. * - * @summary Creates an image. Use this action when the image ID is unknown. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostUploadImageCatalog.json + * @summary creates an image. Use this action when the image ID is unknown. + * x-ms-original-file: 2024-04-01/PostUploadImageCatalog.json */ async function catalogsUploadImage(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const uploadImageRequest: Image = { - properties: { image: "bXliYXNlNjRzdHJpbmc=" }, - }; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.beginUploadImageAndWait( - resourceGroupName, - catalogName, - uploadImageRequest, - ); - console.log(result); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + await client.catalogs.uploadImage("MyResourceGroup1", "MyCatalog1"); } async function main(): Promise { diff --git a/sdk/sphere/arm-sphere/samples-dev/certificatesGetSample.ts b/sdk/sphere/arm-sphere/samples-dev/certificatesGetSample.ts index 0c92d091e68f..03668c514c7c 100644 --- a/sdk/sphere/arm-sphere/samples-dev/certificatesGetSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/certificatesGetSample.ts @@ -1,29 +1,20 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get a Certificate + * This sample demonstrates how to get a Certificate * - * @summary Get a Certificate - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificate.json + * @summary get a Certificate + * x-ms-original-file: 2024-04-01/GetCertificate.json */ async function certificatesGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const serialNumber = "default"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.certificates.get(resourceGroupName, catalogName, serialNumber); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.certificates.get("MyResourceGroup1", "MyCatalog1", "default"); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/certificatesListByCatalogSample.ts b/sdk/sphere/arm-sphere/samples-dev/certificatesListByCatalogSample.ts index ea7f36e1bbff..47578c9ad490 100644 --- a/sdk/sphere/arm-sphere/samples-dev/certificatesListByCatalogSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/certificatesListByCatalogSample.ts @@ -1,31 +1,24 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List Certificate resources by Catalog + * This sample demonstrates how to list Certificate resources by Catalog * - * @summary List Certificate resources by Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificates.json + * @summary list Certificate resources by Catalog + * x-ms-original-file: 2024-04-01/GetCertificates.json */ async function certificatesListByCatalog(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.certificates.listByCatalog(resourceGroupName, catalogName)) { + for await (const item of client.certificates.listByCatalog("MyResourceGroup1", "MyCatalog1")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/certificatesRetrieveCertChainSample.ts b/sdk/sphere/arm-sphere/samples-dev/certificatesRetrieveCertChainSample.ts index 8ec1752a48fa..81fb694ab119 100644 --- a/sdk/sphere/arm-sphere/samples-dev/certificatesRetrieveCertChainSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/certificatesRetrieveCertChainSample.ts @@ -1,32 +1,23 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Retrieves cert chain. + * This sample demonstrates how to retrieves cert chain. * - * @summary Retrieves cert chain. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveCatalogCertChain.json + * @summary retrieves cert chain. + * x-ms-original-file: 2024-04-01/PostRetrieveCatalogCertChain.json */ async function certificatesRetrieveCertChain(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const serialNumber = "active"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const result = await client.certificates.retrieveCertChain( - resourceGroupName, - catalogName, - serialNumber, + "MyResourceGroup1", + "MyCatalog1", + "active", ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/certificatesRetrieveProofOfPossessionNonceSample.ts b/sdk/sphere/arm-sphere/samples-dev/certificatesRetrieveProofOfPossessionNonceSample.ts index ff9a5c20cb1a..4288b4b850a1 100644 --- a/sdk/sphere/arm-sphere/samples-dev/certificatesRetrieveProofOfPossessionNonceSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/certificatesRetrieveProofOfPossessionNonceSample.ts @@ -1,37 +1,23 @@ -/* - * 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 type { ProofOfPossessionNonceRequest } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Gets the proof of possession nonce. + * This sample demonstrates how to gets the proof of possession nonce. * - * @summary Gets the proof of possession nonce. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveProofOfPossessionNonce.json + * @summary gets the proof of possession nonce. + * x-ms-original-file: 2024-04-01/PostRetrieveProofOfPossessionNonce.json */ async function certificatesRetrieveProofOfPossessionNonce(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const serialNumber = "active"; - const proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest = { - proofOfPossessionNonce: "proofOfPossessionNonce", - }; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const result = await client.certificates.retrieveProofOfPossessionNonce( - resourceGroupName, - catalogName, - serialNumber, - proofOfPossessionNonceRequest, + "MyResourceGroup1", + "MyCatalog1", + "active", ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/deploymentsCreateOrUpdateSample.ts b/sdk/sphere/arm-sphere/samples-dev/deploymentsCreateOrUpdateSample.ts index d1970e55c1e3..a5ecf8f2f2a6 100644 --- a/sdk/sphere/arm-sphere/samples-dev/deploymentsCreateOrUpdateSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/deploymentsCreateOrUpdateSample.ts @@ -1,39 +1,26 @@ -/* - * 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 type { Deployment } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * This sample demonstrates how to create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. * - * @summary Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDeployment.json + * @summary create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * x-ms-original-file: 2024-04-01/PutDeployment.json */ async function deploymentsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deploymentName = "MyDeployment1"; - const resource: Deployment = {}; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deployments.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, - resource, + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.deployments.createOrUpdate( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", + "MyDeployment1", + {}, ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/deploymentsDeleteSample.ts b/sdk/sphere/arm-sphere/samples-dev/deploymentsDeleteSample.ts index 8172b4667982..6aeeded12437 100644 --- a/sdk/sphere/arm-sphere/samples-dev/deploymentsDeleteSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/deploymentsDeleteSample.ts @@ -1,38 +1,26 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * This sample demonstrates how to delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. * - * @summary Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeployment.json + * @summary delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * x-ms-original-file: 2024-04-01/DeleteDeployment.json */ async function deploymentsDelete(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProductName1"; - const deviceGroupName = "DeviceGroupName1"; - const deploymentName = "MyDeploymentName1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deployments.beginDeleteAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + await client.deployments.delete( + "MyResourceGroup1", + "MyCatalog1", + "MyProductName1", + "DeviceGroupName1", + "MyDeploymentName1", ); - console.log(result); } async function main(): Promise { diff --git a/sdk/sphere/arm-sphere/samples-dev/deploymentsGetSample.ts b/sdk/sphere/arm-sphere/samples-dev/deploymentsGetSample.ts index b372b07a8522..2e3c04077b11 100644 --- a/sdk/sphere/arm-sphere/samples-dev/deploymentsGetSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/deploymentsGetSample.ts @@ -1,36 +1,25 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * This sample demonstrates how to get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. * - * @summary Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployment.json + * @summary get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * x-ms-original-file: 2024-04-01/GetDeployment.json */ async function deploymentsGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deploymentName = "MyDeployment1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const result = await client.deployments.get( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", + "MyDeployment1", ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/deploymentsListByDeviceGroupSample.ts b/sdk/sphere/arm-sphere/samples-dev/deploymentsListByDeviceGroupSample.ts index 73604314a2bc..48b0cd6e23f1 100644 --- a/sdk/sphere/arm-sphere/samples-dev/deploymentsListByDeviceGroupSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/deploymentsListByDeviceGroupSample.ts @@ -1,38 +1,29 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * This sample demonstrates how to list Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. * - * @summary List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployments.json + * @summary list Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * x-ms-original-file: 2024-04-01/GetDeployments.json */ async function deploymentsListByDeviceGroup(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.deployments.listByDeviceGroup( - resourceGroupName, - catalogName, - productName, - deviceGroupName, + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsClaimDevicesSample.ts b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsClaimDevicesSample.ts index 042ae73e32db..3ce0f28ace41 100644 --- a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsClaimDevicesSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsClaimDevicesSample.ts @@ -1,43 +1,25 @@ -/* - * 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 type { ClaimDevicesRequest } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. + * This sample demonstrates how to bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. * - * @summary Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostClaimDevices.json + * @summary bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. + * x-ms-original-file: 2024-04-01/PostClaimDevices.json */ async function deviceGroupsClaimDevices(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const claimDevicesRequest: ClaimDevicesRequest = { - deviceIdentifiers: [ - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - ], - }; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.beginClaimDevicesAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - claimDevicesRequest, + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + await client.deviceGroups.claimDevices( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "MyDeviceGroup1", ); - console.log(result); } async function main(): Promise { diff --git a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsCountDevicesSample.ts b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsCountDevicesSample.ts index 10bdb17e7373..5390997f8923 100644 --- a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsCountDevicesSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsCountDevicesSample.ts @@ -1,34 +1,24 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * This sample demonstrates how to counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. * - * @summary Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesDeviceGroup.json + * @summary counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * x-ms-original-file: 2024-04-01/PostCountDevicesDeviceGroup.json */ async function deviceGroupsCountDevices(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const result = await client.deviceGroups.countDevices( - resourceGroupName, - catalogName, - productName, - deviceGroupName, + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "MyDeviceGroup1", ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsCreateOrUpdateSample.ts b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsCreateOrUpdateSample.ts index a077b029e5b7..fb628f1c2758 100644 --- a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsCreateOrUpdateSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsCreateOrUpdateSample.ts @@ -1,43 +1,31 @@ -/* - * 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 type { DeviceGroup } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * This sample demonstrates how to create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. * - * @summary Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDeviceGroup.json + * @summary create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * x-ms-original-file: 2024-04-01/PutDeviceGroup.json */ async function deviceGroupsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const resource: DeviceGroup = { - properties: { - description: "Description for MyDeviceGroup1", - osFeedType: "Retail", - updatePolicy: "UpdateAll", - }, - }; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - resource, + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.deviceGroups.createOrUpdate( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "MyDeviceGroup1", + { + properties: { + description: "Description for MyDeviceGroup1", + osFeedType: "Retail", + updatePolicy: "UpdateAll", + }, + }, ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsDeleteSample.ts b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsDeleteSample.ts index 9489fb568ac4..a8cc02feff2f 100644 --- a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsDeleteSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsDeleteSample.ts @@ -1,36 +1,25 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * This sample demonstrates how to delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. * - * @summary Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeviceGroup.json + * @summary delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * x-ms-original-file: 2024-04-01/DeleteDeviceGroup.json */ async function deviceGroupsDelete(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.beginDeleteAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + await client.deviceGroups.delete( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "MyDeviceGroup1", ); - console.log(result); } async function main(): Promise { diff --git a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsGetSample.ts b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsGetSample.ts index 282a105a5183..ee0a76ea59f7 100644 --- a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsGetSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsGetSample.ts @@ -1,34 +1,24 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * This sample demonstrates how to get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. * - * @summary Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroup.json + * @summary get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * x-ms-original-file: 2024-04-01/GetDeviceGroup.json */ async function deviceGroupsGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const result = await client.deviceGroups.get( - resourceGroupName, - catalogName, - productName, - deviceGroupName, + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "MyDeviceGroup1", ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsListByProductSample.ts b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsListByProductSample.ts index b46ff283c8ee..adb612f453d9 100644 --- a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsListByProductSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsListByProductSample.ts @@ -1,36 +1,28 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * This sample demonstrates how to list DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. * - * @summary List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroups.json + * @summary list DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * x-ms-original-file: 2024-04-01/GetDeviceGroups.json */ async function deviceGroupsListByProduct(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.deviceGroups.listByProduct( - resourceGroupName, - catalogName, - productName, + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsUpdateSample.ts b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsUpdateSample.ts index 8b037b2f6b8b..3a64ede5dd33 100644 --- a/sdk/sphere/arm-sphere/samples-dev/deviceGroupsUpdateSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/deviceGroupsUpdateSample.ts @@ -1,37 +1,25 @@ -/* - * 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 type { DeviceGroupUpdate } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * This sample demonstrates how to update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. * - * @summary Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchDeviceGroup.json + * @summary update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * x-ms-original-file: 2024-04-01/PatchDeviceGroup.json */ async function deviceGroupsUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const properties: DeviceGroupUpdate = {}; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.beginUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - properties, + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.deviceGroups.update( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "MyDeviceGroup1", + {}, ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/devicesCreateOrUpdateSample.ts b/sdk/sphere/arm-sphere/samples-dev/devicesCreateOrUpdateSample.ts index 3e91dac1fc63..0374a187ef6c 100644 --- a/sdk/sphere/arm-sphere/samples-dev/devicesCreateOrUpdateSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/devicesCreateOrUpdateSample.ts @@ -1,40 +1,26 @@ -/* - * 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 type { Device } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. + * This sample demonstrates how to create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. * - * @summary Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDevice.json + * @summary create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. + * x-ms-original-file: 2024-04-01/PutDevice.json */ async function devicesCreateOrUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - const resource: Device = {}; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - resource, + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.devices.createOrUpdate( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + {}, ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/devicesDeleteSample.ts b/sdk/sphere/arm-sphere/samples-dev/devicesDeleteSample.ts index 81a2d568628f..a4de33411c07 100644 --- a/sdk/sphere/arm-sphere/samples-dev/devicesDeleteSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/devicesDeleteSample.ts @@ -1,39 +1,26 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Delete a Device + * This sample demonstrates how to delete a Device * - * @summary Delete a Device - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDevice.json + * @summary delete a Device + * x-ms-original-file: 2024-04-01/DeleteDevice.json */ async function devicesDelete(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProductName1"; - const deviceGroupName = "DeviceGroupName1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.beginDeleteAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + await client.devices.delete( + "MyResourceGroup1", + "MyCatalog1", + "MyProductName1", + "DeviceGroupName1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ); - console.log(result); } async function main(): Promise { diff --git a/sdk/sphere/arm-sphere/samples-dev/devicesGenerateCapabilityImageSample.ts b/sdk/sphere/arm-sphere/samples-dev/devicesGenerateCapabilityImageSample.ts index aaad0f338e73..a99e94a35fb8 100644 --- a/sdk/sphere/arm-sphere/samples-dev/devicesGenerateCapabilityImageSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/devicesGenerateCapabilityImageSample.ts @@ -1,42 +1,25 @@ -/* - * 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 type { GenerateCapabilityImageRequest } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. + * This sample demonstrates how to generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. * - * @summary Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDeviceCapabilityImage.json + * @summary generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. + * x-ms-original-file: 2024-04-01/PostGenerateDeviceCapabilityImage.json */ async function devicesGenerateCapabilityImage(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - const generateDeviceCapabilityRequest: GenerateCapabilityImageRequest = { - capabilities: ["ApplicationDevelopment"], - }; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.beginGenerateCapabilityImageAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - generateDeviceCapabilityRequest, + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.devices.generateCapabilityImage( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/devicesGetSample.ts b/sdk/sphere/arm-sphere/samples-dev/devicesGetSample.ts index 8d46140dc456..37fa1b7c5bb1 100644 --- a/sdk/sphere/arm-sphere/samples-dev/devicesGetSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/devicesGetSample.ts @@ -1,37 +1,25 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. + * This sample demonstrates how to get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. * - * @summary Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevice.json + * @summary get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. + * x-ms-original-file: 2024-04-01/GetDevice.json */ async function devicesGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const result = await client.devices.get( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/devicesListByDeviceGroupSample.ts b/sdk/sphere/arm-sphere/samples-dev/devicesListByDeviceGroupSample.ts index 8989c29bf198..17609d1f380a 100644 --- a/sdk/sphere/arm-sphere/samples-dev/devicesListByDeviceGroupSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/devicesListByDeviceGroupSample.ts @@ -1,38 +1,29 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * This sample demonstrates how to list Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. * - * @summary List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevices.json + * @summary list Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. + * x-ms-original-file: 2024-04-01/GetDevices.json */ async function devicesListByDeviceGroup(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.devices.listByDeviceGroup( - resourceGroupName, - catalogName, - productName, - deviceGroupName, + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/devicesUpdateSample.ts b/sdk/sphere/arm-sphere/samples-dev/devicesUpdateSample.ts index 8dcdeebbf5c8..f76b07e4a26f 100644 --- a/sdk/sphere/arm-sphere/samples-dev/devicesUpdateSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/devicesUpdateSample.ts @@ -1,40 +1,26 @@ -/* - * 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 type { DeviceUpdate } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. + * This sample demonstrates how to update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. * - * @summary Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchDevice.json + * @summary update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. + * x-ms-original-file: 2024-04-01/PatchDevice.json */ async function devicesUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - const properties: DeviceUpdate = {}; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.beginUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - properties, + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.devices.update( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "MyDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + {}, ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/imagesCreateOrUpdateSample.ts b/sdk/sphere/arm-sphere/samples-dev/imagesCreateOrUpdateSample.ts index 09f79ddfa284..8d023242e5ce 100644 --- a/sdk/sphere/arm-sphere/samples-dev/imagesCreateOrUpdateSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/imagesCreateOrUpdateSample.ts @@ -1,35 +1,24 @@ -/* - * 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 type { Image } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create a Image + * This sample demonstrates how to create a Image * - * @summary Create a Image - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutImage.json + * @summary create a Image + * x-ms-original-file: 2024-04-01/PutImage.json */ async function imageCreateOrUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const imageName = "00000000-0000-0000-0000-000000000000"; - const resource: Image = { properties: { image: "bXliYXNlNjRzdHJpbmc=" } }; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.images.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - imageName, - resource, + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.images.createOrUpdate( + "MyResourceGroup1", + "MyCatalog1", + "00000000-0000-0000-0000-000000000000", + { properties: { image: "bXliYXNlNjRzdHJpbmc=" } }, ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/imagesDeleteSample.ts b/sdk/sphere/arm-sphere/samples-dev/imagesDeleteSample.ts index f5b17e930f90..b0f6bef74a9f 100644 --- a/sdk/sphere/arm-sphere/samples-dev/imagesDeleteSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/imagesDeleteSample.ts @@ -1,30 +1,24 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Delete a Image + * This sample demonstrates how to delete a Image * - * @summary Delete a Image - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteImage.json + * @summary delete a Image + * x-ms-original-file: 2024-04-01/DeleteImage.json */ async function imagesDelete(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const imageName = "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.images.beginDeleteAndWait(resourceGroupName, catalogName, imageName); - console.log(result); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + await client.images.delete( + "MyResourceGroup1", + "MyCatalog1", + "00000000-0000-0000-0000-000000000000", + ); } async function main(): Promise { diff --git a/sdk/sphere/arm-sphere/samples-dev/imagesGetSample.ts b/sdk/sphere/arm-sphere/samples-dev/imagesGetSample.ts index bae7fe7414fc..74738d0252b0 100644 --- a/sdk/sphere/arm-sphere/samples-dev/imagesGetSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/imagesGetSample.ts @@ -1,29 +1,24 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get a Image + * This sample demonstrates how to get a Image * - * @summary Get a Image - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImage.json + * @summary get a Image + * x-ms-original-file: 2024-04-01/GetImage.json */ async function imagesGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const imageName = "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.images.get(resourceGroupName, catalogName, imageName); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.images.get( + "MyResourceGroup1", + "MyCatalog1", + "00000000-0000-0000-0000-000000000000", + ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/imagesListByCatalogSample.ts b/sdk/sphere/arm-sphere/samples-dev/imagesListByCatalogSample.ts index d4c5f6fdc236..bdb6fe027ffd 100644 --- a/sdk/sphere/arm-sphere/samples-dev/imagesListByCatalogSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/imagesListByCatalogSample.ts @@ -1,31 +1,24 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List Image resources by Catalog + * This sample demonstrates how to list Image resources by Catalog * - * @summary List Image resources by Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImages.json + * @summary list Image resources by Catalog + * x-ms-original-file: 2024-04-01/GetImages.json */ async function imagesListByCatalog(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.images.listByCatalog(resourceGroupName, catalogName)) { + for await (const item of client.images.listByCatalog("MyResourceGroup1", "MyCatalog1")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/operationsListSample.ts b/sdk/sphere/arm-sphere/samples-dev/operationsListSample.ts index fd445f6df1a8..a168005e3b4d 100644 --- a/sdk/sphere/arm-sphere/samples-dev/operationsListSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/operationsListSample.ts @@ -1,29 +1,24 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List the operations for the provider + * This sample demonstrates how to list the operations for the provider * - * @summary List the operations for the provider - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetOperations.json + * @summary list the operations for the provider + * x-ms-original-file: 2024-04-01/GetOperations.json */ async function operationsList(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); for await (const item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/productsCountDevicesSample.ts b/sdk/sphere/arm-sphere/samples-dev/productsCountDevicesSample.ts index 46734cf90f66..22407d9a7a36 100644 --- a/sdk/sphere/arm-sphere/samples-dev/productsCountDevicesSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/productsCountDevicesSample.ts @@ -1,29 +1,20 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * This sample demonstrates how to counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. * - * @summary Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesProduct.json + * @summary counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * x-ms-original-file: 2024-04-01/PostCountDevicesProduct.json */ async function productsCountDevices(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.countDevices(resourceGroupName, catalogName, productName); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.products.countDevices("MyResourceGroup1", "MyCatalog1", "MyProduct1"); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/productsCreateOrUpdateSample.ts b/sdk/sphere/arm-sphere/samples-dev/productsCreateOrUpdateSample.ts index db0dacb8dd08..cc49a7aca5da 100644 --- a/sdk/sphere/arm-sphere/samples-dev/productsCreateOrUpdateSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/productsCreateOrUpdateSample.ts @@ -1,35 +1,24 @@ -/* - * 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 type { Product } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * This sample demonstrates how to create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. * - * @summary Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutProduct.json + * @summary create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * x-ms-original-file: 2024-04-01/PutProduct.json */ async function productsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const resource: Product = {}; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - productName, - resource, + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.products.createOrUpdate( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + {}, ); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/productsDeleteSample.ts b/sdk/sphere/arm-sphere/samples-dev/productsDeleteSample.ts index cc2ff1f6f950..5cef7fc978ba 100644 --- a/sdk/sphere/arm-sphere/samples-dev/productsDeleteSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/productsDeleteSample.ts @@ -1,34 +1,20 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' + * This sample demonstrates how to delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' * - * @summary Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteProduct.json + * @summary delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' + * x-ms-original-file: 2024-04-01/DeleteProduct.json */ async function productsDelete(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProductName1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.beginDeleteAndWait( - resourceGroupName, - catalogName, - productName, - ); - console.log(result); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + await client.products.delete("MyResourceGroup1", "MyCatalog1", "MyProductName1"); } async function main(): Promise { diff --git a/sdk/sphere/arm-sphere/samples-dev/productsGenerateDefaultDeviceGroupsSample.ts b/sdk/sphere/arm-sphere/samples-dev/productsGenerateDefaultDeviceGroupsSample.ts index d53285f8f476..d39b8e785127 100644 --- a/sdk/sphere/arm-sphere/samples-dev/productsGenerateDefaultDeviceGroupsSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/productsGenerateDefaultDeviceGroupsSample.ts @@ -1,36 +1,28 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * This sample demonstrates how to generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. * - * @summary Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDefaultDeviceGroups.json + * @summary generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * x-ms-original-file: 2024-04-01/PostGenerateDefaultDeviceGroups.json */ async function productsGenerateDefaultDeviceGroups(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.products.listGenerateDefaultDeviceGroups( - resourceGroupName, - catalogName, - productName, + for await (const item of client.products.generateDefaultDeviceGroups( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", )) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/productsGetSample.ts b/sdk/sphere/arm-sphere/samples-dev/productsGetSample.ts index 3ec2827681c4..1b418d63b7e9 100644 --- a/sdk/sphere/arm-sphere/samples-dev/productsGetSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/productsGetSample.ts @@ -1,29 +1,20 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * This sample demonstrates how to get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. * - * @summary Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProduct.json + * @summary get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * x-ms-original-file: 2024-04-01/GetProduct.json */ async function productsGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.get(resourceGroupName, catalogName, productName); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.products.get("MyResourceGroup1", "MyCatalog1", "MyProduct1"); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples-dev/productsListByCatalogSample.ts b/sdk/sphere/arm-sphere/samples-dev/productsListByCatalogSample.ts index c9327a5a7c63..3d7bef3a014a 100644 --- a/sdk/sphere/arm-sphere/samples-dev/productsListByCatalogSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/productsListByCatalogSample.ts @@ -1,31 +1,24 @@ -/* - * 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 { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to List Product resources by Catalog + * This sample demonstrates how to list Product resources by Catalog * - * @summary List Product resources by Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProducts.json + * @summary list Product resources by Catalog + * x-ms-original-file: 2024-04-01/GetProducts.json */ async function productsListByCatalog(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); const resArray = new Array(); - for await (const item of client.products.listByCatalog(resourceGroupName, catalogName)) { + for await (const item of client.products.listByCatalog("MyResourceGroup1", "MyCatalog1")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/sphere/arm-sphere/samples-dev/productsUpdateSample.ts b/sdk/sphere/arm-sphere/samples-dev/productsUpdateSample.ts index 0a437926e619..0bebcee700dc 100644 --- a/sdk/sphere/arm-sphere/samples-dev/productsUpdateSample.ts +++ b/sdk/sphere/arm-sphere/samples-dev/productsUpdateSample.ts @@ -1,36 +1,20 @@ -/* - * 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 type { ProductUpdate } from "@azure/arm-sphere"; -import { AzureSphereManagementClient } from "@azure/arm-sphere"; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "@azure/arm-sphere"; import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; /** - * This sample demonstrates how to Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * This sample demonstrates how to update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. * - * @summary Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchProduct.json + * @summary update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * x-ms-original-file: 2024-04-01/PatchProduct.json */ async function productsUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const properties: ProductUpdate = {}; const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.beginUpdateAndWait( - resourceGroupName, - catalogName, - productName, - properties, - ); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzureSphereClient(credential, subscriptionId); + const result = await client.products.update("MyResourceGroup1", "MyCatalog1", "MyProduct1", {}); console.log(result); } diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/README.md b/sdk/sphere/arm-sphere/samples/v1/javascript/README.md deleted file mode 100644 index 55a1f3b9f104..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/README.md +++ /dev/null @@ -1,138 +0,0 @@ -# client library samples for JavaScript - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [catalogsCountDevicesSample.js][catalogscountdevicessample] | Counts devices in catalog. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesCatalog.json | -| [catalogsCreateOrUpdateSample.js][catalogscreateorupdatesample] | Create a Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutCatalog.json | -| [catalogsDeleteSample.js][catalogsdeletesample] | Delete a Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteCatalog.json | -| [catalogsGetSample.js][catalogsgetsample] | Get a Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalog.json | -| [catalogsListByResourceGroupSample.js][catalogslistbyresourcegroupsample] | List Catalog resources by resource group x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsRG.json | -| [catalogsListBySubscriptionSample.js][catalogslistbysubscriptionsample] | List Catalog resources by subscription ID x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsSub.json | -| [catalogsListDeploymentsSample.js][catalogslistdeploymentssample] | Lists deployments for catalog. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeploymentsByCatalog.json | -| [catalogsListDeviceGroupsSample.js][catalogslistdevicegroupssample] | List the device groups for the catalog. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceGroupsCatalog.json | -| [catalogsListDeviceInsightsSample.js][catalogslistdeviceinsightssample] | Lists device insights for catalog. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceInsightsCatalog.json | -| [catalogsListDevicesSample.js][catalogslistdevicessample] | Lists devices for catalog. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDevicesByCatalog.json | -| [catalogsUpdateSample.js][catalogsupdatesample] | Update a Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchCatalog.json | -| [catalogsUploadImageSample.js][catalogsuploadimagesample] | Creates an image. Use this action when the image ID is unknown. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostUploadImageCatalog.json | -| [certificatesGetSample.js][certificatesgetsample] | Get a Certificate x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificate.json | -| [certificatesListByCatalogSample.js][certificateslistbycatalogsample] | List Certificate resources by Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificates.json | -| [certificatesRetrieveCertChainSample.js][certificatesretrievecertchainsample] | Retrieves cert chain. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveCatalogCertChain.json | -| [certificatesRetrieveProofOfPossessionNonceSample.js][certificatesretrieveproofofpossessionnoncesample] | Gets the proof of possession nonce. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveProofOfPossessionNonce.json | -| [deploymentsCreateOrUpdateSample.js][deploymentscreateorupdatesample] | Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDeployment.json | -| [deploymentsDeleteSample.js][deploymentsdeletesample] | Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeployment.json | -| [deploymentsGetSample.js][deploymentsgetsample] | Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployment.json | -| [deploymentsListByDeviceGroupSample.js][deploymentslistbydevicegroupsample] | List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployments.json | -| [deviceGroupsClaimDevicesSample.js][devicegroupsclaimdevicessample] | Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostClaimDevices.json | -| [deviceGroupsCountDevicesSample.js][devicegroupscountdevicessample] | Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesDeviceGroup.json | -| [deviceGroupsCreateOrUpdateSample.js][devicegroupscreateorupdatesample] | Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDeviceGroup.json | -| [deviceGroupsDeleteSample.js][devicegroupsdeletesample] | Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeviceGroup.json | -| [deviceGroupsGetSample.js][devicegroupsgetsample] | Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroup.json | -| [deviceGroupsListByProductSample.js][devicegroupslistbyproductsample] | List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroups.json | -| [deviceGroupsUpdateSample.js][devicegroupsupdatesample] | Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchDeviceGroup.json | -| [devicesCreateOrUpdateSample.js][devicescreateorupdatesample] | Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDevice.json | -| [devicesDeleteSample.js][devicesdeletesample] | Delete a Device x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDevice.json | -| [devicesGenerateCapabilityImageSample.js][devicesgeneratecapabilityimagesample] | Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDeviceCapabilityImage.json | -| [devicesGetSample.js][devicesgetsample] | Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevice.json | -| [devicesListByDeviceGroupSample.js][deviceslistbydevicegroupsample] | List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevices.json | -| [devicesUpdateSample.js][devicesupdatesample] | Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchDevice.json | -| [imagesCreateOrUpdateSample.js][imagescreateorupdatesample] | Create a Image x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutImage.json | -| [imagesDeleteSample.js][imagesdeletesample] | Delete a Image x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteImage.json | -| [imagesGetSample.js][imagesgetsample] | Get a Image x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImage.json | -| [imagesListByCatalogSample.js][imageslistbycatalogsample] | List Image resources by Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImages.json | -| [operationsListSample.js][operationslistsample] | List the operations for the provider x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetOperations.json | -| [productsCountDevicesSample.js][productscountdevicessample] | Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesProduct.json | -| [productsCreateOrUpdateSample.js][productscreateorupdatesample] | Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutProduct.json | -| [productsDeleteSample.js][productsdeletesample] | Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteProduct.json | -| [productsGenerateDefaultDeviceGroupsSample.js][productsgeneratedefaultdevicegroupssample] | Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDefaultDeviceGroups.json | -| [productsGetSample.js][productsgetsample] | Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProduct.json | -| [productsListByCatalogSample.js][productslistbycatalogsample] | List Product resources by Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProducts.json | -| [productsUpdateSample.js][productsupdatesample] | Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchProduct.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -3. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node catalogsCountDevicesSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env SPHERE_SUBSCRIPTION_ID="" SPHERE_RESOURCE_GROUP="" node catalogsCountDevicesSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[catalogscountdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsCountDevicesSample.js -[catalogscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsCreateOrUpdateSample.js -[catalogsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsDeleteSample.js -[catalogsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsGetSample.js -[catalogslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListByResourceGroupSample.js -[catalogslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListBySubscriptionSample.js -[catalogslistdeploymentssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeploymentsSample.js -[catalogslistdevicegroupssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeviceGroupsSample.js -[catalogslistdeviceinsightssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeviceInsightsSample.js -[catalogslistdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDevicesSample.js -[catalogsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsUpdateSample.js -[catalogsuploadimagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsUploadImageSample.js -[certificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesGetSample.js -[certificateslistbycatalogsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesListByCatalogSample.js -[certificatesretrievecertchainsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesRetrieveCertChainSample.js -[certificatesretrieveproofofpossessionnoncesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesRetrieveProofOfPossessionNonceSample.js -[deploymentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsCreateOrUpdateSample.js -[deploymentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsDeleteSample.js -[deploymentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsGetSample.js -[deploymentslistbydevicegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsListByDeviceGroupSample.js -[devicegroupsclaimdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsClaimDevicesSample.js -[devicegroupscountdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsCountDevicesSample.js -[devicegroupscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsCreateOrUpdateSample.js -[devicegroupsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsDeleteSample.js -[devicegroupsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsGetSample.js -[devicegroupslistbyproductsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsListByProductSample.js -[devicegroupsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsUpdateSample.js -[devicescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/devicesCreateOrUpdateSample.js -[devicesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/devicesDeleteSample.js -[devicesgeneratecapabilityimagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/devicesGenerateCapabilityImageSample.js -[devicesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/devicesGetSample.js -[deviceslistbydevicegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/devicesListByDeviceGroupSample.js -[devicesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/devicesUpdateSample.js -[imagescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/imagesCreateOrUpdateSample.js -[imagesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/imagesDeleteSample.js -[imagesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/imagesGetSample.js -[imageslistbycatalogsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/imagesListByCatalogSample.js -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/operationsListSample.js -[productscountdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/productsCountDevicesSample.js -[productscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/productsCreateOrUpdateSample.js -[productsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/productsDeleteSample.js -[productsgeneratedefaultdevicegroupssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/productsGenerateDefaultDeviceGroupsSample.js -[productsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/productsGetSample.js -[productslistbycatalogsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/productsListByCatalogSample.js -[productsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/javascript/productsUpdateSample.js -[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-sphere?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/sphere/arm-sphere/README.md diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsCountDevicesSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsCountDevicesSample.js deleted file mode 100644 index 75b01ed04f0b..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsCountDevicesSample.js +++ /dev/null @@ -1,36 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Counts devices in catalog. - * - * @summary Counts devices in catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesCatalog.json - */ -async function catalogsCountDevices() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.countDevices(resourceGroupName, catalogName); - console.log(result); -} - -async function main() { - catalogsCountDevices(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsCreateOrUpdateSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsCreateOrUpdateSample.js deleted file mode 100644 index 496c568b7f6a..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsCreateOrUpdateSample.js +++ /dev/null @@ -1,41 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Create a Catalog - * - * @summary Create a Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutCatalog.json - */ -async function catalogsCreateOrUpdate() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const resource = { location: "global" }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - resource, - ); - console.log(result); -} - -async function main() { - catalogsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsDeleteSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsDeleteSample.js deleted file mode 100644 index d39529bebb61..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsDeleteSample.js +++ /dev/null @@ -1,36 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete a Catalog - * - * @summary Delete a Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteCatalog.json - */ -async function catalogsDelete() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.beginDeleteAndWait(resourceGroupName, catalogName); - console.log(result); -} - -async function main() { - catalogsDelete(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsGetSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsGetSample.js deleted file mode 100644 index 0c7e2992a172..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsGetSample.js +++ /dev/null @@ -1,36 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a Catalog - * - * @summary Get a Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalog.json - */ -async function catalogsGet() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.get(resourceGroupName, catalogName); - console.log(result); -} - -async function main() { - catalogsGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListByResourceGroupSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListByResourceGroupSample.js deleted file mode 100644 index 1c3892103e0e..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListByResourceGroupSample.js +++ /dev/null @@ -1,38 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List Catalog resources by resource group - * - * @summary List Catalog resources by resource group - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsRG.json - */ -async function catalogsListByResourceGroup() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.catalogs.listByResourceGroup(resourceGroupName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - catalogsListByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListBySubscriptionSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListBySubscriptionSample.js deleted file mode 100644 index f1820b0926c9..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListBySubscriptionSample.js +++ /dev/null @@ -1,37 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List Catalog resources by subscription ID - * - * @summary List Catalog resources by subscription ID - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsSub.json - */ -async function catalogsListBySubscription() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.catalogs.listBySubscription()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - catalogsListBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeploymentsSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeploymentsSample.js deleted file mode 100644 index 195fd2eadbb7..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeploymentsSample.js +++ /dev/null @@ -1,39 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists deployments for catalog. - * - * @summary Lists deployments for catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeploymentsByCatalog.json - */ -async function catalogsListDeployments() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.catalogs.listDeployments(resourceGroupName, catalogName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - catalogsListDeployments(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeviceGroupsSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeviceGroupsSample.js deleted file mode 100644 index 83dac733cb01..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeviceGroupsSample.js +++ /dev/null @@ -1,46 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List the device groups for the catalog. - * - * @summary List the device groups for the catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceGroupsCatalog.json - */ -async function catalogsListDeviceGroups() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const listDeviceGroupsRequest = { - deviceGroupName: "MyDeviceGroup1", - }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.catalogs.listDeviceGroups( - resourceGroupName, - catalogName, - listDeviceGroupsRequest, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - catalogsListDeviceGroups(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeviceInsightsSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeviceInsightsSample.js deleted file mode 100644 index 2fd993e7f59e..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDeviceInsightsSample.js +++ /dev/null @@ -1,45 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists device insights for catalog. - * - * @summary Lists device insights for catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceInsightsCatalog.json - */ -async function catalogsListDeviceInsights() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const top = 10; - const catalogName = "MyCatalog1"; - const options = { top }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.catalogs.listDeviceInsights( - resourceGroupName, - catalogName, - options, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - catalogsListDeviceInsights(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDevicesSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDevicesSample.js deleted file mode 100644 index 5f04ee480aa1..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsListDevicesSample.js +++ /dev/null @@ -1,39 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists devices for catalog. - * - * @summary Lists devices for catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDevicesByCatalog.json - */ -async function catalogsListDevices() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.catalogs.listDevices(resourceGroupName, catalogName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - catalogsListDevices(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsUpdateSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsUpdateSample.js deleted file mode 100644 index 93af974483ff..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsUpdateSample.js +++ /dev/null @@ -1,37 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Update a Catalog - * - * @summary Update a Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchCatalog.json - */ -async function catalogsUpdate() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const properties = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.update(resourceGroupName, catalogName, properties); - console.log(result); -} - -async function main() { - catalogsUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsUploadImageSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsUploadImageSample.js deleted file mode 100644 index b30580fc25a4..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/catalogsUploadImageSample.js +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Creates an image. Use this action when the image ID is unknown. - * - * @summary Creates an image. Use this action when the image ID is unknown. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostUploadImageCatalog.json - */ -async function catalogsUploadImage() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const uploadImageRequest = { - properties: { image: "bXliYXNlNjRzdHJpbmc=" }, - }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.beginUploadImageAndWait( - resourceGroupName, - catalogName, - uploadImageRequest, - ); - console.log(result); -} - -async function main() { - catalogsUploadImage(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesGetSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesGetSample.js deleted file mode 100644 index 5162203d9e69..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesGetSample.js +++ /dev/null @@ -1,37 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a Certificate - * - * @summary Get a Certificate - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificate.json - */ -async function certificatesGet() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const serialNumber = "default"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.certificates.get(resourceGroupName, catalogName, serialNumber); - console.log(result); -} - -async function main() { - certificatesGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesListByCatalogSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesListByCatalogSample.js deleted file mode 100644 index 60606a81b48d..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesListByCatalogSample.js +++ /dev/null @@ -1,39 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List Certificate resources by Catalog - * - * @summary List Certificate resources by Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificates.json - */ -async function certificatesListByCatalog() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.certificates.listByCatalog(resourceGroupName, catalogName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - certificatesListByCatalog(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesRetrieveCertChainSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesRetrieveCertChainSample.js deleted file mode 100644 index f39cfc0cb69f..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesRetrieveCertChainSample.js +++ /dev/null @@ -1,41 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Retrieves cert chain. - * - * @summary Retrieves cert chain. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveCatalogCertChain.json - */ -async function certificatesRetrieveCertChain() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const serialNumber = "active"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.certificates.retrieveCertChain( - resourceGroupName, - catalogName, - serialNumber, - ); - console.log(result); -} - -async function main() { - certificatesRetrieveCertChain(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesRetrieveProofOfPossessionNonceSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesRetrieveProofOfPossessionNonceSample.js deleted file mode 100644 index 3b7059e458cd..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/certificatesRetrieveProofOfPossessionNonceSample.js +++ /dev/null @@ -1,45 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Gets the proof of possession nonce. - * - * @summary Gets the proof of possession nonce. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveProofOfPossessionNonce.json - */ -async function certificatesRetrieveProofOfPossessionNonce() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const serialNumber = "active"; - const proofOfPossessionNonceRequest = { - proofOfPossessionNonce: "proofOfPossessionNonce", - }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.certificates.retrieveProofOfPossessionNonce( - resourceGroupName, - catalogName, - serialNumber, - proofOfPossessionNonceRequest, - ); - console.log(result); -} - -async function main() { - certificatesRetrieveProofOfPossessionNonce(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsCreateOrUpdateSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsCreateOrUpdateSample.js deleted file mode 100644 index eff192c4e120..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsCreateOrUpdateSample.js +++ /dev/null @@ -1,47 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDeployment.json - */ -async function deploymentsCreateOrUpdate() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deploymentName = "MyDeployment1"; - const resource = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deployments.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, - resource, - ); - console.log(result); -} - -async function main() { - deploymentsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsDeleteSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsDeleteSample.js deleted file mode 100644 index 94af94686045..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsDeleteSample.js +++ /dev/null @@ -1,45 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeployment.json - */ -async function deploymentsDelete() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProductName1"; - const deviceGroupName = "DeviceGroupName1"; - const deploymentName = "MyDeploymentName1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deployments.beginDeleteAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, - ); - console.log(result); -} - -async function main() { - deploymentsDelete(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsGetSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsGetSample.js deleted file mode 100644 index 8092d1a3e5cc..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsGetSample.js +++ /dev/null @@ -1,45 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployment.json - */ -async function deploymentsGet() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deploymentName = "MyDeployment1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deployments.get( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, - ); - console.log(result); -} - -async function main() { - deploymentsGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsListByDeviceGroupSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsListByDeviceGroupSample.js deleted file mode 100644 index 975c6a11148c..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/deploymentsListByDeviceGroupSample.js +++ /dev/null @@ -1,46 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployments.json - */ -async function deploymentsListByDeviceGroup() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.deployments.listByDeviceGroup( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - deploymentsListByDeviceGroup(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsClaimDevicesSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsClaimDevicesSample.js deleted file mode 100644 index 256209bb0c6d..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsClaimDevicesSample.js +++ /dev/null @@ -1,49 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. - * - * @summary Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostClaimDevices.json - */ -async function deviceGroupsClaimDevices() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const claimDevicesRequest = { - deviceIdentifiers: [ - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - ], - }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.beginClaimDevicesAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - claimDevicesRequest, - ); - console.log(result); -} - -async function main() { - deviceGroupsClaimDevices(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsCountDevicesSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsCountDevicesSample.js deleted file mode 100644 index f56c89ca0051..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsCountDevicesSample.js +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesDeviceGroup.json - */ -async function deviceGroupsCountDevices() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.countDevices( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - ); - console.log(result); -} - -async function main() { - deviceGroupsCountDevices(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsCreateOrUpdateSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsCreateOrUpdateSample.js deleted file mode 100644 index 344f60158cf2..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsCreateOrUpdateSample.js +++ /dev/null @@ -1,51 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDeviceGroup.json - */ -async function deviceGroupsCreateOrUpdate() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const resource = { - properties: { - description: "Description for MyDeviceGroup1", - osFeedType: "Retail", - updatePolicy: "UpdateAll", - }, - }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - resource, - ); - console.log(result); -} - -async function main() { - deviceGroupsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsDeleteSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsDeleteSample.js deleted file mode 100644 index 9b29c694ed0c..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsDeleteSample.js +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeviceGroup.json - */ -async function deviceGroupsDelete() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.beginDeleteAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - ); - console.log(result); -} - -async function main() { - deviceGroupsDelete(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsGetSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsGetSample.js deleted file mode 100644 index 205369b7ddd4..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsGetSample.js +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroup.json - */ -async function deviceGroupsGet() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.get( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - ); - console.log(result); -} - -async function main() { - deviceGroupsGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsListByProductSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsListByProductSample.js deleted file mode 100644 index 45c1c164e511..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsListByProductSample.js +++ /dev/null @@ -1,44 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * - * @summary List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroups.json - */ -async function deviceGroupsListByProduct() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.deviceGroups.listByProduct( - resourceGroupName, - catalogName, - productName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - deviceGroupsListByProduct(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsUpdateSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsUpdateSample.js deleted file mode 100644 index a9eedfb71f0e..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/deviceGroupsUpdateSample.js +++ /dev/null @@ -1,45 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchDeviceGroup.json - */ -async function deviceGroupsUpdate() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const properties = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.beginUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - properties, - ); - console.log(result); -} - -async function main() { - deviceGroupsUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/devicesCreateOrUpdateSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/devicesCreateOrUpdateSample.js deleted file mode 100644 index b894c684deb5..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/devicesCreateOrUpdateSample.js +++ /dev/null @@ -1,48 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. - * - * @summary Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDevice.json - */ -async function devicesCreateOrUpdate() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - const resource = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - resource, - ); - console.log(result); -} - -async function main() { - devicesCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/devicesDeleteSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/devicesDeleteSample.js deleted file mode 100644 index 0222b123949a..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/devicesDeleteSample.js +++ /dev/null @@ -1,46 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete a Device - * - * @summary Delete a Device - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDevice.json - */ -async function devicesDelete() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProductName1"; - const deviceGroupName = "DeviceGroupName1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.beginDeleteAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - ); - console.log(result); -} - -async function main() { - devicesDelete(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/devicesGenerateCapabilityImageSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/devicesGenerateCapabilityImageSample.js deleted file mode 100644 index 5ef1200e296c..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/devicesGenerateCapabilityImageSample.js +++ /dev/null @@ -1,50 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. - * - * @summary Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDeviceCapabilityImage.json - */ -async function devicesGenerateCapabilityImage() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - const generateDeviceCapabilityRequest = { - capabilities: ["ApplicationDevelopment"], - }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.beginGenerateCapabilityImageAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - generateDeviceCapabilityRequest, - ); - console.log(result); -} - -async function main() { - devicesGenerateCapabilityImage(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/devicesGetSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/devicesGetSample.js deleted file mode 100644 index 2fa970622dd8..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/devicesGetSample.js +++ /dev/null @@ -1,46 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. - * - * @summary Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevice.json - */ -async function devicesGet() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.get( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - ); - console.log(result); -} - -async function main() { - devicesGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/devicesListByDeviceGroupSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/devicesListByDeviceGroupSample.js deleted file mode 100644 index af7ecaec0caf..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/devicesListByDeviceGroupSample.js +++ /dev/null @@ -1,46 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevices.json - */ -async function devicesListByDeviceGroup() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.devices.listByDeviceGroup( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - devicesListByDeviceGroup(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/devicesUpdateSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/devicesUpdateSample.js deleted file mode 100644 index 7a581bc2c716..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/devicesUpdateSample.js +++ /dev/null @@ -1,48 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. - * - * @summary Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchDevice.json - */ -async function devicesUpdate() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - const properties = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.beginUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - properties, - ); - console.log(result); -} - -async function main() { - devicesUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/imagesCreateOrUpdateSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/imagesCreateOrUpdateSample.js deleted file mode 100644 index 5bc2e296cc4d..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/imagesCreateOrUpdateSample.js +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Create a Image - * - * @summary Create a Image - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutImage.json - */ -async function imageCreateOrUpdate() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const imageName = "00000000-0000-0000-0000-000000000000"; - const resource = { properties: { image: "bXliYXNlNjRzdHJpbmc=" } }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.images.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - imageName, - resource, - ); - console.log(result); -} - -async function main() { - imageCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/imagesDeleteSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/imagesDeleteSample.js deleted file mode 100644 index 5c79c830642d..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/imagesDeleteSample.js +++ /dev/null @@ -1,37 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete a Image - * - * @summary Delete a Image - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteImage.json - */ -async function imagesDelete() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const imageName = "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.images.beginDeleteAndWait(resourceGroupName, catalogName, imageName); - console.log(result); -} - -async function main() { - imagesDelete(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/imagesGetSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/imagesGetSample.js deleted file mode 100644 index b485271b0c98..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/imagesGetSample.js +++ /dev/null @@ -1,37 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a Image - * - * @summary Get a Image - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImage.json - */ -async function imagesGet() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const imageName = "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.images.get(resourceGroupName, catalogName, imageName); - console.log(result); -} - -async function main() { - imagesGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/imagesListByCatalogSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/imagesListByCatalogSample.js deleted file mode 100644 index 049cf8be048a..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/imagesListByCatalogSample.js +++ /dev/null @@ -1,39 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List Image resources by Catalog - * - * @summary List Image resources by Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImages.json - */ -async function imagesListByCatalog() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.images.listByCatalog(resourceGroupName, catalogName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - imagesListByCatalog(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/operationsListSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/operationsListSample.js deleted file mode 100644 index fe241385376f..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/operationsListSample.js +++ /dev/null @@ -1,37 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List the operations for the provider - * - * @summary List the operations for the provider - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetOperations.json - */ -async function operationsList() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/package.json b/sdk/sphere/arm-sphere/samples/v1/javascript/package.json deleted file mode 100644 index 4d287d19457b..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@azure-samples/arm-sphere-js", - "private": true, - "version": "1.0.0", - "description": " client library samples for JavaScript", - "engines": { - "node": ">=18.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/sphere/arm-sphere" - }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/sphere/arm-sphere", - "dependencies": { - "@azure/arm-sphere": "latest", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - } -} diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/productsCountDevicesSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/productsCountDevicesSample.js deleted file mode 100644 index 68936d429a95..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/productsCountDevicesSample.js +++ /dev/null @@ -1,37 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * - * @summary Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesProduct.json - */ -async function productsCountDevices() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.countDevices(resourceGroupName, catalogName, productName); - console.log(result); -} - -async function main() { - productsCountDevices(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/productsCreateOrUpdateSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/productsCreateOrUpdateSample.js deleted file mode 100644 index 979970929678..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/productsCreateOrUpdateSample.js +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * - * @summary Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutProduct.json - */ -async function productsCreateOrUpdate() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const resource = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - productName, - resource, - ); - console.log(result); -} - -async function main() { - productsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/productsDeleteSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/productsDeleteSample.js deleted file mode 100644 index 16d224945545..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/productsDeleteSample.js +++ /dev/null @@ -1,41 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' - * - * @summary Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteProduct.json - */ -async function productsDelete() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProductName1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.beginDeleteAndWait( - resourceGroupName, - catalogName, - productName, - ); - console.log(result); -} - -async function main() { - productsDelete(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/productsGenerateDefaultDeviceGroupsSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/productsGenerateDefaultDeviceGroupsSample.js deleted file mode 100644 index b4ac8ccea712..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/productsGenerateDefaultDeviceGroupsSample.js +++ /dev/null @@ -1,44 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * - * @summary Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDefaultDeviceGroups.json - */ -async function productsGenerateDefaultDeviceGroups() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.products.listGenerateDefaultDeviceGroups( - resourceGroupName, - catalogName, - productName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - productsGenerateDefaultDeviceGroups(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/productsGetSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/productsGetSample.js deleted file mode 100644 index 3ec4503bf1a3..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/productsGetSample.js +++ /dev/null @@ -1,37 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * - * @summary Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProduct.json - */ -async function productsGet() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.get(resourceGroupName, catalogName, productName); - console.log(result); -} - -async function main() { - productsGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/productsListByCatalogSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/productsListByCatalogSample.js deleted file mode 100644 index 304ad6a7e201..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/productsListByCatalogSample.js +++ /dev/null @@ -1,39 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List Product resources by Catalog - * - * @summary List Product resources by Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProducts.json - */ -async function productsListByCatalog() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.products.listByCatalog(resourceGroupName, catalogName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - productsListByCatalog(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/productsUpdateSample.js b/sdk/sphere/arm-sphere/samples/v1/javascript/productsUpdateSample.js deleted file mode 100644 index 1b963becfc75..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/productsUpdateSample.js +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureSphereManagementClient } = require("@azure/arm-sphere"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * - * @summary Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchProduct.json - */ -async function productsUpdate() { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const properties = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.beginUpdateAndWait( - resourceGroupName, - catalogName, - productName, - properties, - ); - console.log(result); -} - -async function main() { - productsUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/javascript/sample.env b/sdk/sphere/arm-sphere/samples/v1/javascript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/javascript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/README.md b/sdk/sphere/arm-sphere/samples/v1/typescript/README.md deleted file mode 100644 index efe096d64c81..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/README.md +++ /dev/null @@ -1,151 +0,0 @@ -# client library samples for TypeScript - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [catalogsCountDevicesSample.ts][catalogscountdevicessample] | Counts devices in catalog. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesCatalog.json | -| [catalogsCreateOrUpdateSample.ts][catalogscreateorupdatesample] | Create a Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutCatalog.json | -| [catalogsDeleteSample.ts][catalogsdeletesample] | Delete a Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteCatalog.json | -| [catalogsGetSample.ts][catalogsgetsample] | Get a Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalog.json | -| [catalogsListByResourceGroupSample.ts][catalogslistbyresourcegroupsample] | List Catalog resources by resource group x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsRG.json | -| [catalogsListBySubscriptionSample.ts][catalogslistbysubscriptionsample] | List Catalog resources by subscription ID x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsSub.json | -| [catalogsListDeploymentsSample.ts][catalogslistdeploymentssample] | Lists deployments for catalog. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeploymentsByCatalog.json | -| [catalogsListDeviceGroupsSample.ts][catalogslistdevicegroupssample] | List the device groups for the catalog. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceGroupsCatalog.json | -| [catalogsListDeviceInsightsSample.ts][catalogslistdeviceinsightssample] | Lists device insights for catalog. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceInsightsCatalog.json | -| [catalogsListDevicesSample.ts][catalogslistdevicessample] | Lists devices for catalog. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDevicesByCatalog.json | -| [catalogsUpdateSample.ts][catalogsupdatesample] | Update a Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchCatalog.json | -| [catalogsUploadImageSample.ts][catalogsuploadimagesample] | Creates an image. Use this action when the image ID is unknown. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostUploadImageCatalog.json | -| [certificatesGetSample.ts][certificatesgetsample] | Get a Certificate x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificate.json | -| [certificatesListByCatalogSample.ts][certificateslistbycatalogsample] | List Certificate resources by Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificates.json | -| [certificatesRetrieveCertChainSample.ts][certificatesretrievecertchainsample] | Retrieves cert chain. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveCatalogCertChain.json | -| [certificatesRetrieveProofOfPossessionNonceSample.ts][certificatesretrieveproofofpossessionnoncesample] | Gets the proof of possession nonce. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveProofOfPossessionNonce.json | -| [deploymentsCreateOrUpdateSample.ts][deploymentscreateorupdatesample] | Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDeployment.json | -| [deploymentsDeleteSample.ts][deploymentsdeletesample] | Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeployment.json | -| [deploymentsGetSample.ts][deploymentsgetsample] | Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployment.json | -| [deploymentsListByDeviceGroupSample.ts][deploymentslistbydevicegroupsample] | List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployments.json | -| [deviceGroupsClaimDevicesSample.ts][devicegroupsclaimdevicessample] | Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostClaimDevices.json | -| [deviceGroupsCountDevicesSample.ts][devicegroupscountdevicessample] | Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesDeviceGroup.json | -| [deviceGroupsCreateOrUpdateSample.ts][devicegroupscreateorupdatesample] | Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDeviceGroup.json | -| [deviceGroupsDeleteSample.ts][devicegroupsdeletesample] | Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeviceGroup.json | -| [deviceGroupsGetSample.ts][devicegroupsgetsample] | Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroup.json | -| [deviceGroupsListByProductSample.ts][devicegroupslistbyproductsample] | List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroups.json | -| [deviceGroupsUpdateSample.ts][devicegroupsupdatesample] | Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchDeviceGroup.json | -| [devicesCreateOrUpdateSample.ts][devicescreateorupdatesample] | Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDevice.json | -| [devicesDeleteSample.ts][devicesdeletesample] | Delete a Device x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDevice.json | -| [devicesGenerateCapabilityImageSample.ts][devicesgeneratecapabilityimagesample] | Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDeviceCapabilityImage.json | -| [devicesGetSample.ts][devicesgetsample] | Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevice.json | -| [devicesListByDeviceGroupSample.ts][deviceslistbydevicegroupsample] | List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevices.json | -| [devicesUpdateSample.ts][devicesupdatesample] | Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchDevice.json | -| [imagesCreateOrUpdateSample.ts][imagescreateorupdatesample] | Create a Image x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutImage.json | -| [imagesDeleteSample.ts][imagesdeletesample] | Delete a Image x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteImage.json | -| [imagesGetSample.ts][imagesgetsample] | Get a Image x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImage.json | -| [imagesListByCatalogSample.ts][imageslistbycatalogsample] | List Image resources by Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImages.json | -| [operationsListSample.ts][operationslistsample] | List the operations for the provider x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetOperations.json | -| [productsCountDevicesSample.ts][productscountdevicessample] | Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesProduct.json | -| [productsCreateOrUpdateSample.ts][productscreateorupdatesample] | Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutProduct.json | -| [productsDeleteSample.ts][productsdeletesample] | Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteProduct.json | -| [productsGenerateDefaultDeviceGroupsSample.ts][productsgeneratedefaultdevicegroupssample] | Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDefaultDeviceGroups.json | -| [productsGetSample.ts][productsgetsample] | Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProduct.json | -| [productsListByCatalogSample.ts][productslistbycatalogsample] | List Product resources by Catalog x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProducts.json | -| [productsUpdateSample.ts][productsupdatesample] | Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchProduct.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: - -```bash -npm install -g typescript -``` - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Compile the samples: - -```bash -npm run build -``` - -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dist/catalogsCountDevicesSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env SPHERE_SUBSCRIPTION_ID="" SPHERE_RESOURCE_GROUP="" node dist/catalogsCountDevicesSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[catalogscountdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsCountDevicesSample.ts -[catalogscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsCreateOrUpdateSample.ts -[catalogsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsDeleteSample.ts -[catalogsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsGetSample.ts -[catalogslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListByResourceGroupSample.ts -[catalogslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListBySubscriptionSample.ts -[catalogslistdeploymentssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeploymentsSample.ts -[catalogslistdevicegroupssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeviceGroupsSample.ts -[catalogslistdeviceinsightssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeviceInsightsSample.ts -[catalogslistdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDevicesSample.ts -[catalogsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsUpdateSample.ts -[catalogsuploadimagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsUploadImageSample.ts -[certificatesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesGetSample.ts -[certificateslistbycatalogsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesListByCatalogSample.ts -[certificatesretrievecertchainsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesRetrieveCertChainSample.ts -[certificatesretrieveproofofpossessionnoncesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesRetrieveProofOfPossessionNonceSample.ts -[deploymentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsCreateOrUpdateSample.ts -[deploymentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsDeleteSample.ts -[deploymentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsGetSample.ts -[deploymentslistbydevicegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsListByDeviceGroupSample.ts -[devicegroupsclaimdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsClaimDevicesSample.ts -[devicegroupscountdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsCountDevicesSample.ts -[devicegroupscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsCreateOrUpdateSample.ts -[devicegroupsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsDeleteSample.ts -[devicegroupsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsGetSample.ts -[devicegroupslistbyproductsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsListByProductSample.ts -[devicegroupsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsUpdateSample.ts -[devicescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesCreateOrUpdateSample.ts -[devicesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesDeleteSample.ts -[devicesgeneratecapabilityimagesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesGenerateCapabilityImageSample.ts -[devicesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesGetSample.ts -[deviceslistbydevicegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesListByDeviceGroupSample.ts -[devicesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesUpdateSample.ts -[imagescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesCreateOrUpdateSample.ts -[imagesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesDeleteSample.ts -[imagesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesGetSample.ts -[imageslistbycatalogsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesListByCatalogSample.ts -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/operationsListSample.ts -[productscountdevicessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsCountDevicesSample.ts -[productscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsCreateOrUpdateSample.ts -[productsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsDeleteSample.ts -[productsgeneratedefaultdevicegroupssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsGenerateDefaultDeviceGroupsSample.ts -[productsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsGetSample.ts -[productslistbycatalogsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsListByCatalogSample.ts -[productsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsUpdateSample.ts -[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-sphere?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/sphere/arm-sphere/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/package.json b/sdk/sphere/arm-sphere/samples/v1/typescript/package.json deleted file mode 100644 index dcca18bf1fea..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@azure-samples/arm-sphere-ts", - "private": true, - "version": "1.0.0", - "description": " client library samples for TypeScript", - "engines": { - "node": ">=18.0.0" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/sphere/arm-sphere" - }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/sphere/arm-sphere", - "dependencies": { - "@azure/arm-sphere": "latest", - "dotenv": "latest", - "@azure/identity": "^4.2.1" - }, - "devDependencies": { - "@types/node": "^18.0.0", - "typescript": "~5.8.2", - "rimraf": "latest" - } -} diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/sample.env b/sdk/sphere/arm-sphere/samples/v1/typescript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsCountDevicesSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsCountDevicesSample.ts deleted file mode 100644 index 628c6075f5b5..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsCountDevicesSample.ts +++ /dev/null @@ -1,41 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Counts devices in catalog. - * - * @summary Counts devices in catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesCatalog.json - */ -async function catalogsCountDevices(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.countDevices( - resourceGroupName, - catalogName, - ); - console.log(result); -} - -async function main(): Promise { - catalogsCountDevices(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsCreateOrUpdateSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsCreateOrUpdateSample.ts deleted file mode 100644 index 31aab0e9c7b9..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsCreateOrUpdateSample.ts +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { Catalog, AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Create a Catalog - * - * @summary Create a Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutCatalog.json - */ -async function catalogsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const resource: Catalog = { location: "global" }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - resource, - ); - console.log(result); -} - -async function main(): Promise { - catalogsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsDeleteSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsDeleteSample.ts deleted file mode 100644 index fe769adce688..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsDeleteSample.ts +++ /dev/null @@ -1,41 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Delete a Catalog - * - * @summary Delete a Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteCatalog.json - */ -async function catalogsDelete(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.beginDeleteAndWait( - resourceGroupName, - catalogName, - ); - console.log(result); -} - -async function main(): Promise { - catalogsDelete(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsGetSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsGetSample.ts deleted file mode 100644 index 6377d9a886f1..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsGetSample.ts +++ /dev/null @@ -1,38 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get a Catalog - * - * @summary Get a Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalog.json - */ -async function catalogsGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.get(resourceGroupName, catalogName); - console.log(result); -} - -async function main(): Promise { - catalogsGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListByResourceGroupSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListByResourceGroupSample.ts deleted file mode 100644 index 9ca7998adee1..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListByResourceGroupSample.ts +++ /dev/null @@ -1,42 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List Catalog resources by resource group - * - * @summary List Catalog resources by resource group - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsRG.json - */ -async function catalogsListByResourceGroup(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.catalogs.listByResourceGroup( - resourceGroupName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - catalogsListByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListBySubscriptionSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListBySubscriptionSample.ts deleted file mode 100644 index 0770139b4c32..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListBySubscriptionSample.ts +++ /dev/null @@ -1,38 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List Catalog resources by subscription ID - * - * @summary List Catalog resources by subscription ID - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsSub.json - */ -async function catalogsListBySubscription(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.catalogs.listBySubscription()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - catalogsListBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeploymentsSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeploymentsSample.ts deleted file mode 100644 index 5327eb3e987d..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeploymentsSample.ts +++ /dev/null @@ -1,44 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists deployments for catalog. - * - * @summary Lists deployments for catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeploymentsByCatalog.json - */ -async function catalogsListDeployments(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.catalogs.listDeployments( - resourceGroupName, - catalogName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - catalogsListDeployments(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeviceGroupsSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeviceGroupsSample.ts deleted file mode 100644 index 21376ffdc106..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeviceGroupsSample.ts +++ /dev/null @@ -1,51 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - ListDeviceGroupsRequest, - AzureSphereManagementClient, -} from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List the device groups for the catalog. - * - * @summary List the device groups for the catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceGroupsCatalog.json - */ -async function catalogsListDeviceGroups(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const listDeviceGroupsRequest: ListDeviceGroupsRequest = { - deviceGroupName: "MyDeviceGroup1", - }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.catalogs.listDeviceGroups( - resourceGroupName, - catalogName, - listDeviceGroupsRequest, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - catalogsListDeviceGroups(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeviceInsightsSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeviceInsightsSample.ts deleted file mode 100644 index 521ca799b1dc..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDeviceInsightsSample.ts +++ /dev/null @@ -1,50 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - CatalogsListDeviceInsightsOptionalParams, - AzureSphereManagementClient, -} from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists device insights for catalog. - * - * @summary Lists device insights for catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceInsightsCatalog.json - */ -async function catalogsListDeviceInsights(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const top = 10; - const catalogName = "MyCatalog1"; - const options: CatalogsListDeviceInsightsOptionalParams = { top }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.catalogs.listDeviceInsights( - resourceGroupName, - catalogName, - options, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - catalogsListDeviceInsights(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDevicesSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDevicesSample.ts deleted file mode 100644 index 3ae6586686f4..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsListDevicesSample.ts +++ /dev/null @@ -1,44 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Lists devices for catalog. - * - * @summary Lists devices for catalog. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDevicesByCatalog.json - */ -async function catalogsListDevices(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.catalogs.listDevices( - resourceGroupName, - catalogName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - catalogsListDevices(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsUpdateSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsUpdateSample.ts deleted file mode 100644 index c9e026d0c8d4..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsUpdateSample.ts +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { CatalogUpdate, AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Update a Catalog - * - * @summary Update a Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchCatalog.json - */ -async function catalogsUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const properties: CatalogUpdate = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.update( - resourceGroupName, - catalogName, - properties, - ); - console.log(result); -} - -async function main(): Promise { - catalogsUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsUploadImageSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsUploadImageSample.ts deleted file mode 100644 index 82d9f9edde49..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/catalogsUploadImageSample.ts +++ /dev/null @@ -1,45 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { Image, AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Creates an image. Use this action when the image ID is unknown. - * - * @summary Creates an image. Use this action when the image ID is unknown. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostUploadImageCatalog.json - */ -async function catalogsUploadImage(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const uploadImageRequest: Image = { - properties: { image: "bXliYXNlNjRzdHJpbmc=" }, - }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.catalogs.beginUploadImageAndWait( - resourceGroupName, - catalogName, - uploadImageRequest, - ); - console.log(result); -} - -async function main(): Promise { - catalogsUploadImage(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesGetSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesGetSample.ts deleted file mode 100644 index 44981c4c3f70..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesGetSample.ts +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get a Certificate - * - * @summary Get a Certificate - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificate.json - */ -async function certificatesGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const serialNumber = "default"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.certificates.get( - resourceGroupName, - catalogName, - serialNumber, - ); - console.log(result); -} - -async function main(): Promise { - certificatesGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesListByCatalogSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesListByCatalogSample.ts deleted file mode 100644 index c9a82aa04497..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesListByCatalogSample.ts +++ /dev/null @@ -1,44 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List Certificate resources by Catalog - * - * @summary List Certificate resources by Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificates.json - */ -async function certificatesListByCatalog(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.certificates.listByCatalog( - resourceGroupName, - catalogName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - certificatesListByCatalog(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesRetrieveCertChainSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesRetrieveCertChainSample.ts deleted file mode 100644 index f8adc3b39aa0..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesRetrieveCertChainSample.ts +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Retrieves cert chain. - * - * @summary Retrieves cert chain. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveCatalogCertChain.json - */ -async function certificatesRetrieveCertChain(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const serialNumber = "active"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.certificates.retrieveCertChain( - resourceGroupName, - catalogName, - serialNumber, - ); - console.log(result); -} - -async function main(): Promise { - certificatesRetrieveCertChain(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesRetrieveProofOfPossessionNonceSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesRetrieveProofOfPossessionNonceSample.ts deleted file mode 100644 index 890424481d0b..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/certificatesRetrieveProofOfPossessionNonceSample.ts +++ /dev/null @@ -1,50 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - ProofOfPossessionNonceRequest, - AzureSphereManagementClient, -} from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Gets the proof of possession nonce. - * - * @summary Gets the proof of possession nonce. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveProofOfPossessionNonce.json - */ -async function certificatesRetrieveProofOfPossessionNonce(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const serialNumber = "active"; - const proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest = { - proofOfPossessionNonce: "proofOfPossessionNonce", - }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.certificates.retrieveProofOfPossessionNonce( - resourceGroupName, - catalogName, - serialNumber, - proofOfPossessionNonceRequest, - ); - console.log(result); -} - -async function main(): Promise { - certificatesRetrieveProofOfPossessionNonce(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsCreateOrUpdateSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsCreateOrUpdateSample.ts deleted file mode 100644 index 3fcb0700059c..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsCreateOrUpdateSample.ts +++ /dev/null @@ -1,49 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { Deployment, AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDeployment.json - */ -async function deploymentsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deploymentName = "MyDeployment1"; - const resource: Deployment = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deployments.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, - resource, - ); - console.log(result); -} - -async function main(): Promise { - deploymentsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsDeleteSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsDeleteSample.ts deleted file mode 100644 index 4d65fe9af7fb..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsDeleteSample.ts +++ /dev/null @@ -1,47 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeployment.json - */ -async function deploymentsDelete(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProductName1"; - const deviceGroupName = "DeviceGroupName1"; - const deploymentName = "MyDeploymentName1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deployments.beginDeleteAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, - ); - console.log(result); -} - -async function main(): Promise { - deploymentsDelete(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsGetSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsGetSample.ts deleted file mode 100644 index 9b7ca13b4caf..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsGetSample.ts +++ /dev/null @@ -1,47 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployment.json - */ -async function deploymentsGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deploymentName = "MyDeployment1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deployments.get( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, - ); - console.log(result); -} - -async function main(): Promise { - deploymentsGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsListByDeviceGroupSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsListByDeviceGroupSample.ts deleted file mode 100644 index 438211d3bb68..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deploymentsListByDeviceGroupSample.ts +++ /dev/null @@ -1,48 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployments.json - */ -async function deploymentsListByDeviceGroup(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.deployments.listByDeviceGroup( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - deploymentsListByDeviceGroup(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsClaimDevicesSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsClaimDevicesSample.ts deleted file mode 100644 index ad7fb6205f72..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsClaimDevicesSample.ts +++ /dev/null @@ -1,54 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - ClaimDevicesRequest, - AzureSphereManagementClient, -} from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. - * - * @summary Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostClaimDevices.json - */ -async function deviceGroupsClaimDevices(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const claimDevicesRequest: ClaimDevicesRequest = { - deviceIdentifiers: [ - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - ], - }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.beginClaimDevicesAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - claimDevicesRequest, - ); - console.log(result); -} - -async function main(): Promise { - deviceGroupsClaimDevices(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsCountDevicesSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsCountDevicesSample.ts deleted file mode 100644 index 3838ad327b69..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsCountDevicesSample.ts +++ /dev/null @@ -1,45 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesDeviceGroup.json - */ -async function deviceGroupsCountDevices(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.countDevices( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - ); - console.log(result); -} - -async function main(): Promise { - deviceGroupsCountDevices(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsCreateOrUpdateSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsCreateOrUpdateSample.ts deleted file mode 100644 index a2db5248061d..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsCreateOrUpdateSample.ts +++ /dev/null @@ -1,53 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { DeviceGroup, AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDeviceGroup.json - */ -async function deviceGroupsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const resource: DeviceGroup = { - properties: { - description: "Description for MyDeviceGroup1", - osFeedType: "Retail", - updatePolicy: "UpdateAll", - }, - }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - resource, - ); - console.log(result); -} - -async function main(): Promise { - deviceGroupsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsDeleteSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsDeleteSample.ts deleted file mode 100644 index 4272584a720e..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsDeleteSample.ts +++ /dev/null @@ -1,45 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeviceGroup.json - */ -async function deviceGroupsDelete(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.beginDeleteAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - ); - console.log(result); -} - -async function main(): Promise { - deviceGroupsDelete(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsGetSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsGetSample.ts deleted file mode 100644 index c64b18723a00..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsGetSample.ts +++ /dev/null @@ -1,45 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroup.json - */ -async function deviceGroupsGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.get( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - ); - console.log(result); -} - -async function main(): Promise { - deviceGroupsGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsListByProductSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsListByProductSample.ts deleted file mode 100644 index ac90b49692f0..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsListByProductSample.ts +++ /dev/null @@ -1,46 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * - * @summary List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroups.json - */ -async function deviceGroupsListByProduct(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.deviceGroups.listByProduct( - resourceGroupName, - catalogName, - productName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - deviceGroupsListByProduct(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsUpdateSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsUpdateSample.ts deleted file mode 100644 index 85c1d1784831..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/deviceGroupsUpdateSample.ts +++ /dev/null @@ -1,50 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - DeviceGroupUpdate, - AzureSphereManagementClient, -} from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchDeviceGroup.json - */ -async function deviceGroupsUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const properties: DeviceGroupUpdate = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.deviceGroups.beginUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - properties, - ); - console.log(result); -} - -async function main(): Promise { - deviceGroupsUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesCreateOrUpdateSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesCreateOrUpdateSample.ts deleted file mode 100644 index 66ea5a9da073..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesCreateOrUpdateSample.ts +++ /dev/null @@ -1,50 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { Device, AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. - * - * @summary Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDevice.json - */ -async function devicesCreateOrUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - const resource: Device = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - resource, - ); - console.log(result); -} - -async function main(): Promise { - devicesCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesDeleteSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesDeleteSample.ts deleted file mode 100644 index a49d57ed9016..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesDeleteSample.ts +++ /dev/null @@ -1,48 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Delete a Device - * - * @summary Delete a Device - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDevice.json - */ -async function devicesDelete(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProductName1"; - const deviceGroupName = "DeviceGroupName1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.beginDeleteAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - ); - console.log(result); -} - -async function main(): Promise { - devicesDelete(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesGenerateCapabilityImageSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesGenerateCapabilityImageSample.ts deleted file mode 100644 index d2b263858753..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesGenerateCapabilityImageSample.ts +++ /dev/null @@ -1,55 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - GenerateCapabilityImageRequest, - AzureSphereManagementClient, -} from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. - * - * @summary Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDeviceCapabilityImage.json - */ -async function devicesGenerateCapabilityImage(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - const generateDeviceCapabilityRequest: GenerateCapabilityImageRequest = { - capabilities: ["ApplicationDevelopment"], - }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.beginGenerateCapabilityImageAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - generateDeviceCapabilityRequest, - ); - console.log(result); -} - -async function main(): Promise { - devicesGenerateCapabilityImage(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesGetSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesGetSample.ts deleted file mode 100644 index 4ab6c5aed53f..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesGetSample.ts +++ /dev/null @@ -1,48 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. - * - * @summary Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevice.json - */ -async function devicesGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.get( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - ); - console.log(result); -} - -async function main(): Promise { - devicesGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesListByDeviceGroupSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesListByDeviceGroupSample.ts deleted file mode 100644 index be2ac9aa6106..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesListByDeviceGroupSample.ts +++ /dev/null @@ -1,48 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * - * @summary List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevices.json - */ -async function devicesListByDeviceGroup(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "myDeviceGroup1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.devices.listByDeviceGroup( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - devicesListByDeviceGroup(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesUpdateSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesUpdateSample.ts deleted file mode 100644 index 834c5f2275b1..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/devicesUpdateSample.ts +++ /dev/null @@ -1,50 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { DeviceUpdate, AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. - * - * @summary Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchDevice.json - */ -async function devicesUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const deviceGroupName = "MyDeviceGroup1"; - const deviceName = - "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; - const properties: DeviceUpdate = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.devices.beginUpdateAndWait( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - properties, - ); - console.log(result); -} - -async function main(): Promise { - devicesUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesCreateOrUpdateSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesCreateOrUpdateSample.ts deleted file mode 100644 index 522eb8951c16..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesCreateOrUpdateSample.ts +++ /dev/null @@ -1,45 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { Image, AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Create a Image - * - * @summary Create a Image - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutImage.json - */ -async function imageCreateOrUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const imageName = "00000000-0000-0000-0000-000000000000"; - const resource: Image = { properties: { image: "bXliYXNlNjRzdHJpbmc=" } }; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.images.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - imageName, - resource, - ); - console.log(result); -} - -async function main(): Promise { - imageCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesDeleteSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesDeleteSample.ts deleted file mode 100644 index 66e4266cf142..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesDeleteSample.ts +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Delete a Image - * - * @summary Delete a Image - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteImage.json - */ -async function imagesDelete(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const imageName = "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.images.beginDeleteAndWait( - resourceGroupName, - catalogName, - imageName, - ); - console.log(result); -} - -async function main(): Promise { - imagesDelete(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesGetSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesGetSample.ts deleted file mode 100644 index 153c54f51f1b..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesGetSample.ts +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get a Image - * - * @summary Get a Image - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImage.json - */ -async function imagesGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const imageName = "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.images.get( - resourceGroupName, - catalogName, - imageName, - ); - console.log(result); -} - -async function main(): Promise { - imagesGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesListByCatalogSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesListByCatalogSample.ts deleted file mode 100644 index 480b69f0b639..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/imagesListByCatalogSample.ts +++ /dev/null @@ -1,44 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List Image resources by Catalog - * - * @summary List Image resources by Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImages.json - */ -async function imagesListByCatalog(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.images.listByCatalog( - resourceGroupName, - catalogName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - imagesListByCatalog(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/operationsListSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/operationsListSample.ts deleted file mode 100644 index 46345f8841b9..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/operationsListSample.ts +++ /dev/null @@ -1,38 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List the operations for the provider - * - * @summary List the operations for the provider - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetOperations.json - */ -async function operationsList(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsCountDevicesSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsCountDevicesSample.ts deleted file mode 100644 index aab1ac201654..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsCountDevicesSample.ts +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * - * @summary Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesProduct.json - */ -async function productsCountDevices(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.countDevices( - resourceGroupName, - catalogName, - productName, - ); - console.log(result); -} - -async function main(): Promise { - productsCountDevices(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsCreateOrUpdateSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsCreateOrUpdateSample.ts deleted file mode 100644 index a6272e57b22e..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsCreateOrUpdateSample.ts +++ /dev/null @@ -1,45 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { Product, AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * - * @summary Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutProduct.json - */ -async function productsCreateOrUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const resource: Product = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.beginCreateOrUpdateAndWait( - resourceGroupName, - catalogName, - productName, - resource, - ); - console.log(result); -} - -async function main(): Promise { - productsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsDeleteSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsDeleteSample.ts deleted file mode 100644 index d8b57bc02f89..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsDeleteSample.ts +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' - * - * @summary Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteProduct.json - */ -async function productsDelete(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProductName1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.beginDeleteAndWait( - resourceGroupName, - catalogName, - productName, - ); - console.log(result); -} - -async function main(): Promise { - productsDelete(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsGenerateDefaultDeviceGroupsSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsGenerateDefaultDeviceGroupsSample.ts deleted file mode 100644 index 90aac1e48e8a..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsGenerateDefaultDeviceGroupsSample.ts +++ /dev/null @@ -1,46 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * - * @summary Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDefaultDeviceGroups.json - */ -async function productsGenerateDefaultDeviceGroups(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.products.listGenerateDefaultDeviceGroups( - resourceGroupName, - catalogName, - productName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - productsGenerateDefaultDeviceGroups(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsGetSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsGetSample.ts deleted file mode 100644 index 0f581dfeacf5..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsGetSample.ts +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * - * @summary Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProduct.json - */ -async function productsGet(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.get( - resourceGroupName, - catalogName, - productName, - ); - console.log(result); -} - -async function main(): Promise { - productsGet(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsListByCatalogSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsListByCatalogSample.ts deleted file mode 100644 index e2c34d7fa5bf..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsListByCatalogSample.ts +++ /dev/null @@ -1,44 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to List Product resources by Catalog - * - * @summary List Product resources by Catalog - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProducts.json - */ -async function productsListByCatalog(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.products.listByCatalog( - resourceGroupName, - catalogName, - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main(): Promise { - productsListByCatalog(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsUpdateSample.ts b/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsUpdateSample.ts deleted file mode 100644 index 31d03535a5ec..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/src/productsUpdateSample.ts +++ /dev/null @@ -1,45 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { ProductUpdate, AzureSphereManagementClient } from "@azure/arm-sphere"; -import { DefaultAzureCredential } from "@azure/identity"; -import "dotenv/config"; - -/** - * This sample demonstrates how to Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * - * @summary Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. - * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchProduct.json - */ -async function productsUpdate(): Promise { - const subscriptionId = - process.env["SPHERE_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["SPHERE_RESOURCE_GROUP"] || "MyResourceGroup1"; - const catalogName = "MyCatalog1"; - const productName = "MyProduct1"; - const properties: ProductUpdate = {}; - const credential = new DefaultAzureCredential(); - const client = new AzureSphereManagementClient(credential, subscriptionId); - const result = await client.products.beginUpdateAndWait( - resourceGroupName, - catalogName, - productName, - properties, - ); - console.log(result); -} - -async function main(): Promise { - productsUpdate(); -} - -main().catch(console.error); diff --git a/sdk/sphere/arm-sphere/samples/v1/typescript/tsconfig.json b/sdk/sphere/arm-sphere/samples/v1/typescript/tsconfig.json deleted file mode 100644 index 984eed535aa8..000000000000 --- a/sdk/sphere/arm-sphere/samples/v1/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "alwaysStrict": true, - "outDir": "dist", - "rootDir": "src" - }, - "include": [ - "src/**/*.ts" - ] -} diff --git a/sdk/sphere/arm-sphere/src/api/azureSphereContext.ts b/sdk/sphere/arm-sphere/src/api/azureSphereContext.ts new file mode 100644 index 000000000000..1675245d7fb4 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/azureSphereContext.ts @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { TokenCredential } from "@azure/core-auth"; + +/** Azure Sphere resource management API. */ +export interface AzureSphereContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion: string; + /** The ID of the target subscription. The value must be an UUID. */ + subscriptionId: string; +} + +/** Optional parameters for the client. */ +export interface AzureSphereClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +/** Azure Sphere resource management API. */ +export function createAzureSphere( + credential: TokenCredential, + subscriptionId: string, + options: AzureSphereClientOptionalParams = {}, +): AzureSphereContext { + const endpointUrl = options.endpoint ?? options.baseUrl ?? "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-sphere/2.0.0`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`], + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + const apiVersion = options.apiVersion ?? "2024-04-01"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return { ...clientContext, apiVersion, subscriptionId } as AzureSphereContext; +} diff --git a/sdk/sphere/arm-sphere/src/api/catalogs/index.ts b/sdk/sphere/arm-sphere/src/api/catalogs/index.ts new file mode 100644 index 000000000000..d6dae7451b6c --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/catalogs/index.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + uploadImage, + listDevices, + listDeviceInsights, + listDeviceGroups, + listDeployments, + countDevices, + listBySubscription, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "./operations.js"; +export { + CatalogsUploadImageOptionalParams, + CatalogsListDevicesOptionalParams, + CatalogsListDeviceInsightsOptionalParams, + CatalogsListDeviceGroupsOptionalParams, + CatalogsListDeploymentsOptionalParams, + CatalogsCountDevicesOptionalParams, + CatalogsListBySubscriptionOptionalParams, + CatalogsListByResourceGroupOptionalParams, + CatalogsDeleteOptionalParams, + CatalogsUpdateOptionalParams, + CatalogsCreateOrUpdateOptionalParams, + CatalogsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/sphere/arm-sphere/src/api/catalogs/operations.ts b/sdk/sphere/arm-sphere/src/api/catalogs/operations.ts new file mode 100644 index 000000000000..9cf49e358ed8 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/catalogs/operations.ts @@ -0,0 +1,740 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + Catalog, + catalogSerializer, + catalogDeserializer, + CatalogUpdate, + catalogUpdateSerializer, + _CatalogListResult, + _catalogListResultDeserializer, + CountDevicesResponse, + countDevicesResponseDeserializer, + _DeploymentListResult, + _deploymentListResultDeserializer, + Deployment, + Image, + imageSerializer, + ListDeviceGroupsRequest, + listDeviceGroupsRequestSerializer, + _DeviceGroupListResult, + _deviceGroupListResultDeserializer, + DeviceGroup, + _PagedDeviceInsight, + _pagedDeviceInsightDeserializer, + DeviceInsight, + _DeviceListResult, + _deviceListResultDeserializer, + Device, +} from "../../models/models.js"; +import { + CatalogsUploadImageOptionalParams, + CatalogsListDevicesOptionalParams, + CatalogsListDeviceInsightsOptionalParams, + CatalogsListDeviceGroupsOptionalParams, + CatalogsListDeploymentsOptionalParams, + CatalogsCountDevicesOptionalParams, + CatalogsListBySubscriptionOptionalParams, + CatalogsListByResourceGroupOptionalParams, + CatalogsDeleteOptionalParams, + CatalogsUpdateOptionalParams, + CatalogsCreateOrUpdateOptionalParams, + CatalogsGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _uploadImageSend( + context: Client, + resourceGroupName: string, + catalogName: string, + uploadImageRequest: Image, + options: CatalogsUploadImageOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/uploadImage{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: imageSerializer(uploadImageRequest), + }); +} + +export async function _uploadImageDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Creates an image. Use this action when the image ID is unknown. */ +export function uploadImage( + context: Client, + resourceGroupName: string, + catalogName: string, + uploadImageRequest: Image, + options: CatalogsUploadImageOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _uploadImageDeserialize, ["202", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _uploadImageSend(context, resourceGroupName, catalogName, uploadImageRequest, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _listDevicesSend( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CatalogsListDevicesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDevices{?api%2Dversion,%24filter,%24top,%24skip,%24maxpagesize}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + "api%2Dversion": context.apiVersion, + "%24filter": options?.filter, + "%24top": options?.top, + "%24skip": options?.skip, + "%24maxpagesize": options?.maxpagesize, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDevicesDeserialize( + result: PathUncheckedResponse, +): Promise<_DeviceListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _deviceListResultDeserializer(result.body); +} + +/** Lists devices for catalog. */ +export function listDevices( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CatalogsListDevicesOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listDevicesSend(context, resourceGroupName, catalogName, options), + _listDevicesDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listDeviceInsightsSend( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CatalogsListDeviceInsightsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceInsights{?api%2Dversion,%24filter,%24top,%24skip,%24maxpagesize}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + "api%2Dversion": context.apiVersion, + "%24filter": options?.filter, + "%24top": options?.top, + "%24skip": options?.skip, + "%24maxpagesize": options?.maxpagesize, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeviceInsightsDeserialize( + result: PathUncheckedResponse, +): Promise<_PagedDeviceInsight> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _pagedDeviceInsightDeserializer(result.body); +} + +/** Lists device insights for catalog. */ +export function listDeviceInsights( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CatalogsListDeviceInsightsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listDeviceInsightsSend(context, resourceGroupName, catalogName, options), + _listDeviceInsightsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listDeviceGroupsSend( + context: Client, + resourceGroupName: string, + catalogName: string, + listDeviceGroupsRequest: ListDeviceGroupsRequest, + options: CatalogsListDeviceGroupsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceGroups{?api%2Dversion,%24filter,%24top,%24skip,%24maxpagesize}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + "api%2Dversion": context.apiVersion, + "%24filter": options?.filter, + "%24top": options?.top, + "%24skip": options?.skip, + "%24maxpagesize": options?.maxpagesize, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: listDeviceGroupsRequestSerializer(listDeviceGroupsRequest), + }); +} + +export async function _listDeviceGroupsDeserialize( + result: PathUncheckedResponse, +): Promise<_DeviceGroupListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _deviceGroupListResultDeserializer(result.body); +} + +/** List the device groups for the catalog. */ +export function listDeviceGroups( + context: Client, + resourceGroupName: string, + catalogName: string, + listDeviceGroupsRequest: ListDeviceGroupsRequest, + options: CatalogsListDeviceGroupsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listDeviceGroupsSend( + context, + resourceGroupName, + catalogName, + listDeviceGroupsRequest, + options, + ), + _listDeviceGroupsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listDeploymentsSend( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CatalogsListDeploymentsOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeployments{?api%2Dversion,%24filter,%24top,%24skip,%24maxpagesize}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + "api%2Dversion": context.apiVersion, + "%24filter": options?.filter, + "%24top": options?.top, + "%24skip": options?.skip, + "%24maxpagesize": options?.maxpagesize, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeploymentsDeserialize( + result: PathUncheckedResponse, +): Promise<_DeploymentListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _deploymentListResultDeserializer(result.body); +} + +/** Lists deployments for catalog. */ +export function listDeployments( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CatalogsListDeploymentsOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listDeploymentsSend(context, resourceGroupName, catalogName, options), + _listDeploymentsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _countDevicesSend( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CatalogsCountDevicesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/countDevices{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _countDevicesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return countDevicesResponseDeserializer(result.body); +} + +/** Counts devices in catalog. */ +export async function countDevices( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CatalogsCountDevicesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _countDevicesSend(context, resourceGroupName, catalogName, options); + return _countDevicesDeserialize(result); +} + +export function _listBySubscriptionSend( + context: Client, + options: CatalogsListBySubscriptionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.AzureSphere/catalogs{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_CatalogListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _catalogListResultDeserializer(result.body); +} + +/** List Catalog resources by subscription ID */ +export function listBySubscription( + context: Client, + options: CatalogsListBySubscriptionOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listBySubscriptionSend(context, options), + _listBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: CatalogsListByResourceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_CatalogListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _catalogListResultDeserializer(result.body); +} + +/** List Catalog resources by resource group */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: CatalogsListByResourceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CatalogsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a Catalog */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CatalogsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["200", "202", "204"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _$deleteSend(context, resourceGroupName, catalogName, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + catalogName: string, + properties: CatalogUpdate, + options: CatalogsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: catalogUpdateSerializer(properties), + }); +} + +export async function _updateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return catalogDeserializer(result.body); +} + +/** Update a Catalog */ +export async function update( + context: Client, + resourceGroupName: string, + catalogName: string, + properties: CatalogUpdate, + options: CatalogsUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _updateSend(context, resourceGroupName, catalogName, properties, options); + return _updateDeserialize(result); +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + catalogName: string, + resource: Catalog, + options: CatalogsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: catalogSerializer(resource), + }); +} + +export async function _createOrUpdateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return catalogDeserializer(result.body); +} + +/** Create a Catalog */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + catalogName: string, + resource: Catalog, + options: CatalogsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Catalog> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend(context, resourceGroupName, catalogName, resource, options), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, Catalog>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CatalogsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return catalogDeserializer(result.body); +} + +/** Get a Catalog */ +export async function get( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CatalogsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, catalogName, options); + return _getDeserialize(result); +} diff --git a/sdk/sphere/arm-sphere/src/api/catalogs/options.ts b/sdk/sphere/arm-sphere/src/api/catalogs/options.ts new file mode 100644 index 000000000000..cd19f1e6f48e --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/catalogs/options.ts @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface CatalogsUploadImageOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface CatalogsListDevicesOptionalParams extends OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Optional parameters. */ +export interface CatalogsListDeviceInsightsOptionalParams extends OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Optional parameters. */ +export interface CatalogsListDeviceGroupsOptionalParams extends OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Optional parameters. */ +export interface CatalogsListDeploymentsOptionalParams extends OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Optional parameters. */ +export interface CatalogsCountDevicesOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CatalogsListBySubscriptionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CatalogsListByResourceGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CatalogsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface CatalogsUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CatalogsCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface CatalogsGetOptionalParams extends OperationOptions {} diff --git a/sdk/sphere/arm-sphere/src/api/certificates/index.ts b/sdk/sphere/arm-sphere/src/api/certificates/index.ts new file mode 100644 index 000000000000..14226d2b801e --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/certificates/index.ts @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + retrieveProofOfPossessionNonce, + retrieveCertChain, + listByCatalog, + get, +} from "./operations.js"; +export { + CertificatesRetrieveProofOfPossessionNonceOptionalParams, + CertificatesRetrieveCertChainOptionalParams, + CertificatesListByCatalogOptionalParams, + CertificatesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/sphere/arm-sphere/src/api/certificates/operations.ts b/sdk/sphere/arm-sphere/src/api/certificates/operations.ts new file mode 100644 index 000000000000..b64d42b68c0c --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/certificates/operations.ts @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + Certificate, + certificateDeserializer, + _CertificateListResult, + _certificateListResultDeserializer, + CertificateChainResponse, + certificateChainResponseDeserializer, + ProofOfPossessionNonceRequest, + proofOfPossessionNonceRequestSerializer, + ProofOfPossessionNonceResponse, + proofOfPossessionNonceResponseDeserializer, +} from "../../models/models.js"; +import { + CertificatesRetrieveProofOfPossessionNonceOptionalParams, + CertificatesRetrieveCertChainOptionalParams, + CertificatesListByCatalogOptionalParams, + CertificatesGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _retrieveProofOfPossessionNonceSend( + context: Client, + resourceGroupName: string, + catalogName: string, + serialNumber: string, + proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, + options: CertificatesRetrieveProofOfPossessionNonceOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveProofOfPossessionNonce{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + serialNumber: serialNumber, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: proofOfPossessionNonceRequestSerializer(proofOfPossessionNonceRequest), + }); +} + +export async function _retrieveProofOfPossessionNonceDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return proofOfPossessionNonceResponseDeserializer(result.body); +} + +/** Gets the proof of possession nonce. */ +export async function retrieveProofOfPossessionNonce( + context: Client, + resourceGroupName: string, + catalogName: string, + serialNumber: string, + proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, + options: CertificatesRetrieveProofOfPossessionNonceOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _retrieveProofOfPossessionNonceSend( + context, + resourceGroupName, + catalogName, + serialNumber, + proofOfPossessionNonceRequest, + options, + ); + return _retrieveProofOfPossessionNonceDeserialize(result); +} + +export function _retrieveCertChainSend( + context: Client, + resourceGroupName: string, + catalogName: string, + serialNumber: string, + options: CertificatesRetrieveCertChainOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveCertChain{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + serialNumber: serialNumber, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _retrieveCertChainDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return certificateChainResponseDeserializer(result.body); +} + +/** Retrieves cert chain. */ +export async function retrieveCertChain( + context: Client, + resourceGroupName: string, + catalogName: string, + serialNumber: string, + options: CertificatesRetrieveCertChainOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _retrieveCertChainSend( + context, + resourceGroupName, + catalogName, + serialNumber, + options, + ); + return _retrieveCertChainDeserialize(result); +} + +export function _listByCatalogSend( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CertificatesListByCatalogOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates{?api%2Dversion,%24filter,%24top,%24skip,%24maxpagesize}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + "api%2Dversion": context.apiVersion, + "%24filter": options?.filter, + "%24top": options?.top, + "%24skip": options?.skip, + "%24maxpagesize": options?.maxpagesize, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listByCatalogDeserialize( + result: PathUncheckedResponse, +): Promise<_CertificateListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _certificateListResultDeserializer(result.body); +} + +/** List Certificate resources by Catalog */ +export function listByCatalog( + context: Client, + resourceGroupName: string, + catalogName: string, + options: CertificatesListByCatalogOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByCatalogSend(context, resourceGroupName, catalogName, options), + _listByCatalogDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _getSend( + context: Client, + resourceGroupName: string, + catalogName: string, + serialNumber: string, + options: CertificatesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + serialNumber: serialNumber, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return certificateDeserializer(result.body); +} + +/** Get a Certificate */ +export async function get( + context: Client, + resourceGroupName: string, + catalogName: string, + serialNumber: string, + options: CertificatesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, catalogName, serialNumber, options); + return _getDeserialize(result); +} diff --git a/sdk/sphere/arm-sphere/src/api/certificates/options.ts b/sdk/sphere/arm-sphere/src/api/certificates/options.ts new file mode 100644 index 000000000000..adb49f94ee44 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/certificates/options.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface CertificatesRetrieveProofOfPossessionNonceOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface CertificatesRetrieveCertChainOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CertificatesListByCatalogOptionalParams extends OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Optional parameters. */ +export interface CertificatesGetOptionalParams extends OperationOptions {} diff --git a/sdk/sphere/arm-sphere/src/api/deployments/index.ts b/sdk/sphere/arm-sphere/src/api/deployments/index.ts new file mode 100644 index 000000000000..edaecb13fe8f --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/deployments/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByDeviceGroup, $delete, createOrUpdate, get } from "./operations.js"; +export { + DeploymentsListByDeviceGroupOptionalParams, + DeploymentsDeleteOptionalParams, + DeploymentsCreateOrUpdateOptionalParams, + DeploymentsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/sphere/arm-sphere/src/api/deployments/operations.ts b/sdk/sphere/arm-sphere/src/api/deployments/operations.ts new file mode 100644 index 000000000000..4992257922d9 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/deployments/operations.ts @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + _DeploymentListResult, + _deploymentListResultDeserializer, + Deployment, + deploymentSerializer, + deploymentDeserializer, +} from "../../models/models.js"; +import { + DeploymentsListByDeviceGroupOptionalParams, + DeploymentsDeleteOptionalParams, + DeploymentsCreateOrUpdateOptionalParams, + DeploymentsGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listByDeviceGroupSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options: DeploymentsListByDeviceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments{?api%2Dversion,%24filter,%24top,%24skip,%24maxpagesize}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + "api%2Dversion": context.apiVersion, + "%24filter": options?.filter, + "%24top": options?.top, + "%24skip": options?.skip, + "%24maxpagesize": options?.maxpagesize, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listByDeviceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_DeploymentListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _deploymentListResultDeserializer(result.body); +} + +/** List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ +export function listByDeviceGroup( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options: DeploymentsListByDeviceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listByDeviceGroupSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options, + ), + _listByDeviceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options: DeploymentsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + deploymentName: deploymentName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options: DeploymentsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["200", "202", "204"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + resource: Deployment, + options: DeploymentsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + deploymentName: deploymentName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: deploymentSerializer(resource), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return deploymentDeserializer(result.body); +} + +/** Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + resource: Deployment, + options: DeploymentsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Deployment> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, Deployment>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options: DeploymentsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + deploymentName: deploymentName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return deploymentDeserializer(result.body); +} + +/** Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ +export async function get( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options: DeploymentsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/sphere/arm-sphere/src/api/deployments/options.ts b/sdk/sphere/arm-sphere/src/api/deployments/options.ts new file mode 100644 index 000000000000..0bb52dfdf737 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/deployments/options.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DeploymentsListByDeviceGroupOptionalParams extends OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Optional parameters. */ +export interface DeploymentsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DeploymentsCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DeploymentsGetOptionalParams extends OperationOptions {} diff --git a/sdk/sphere/arm-sphere/src/api/deviceGroups/index.ts b/sdk/sphere/arm-sphere/src/api/deviceGroups/index.ts new file mode 100644 index 000000000000..fcf5f0511639 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/deviceGroups/index.ts @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + countDevices, + claimDevices, + listByProduct, + $delete, + update, + createOrUpdate, + get, +} from "./operations.js"; +export { + DeviceGroupsCountDevicesOptionalParams, + DeviceGroupsClaimDevicesOptionalParams, + DeviceGroupsListByProductOptionalParams, + DeviceGroupsDeleteOptionalParams, + DeviceGroupsUpdateOptionalParams, + DeviceGroupsCreateOrUpdateOptionalParams, + DeviceGroupsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/sphere/arm-sphere/src/api/deviceGroups/operations.ts b/sdk/sphere/arm-sphere/src/api/deviceGroups/operations.ts new file mode 100644 index 000000000000..e28029cdcccf --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/deviceGroups/operations.ts @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + CountDevicesResponse, + countDevicesResponseDeserializer, + _DeviceGroupListResult, + _deviceGroupListResultDeserializer, + DeviceGroup, + deviceGroupSerializer, + deviceGroupDeserializer, + DeviceGroupUpdate, + deviceGroupUpdateSerializer, + ClaimDevicesRequest, + claimDevicesRequestSerializer, +} from "../../models/models.js"; +import { + DeviceGroupsCountDevicesOptionalParams, + DeviceGroupsClaimDevicesOptionalParams, + DeviceGroupsListByProductOptionalParams, + DeviceGroupsDeleteOptionalParams, + DeviceGroupsUpdateOptionalParams, + DeviceGroupsCreateOrUpdateOptionalParams, + DeviceGroupsGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _countDevicesSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options: DeviceGroupsCountDevicesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/countDevices{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _countDevicesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return countDevicesResponseDeserializer(result.body); +} + +/** Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ +export async function countDevices( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options: DeviceGroupsCountDevicesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _countDevicesSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options, + ); + return _countDevicesDeserialize(result); +} + +export function _claimDevicesSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + claimDevicesRequest: ClaimDevicesRequest, + options: DeviceGroupsClaimDevicesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: claimDevicesRequestSerializer(claimDevicesRequest), + }); +} + +export async function _claimDevicesDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. */ +export function claimDevices( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + claimDevicesRequest: ClaimDevicesRequest, + options: DeviceGroupsClaimDevicesOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _claimDevicesDeserialize, ["202", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _claimDevicesSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + claimDevicesRequest, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _listByProductSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + options: DeviceGroupsListByProductOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups{?api%2Dversion,%24filter,%24top,%24skip,%24maxpagesize}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + "api%2Dversion": context.apiVersion, + "%24filter": options?.filter, + "%24top": options?.top, + "%24skip": options?.skip, + "%24maxpagesize": options?.maxpagesize, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listByProductDeserialize( + result: PathUncheckedResponse, +): Promise<_DeviceGroupListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _deviceGroupListResultDeserializer(result.body); +} + +/** List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ +export function listByProduct( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + options: DeviceGroupsListByProductOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByProductSend(context, resourceGroupName, catalogName, productName, options), + _listByProductDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options: DeviceGroupsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options: DeviceGroupsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["200", "202", "204"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, catalogName, productName, deviceGroupName, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + properties: DeviceGroupUpdate, + options: DeviceGroupsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: deviceGroupUpdateSerializer(properties), + }); +} + +export async function _updateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return deviceGroupDeserializer(result.body); +} + +/** Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ +export function update( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + properties: DeviceGroupUpdate, + options: DeviceGroupsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, DeviceGroup> { + return getLongRunningPoller(context, _updateDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + properties, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, DeviceGroup>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + resource: DeviceGroup, + options: DeviceGroupsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: deviceGroupSerializer(resource), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return deviceGroupDeserializer(result.body); +} + +/** Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + resource: DeviceGroup, + options: DeviceGroupsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, DeviceGroup> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, DeviceGroup>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options: DeviceGroupsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return deviceGroupDeserializer(result.body); +} + +/** Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ +export async function get( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options: DeviceGroupsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/sphere/arm-sphere/src/api/deviceGroups/options.ts b/sdk/sphere/arm-sphere/src/api/deviceGroups/options.ts new file mode 100644 index 000000000000..7719e9a234c2 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/deviceGroups/options.ts @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DeviceGroupsCountDevicesOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DeviceGroupsClaimDevicesOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DeviceGroupsListByProductOptionalParams extends OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Optional parameters. */ +export interface DeviceGroupsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DeviceGroupsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DeviceGroupsCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DeviceGroupsGetOptionalParams extends OperationOptions {} diff --git a/sdk/sphere/arm-sphere/src/api/devices/index.ts b/sdk/sphere/arm-sphere/src/api/devices/index.ts new file mode 100644 index 000000000000..ee4897026042 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/devices/index.ts @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + generateCapabilityImage, + listByDeviceGroup, + $delete, + update, + createOrUpdate, + get, +} from "./operations.js"; +export { + DevicesGenerateCapabilityImageOptionalParams, + DevicesListByDeviceGroupOptionalParams, + DevicesDeleteOptionalParams, + DevicesUpdateOptionalParams, + DevicesCreateOrUpdateOptionalParams, + DevicesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/sphere/arm-sphere/src/api/devices/operations.ts b/sdk/sphere/arm-sphere/src/api/devices/operations.ts new file mode 100644 index 000000000000..25e590809942 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/devices/operations.ts @@ -0,0 +1,485 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + _DeviceListResult, + _deviceListResultDeserializer, + Device, + deviceSerializer, + deviceDeserializer, + DeviceUpdate, + deviceUpdateSerializer, + GenerateCapabilityImageRequest, + generateCapabilityImageRequestSerializer, + SignedCapabilityImageResponse, + signedCapabilityImageResponseDeserializer, +} from "../../models/models.js"; +import { + DevicesGenerateCapabilityImageOptionalParams, + DevicesListByDeviceGroupOptionalParams, + DevicesDeleteOptionalParams, + DevicesUpdateOptionalParams, + DevicesCreateOrUpdateOptionalParams, + DevicesGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _generateCapabilityImageSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, + options: DevicesGenerateCapabilityImageOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + deviceName: deviceName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: generateCapabilityImageRequestSerializer(generateDeviceCapabilityRequest), + }); +} + +export async function _generateCapabilityImageDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return signedCapabilityImageResponseDeserializer(result.body); +} + +/** Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. */ +export function generateCapabilityImage( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, + options: DevicesGenerateCapabilityImageOptionalParams = { + requestOptions: {}, + }, +): PollerLike, SignedCapabilityImageResponse> { + return getLongRunningPoller(context, _generateCapabilityImageDeserialize, ["202", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _generateCapabilityImageSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, SignedCapabilityImageResponse>; +} + +export function _listByDeviceGroupSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options: DevicesListByDeviceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listByDeviceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_DeviceListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _deviceListResultDeserializer(result.body); +} + +/** List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ +export function listByDeviceGroup( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options: DevicesListByDeviceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listByDeviceGroupSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options, + ), + _listByDeviceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options: DevicesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + deviceName: deviceName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a Device */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options: DevicesDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["200", "202", "204"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + properties: DeviceUpdate, + options: DevicesUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + deviceName: deviceName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: deviceUpdateSerializer(properties), + }); +} + +export async function _updateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return deviceDeserializer(result.body); +} + +/** Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. */ +export function update( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + properties: DeviceUpdate, + options: DevicesUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Device> { + return getLongRunningPoller(context, _updateDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + properties, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, Device>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + resource: Device, + options: DevicesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + deviceName: deviceName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: deviceSerializer(resource), + }); +} + +export async function _createOrUpdateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return deviceDeserializer(result.body); +} + +/** Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + resource: Device, + options: DevicesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Device> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, Device>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options: DevicesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + deviceGroupName: deviceGroupName, + deviceName: deviceName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return deviceDeserializer(result.body); +} + +/** Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. */ +export async function get( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options: DevicesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/sphere/arm-sphere/src/api/devices/options.ts b/sdk/sphere/arm-sphere/src/api/devices/options.ts new file mode 100644 index 000000000000..cfde74738a4f --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/devices/options.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DevicesGenerateCapabilityImageOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DevicesListByDeviceGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DevicesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DevicesUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DevicesCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DevicesGetOptionalParams extends OperationOptions {} diff --git a/sdk/sphere/arm-sphere/src/api/images/index.ts b/sdk/sphere/arm-sphere/src/api/images/index.ts new file mode 100644 index 000000000000..7303bba83cb9 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/images/index.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { listByCatalog, $delete, createOrUpdate, get } from "./operations.js"; +export { + ImagesListByCatalogOptionalParams, + ImagesDeleteOptionalParams, + ImagesCreateOrUpdateOptionalParams, + ImagesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/sphere/arm-sphere/src/api/images/operations.ts b/sdk/sphere/arm-sphere/src/api/images/operations.ts new file mode 100644 index 000000000000..9babe9944daf --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/images/operations.ts @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + Image, + imageSerializer, + imageDeserializer, + _ImageListResult, + _imageListResultDeserializer, +} from "../../models/models.js"; +import { + ImagesListByCatalogOptionalParams, + ImagesDeleteOptionalParams, + ImagesCreateOrUpdateOptionalParams, + ImagesGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listByCatalogSend( + context: Client, + resourceGroupName: string, + catalogName: string, + options: ImagesListByCatalogOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images{?api%2Dversion,%24filter,%24top,%24skip,%24maxpagesize}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + "api%2Dversion": context.apiVersion, + "%24filter": options?.filter, + "%24top": options?.top, + "%24skip": options?.skip, + "%24maxpagesize": options?.maxpagesize, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listByCatalogDeserialize( + result: PathUncheckedResponse, +): Promise<_ImageListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _imageListResultDeserializer(result.body); +} + +/** List Image resources by Catalog */ +export function listByCatalog( + context: Client, + resourceGroupName: string, + catalogName: string, + options: ImagesListByCatalogOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByCatalogSend(context, resourceGroupName, catalogName, options), + _listByCatalogDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + catalogName: string, + imageName: string, + options: ImagesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + imageName: imageName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a Image */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + catalogName: string, + imageName: string, + options: ImagesDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["200", "202", "204"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, catalogName, imageName, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + catalogName: string, + imageName: string, + resource: Image, + options: ImagesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + imageName: imageName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: imageSerializer(resource), + }); +} + +export async function _createOrUpdateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return imageDeserializer(result.body); +} + +/** Create a Image */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + catalogName: string, + imageName: string, + resource: Image, + options: ImagesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Image> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend(context, resourceGroupName, catalogName, imageName, resource, options), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, Image>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + catalogName: string, + imageName: string, + options: ImagesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + imageName: imageName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return imageDeserializer(result.body); +} + +/** Get a Image */ +export async function get( + context: Client, + resourceGroupName: string, + catalogName: string, + imageName: string, + options: ImagesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, catalogName, imageName, options); + return _getDeserialize(result); +} diff --git a/sdk/sphere/arm-sphere/src/api/images/options.ts b/sdk/sphere/arm-sphere/src/api/images/options.ts new file mode 100644 index 000000000000..3cba4dd08b88 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/images/options.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ImagesListByCatalogOptionalParams extends OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Optional parameters. */ +export interface ImagesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ImagesCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ImagesGetOptionalParams extends OperationOptions {} diff --git a/sdk/sphere/arm-sphere/src/api/index.ts b/sdk/sphere/arm-sphere/src/api/index.ts new file mode 100644 index 000000000000..f9acd66a3fb6 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + createAzureSphere, + AzureSphereContext, + AzureSphereClientOptionalParams, +} from "./azureSphereContext.js"; diff --git a/sdk/sphere/arm-sphere/src/api/operations/index.ts b/sdk/sphere/arm-sphere/src/api/operations/index.ts new file mode 100644 index 000000000000..24a804d14fcf --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/operations/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export { OperationsListOptionalParams } from "./options.js"; diff --git a/sdk/sphere/arm-sphere/src/api/operations/operations.ts b/sdk/sphere/arm-sphere/src/api/operations/operations.ts new file mode 100644 index 000000000000..af0a8cb14ff5 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/operations/operations.ts @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext as Client } from "../index.js"; +import { + _OperationListResult, + _operationListResultDeserializer, + Operation, + errorResponseDeserializer, +} from "../../models/models.js"; +import { OperationsListOptionalParams } from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.AzureSphere/operations{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_OperationListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _operationListResultDeserializer(result.body); +} + +/** List the operations for the provider */ +export function list( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/sphere/arm-sphere/src/api/operations/options.ts b/sdk/sphere/arm-sphere/src/api/operations/options.ts new file mode 100644 index 000000000000..c461016ad1c5 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/operations/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} diff --git a/sdk/sphere/arm-sphere/src/api/products/index.ts b/sdk/sphere/arm-sphere/src/api/products/index.ts new file mode 100644 index 000000000000..7db93de9b15c --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/products/index.ts @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + generateDefaultDeviceGroups, + countDevices, + listByCatalog, + $delete, + update, + createOrUpdate, + get, +} from "./operations.js"; +export { + ProductsGenerateDefaultDeviceGroupsOptionalParams, + ProductsCountDevicesOptionalParams, + ProductsListByCatalogOptionalParams, + ProductsDeleteOptionalParams, + ProductsUpdateOptionalParams, + ProductsCreateOrUpdateOptionalParams, + ProductsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/sphere/arm-sphere/src/api/products/operations.ts b/sdk/sphere/arm-sphere/src/api/products/operations.ts new file mode 100644 index 000000000000..e9a771b3e4f6 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/products/operations.ts @@ -0,0 +1,463 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext as Client } from "../index.js"; +import { + errorResponseDeserializer, + CountDevicesResponse, + countDevicesResponseDeserializer, + _DeviceGroupListResult, + _deviceGroupListResultDeserializer, + DeviceGroup, + Product, + productSerializer, + productDeserializer, + ProductUpdate, + productUpdateSerializer, + _ProductListResult, + _productListResultDeserializer, +} from "../../models/models.js"; +import { + ProductsGenerateDefaultDeviceGroupsOptionalParams, + ProductsCountDevicesOptionalParams, + ProductsListByCatalogOptionalParams, + ProductsDeleteOptionalParams, + ProductsUpdateOptionalParams, + ProductsCreateOrUpdateOptionalParams, + ProductsGetOptionalParams, +} from "./options.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _generateDefaultDeviceGroupsSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + options: ProductsGenerateDefaultDeviceGroupsOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/generateDefaultDeviceGroups{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _generateDefaultDeviceGroupsDeserialize( + result: PathUncheckedResponse, +): Promise<_DeviceGroupListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _deviceGroupListResultDeserializer(result.body); +} + +/** Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ +export function generateDefaultDeviceGroups( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + options: ProductsGenerateDefaultDeviceGroupsOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _generateDefaultDeviceGroupsSend( + context, + resourceGroupName, + catalogName, + productName, + options, + ), + _generateDefaultDeviceGroupsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _countDevicesSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + options: ProductsCountDevicesOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/countDevices{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _countDevicesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return countDevicesResponseDeserializer(result.body); +} + +/** Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ +export async function countDevices( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + options: ProductsCountDevicesOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _countDevicesSend( + context, + resourceGroupName, + catalogName, + productName, + options, + ); + return _countDevicesDeserialize(result); +} + +export function _listByCatalogSend( + context: Client, + resourceGroupName: string, + catalogName: string, + options: ProductsListByCatalogOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listByCatalogDeserialize( + result: PathUncheckedResponse, +): Promise<_ProductListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _productListResultDeserializer(result.body); +} + +/** List Product resources by Catalog */ +export function listByCatalog( + context: Client, + resourceGroupName: string, + catalogName: string, + options: ProductsListByCatalogOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByCatalogSend(context, resourceGroupName, catalogName, options), + _listByCatalogDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + options: ProductsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202", "204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + options: ProductsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["200", "202", "204"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, catalogName, productName, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + properties: ProductUpdate, + options: ProductsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: productUpdateSerializer(properties), + }); +} + +export async function _updateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return productDeserializer(result.body); +} + +/** Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ +export function update( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + properties: ProductUpdate, + options: ProductsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Product> { + return getLongRunningPoller(context, _updateDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend(context, resourceGroupName, catalogName, productName, properties, options), + resourceLocationConfig: "location", + }) as PollerLike, Product>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + resource: Product, + options: ProductsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: productSerializer(resource), + }); +} + +export async function _createOrUpdateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return productDeserializer(result.body); +} + +/** Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + resource: Product, + options: ProductsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Product> { + return getLongRunningPoller(context, _createOrUpdateDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend(context, resourceGroupName, catalogName, productName, resource, options), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, Product>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + options: ProductsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + catalogName: catalogName, + productName: productName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return productDeserializer(result.body); +} + +/** Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ +export async function get( + context: Client, + resourceGroupName: string, + catalogName: string, + productName: string, + options: ProductsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, catalogName, productName, options); + return _getDeserialize(result); +} diff --git a/sdk/sphere/arm-sphere/src/api/products/options.ts b/sdk/sphere/arm-sphere/src/api/products/options.ts new file mode 100644 index 000000000000..fbad08e02a69 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/api/products/options.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface ProductsGenerateDefaultDeviceGroupsOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ProductsCountDevicesOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ProductsListByCatalogOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface ProductsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ProductsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ProductsCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface ProductsGetOptionalParams extends OperationOptions {} diff --git a/sdk/sphere/arm-sphere/src/azureSphereClient.ts b/sdk/sphere/arm-sphere/src/azureSphereClient.ts new file mode 100644 index 000000000000..4e5468c13fe2 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/azureSphereClient.ts @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + createAzureSphere, + AzureSphereContext, + AzureSphereClientOptionalParams, +} from "./api/index.js"; +import { DevicesOperations, _getDevicesOperations } from "./classic/devices/index.js"; +import { DeploymentsOperations, _getDeploymentsOperations } from "./classic/deployments/index.js"; +import { + DeviceGroupsOperations, + _getDeviceGroupsOperations, +} from "./classic/deviceGroups/index.js"; +import { ProductsOperations, _getProductsOperations } from "./classic/products/index.js"; +import { ImagesOperations, _getImagesOperations } from "./classic/images/index.js"; +import { + CertificatesOperations, + _getCertificatesOperations, +} from "./classic/certificates/index.js"; +import { CatalogsOperations, _getCatalogsOperations } from "./classic/catalogs/index.js"; +import { OperationsOperations, _getOperationsOperations } from "./classic/operations/index.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { TokenCredential } from "@azure/core-auth"; + +export { AzureSphereClientOptionalParams } from "./api/azureSphereContext.js"; + +export class AzureSphereClient { + private _client: AzureSphereContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** Azure Sphere resource management API. */ + constructor( + credential: TokenCredential, + subscriptionId: string, + options: AzureSphereClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createAzureSphere(credential, subscriptionId, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.devices = _getDevicesOperations(this._client); + this.deployments = _getDeploymentsOperations(this._client); + this.deviceGroups = _getDeviceGroupsOperations(this._client); + this.products = _getProductsOperations(this._client); + this.images = _getImagesOperations(this._client); + this.certificates = _getCertificatesOperations(this._client); + this.catalogs = _getCatalogsOperations(this._client); + this.operations = _getOperationsOperations(this._client); + } + + /** The operation groups for devices */ + public readonly devices: DevicesOperations; + /** The operation groups for deployments */ + public readonly deployments: DeploymentsOperations; + /** The operation groups for deviceGroups */ + public readonly deviceGroups: DeviceGroupsOperations; + /** The operation groups for products */ + public readonly products: ProductsOperations; + /** The operation groups for images */ + public readonly images: ImagesOperations; + /** The operation groups for certificates */ + public readonly certificates: CertificatesOperations; + /** The operation groups for catalogs */ + public readonly catalogs: CatalogsOperations; + /** The operation groups for operations */ + public readonly operations: OperationsOperations; +} diff --git a/sdk/sphere/arm-sphere/src/azureSphereManagementClient.ts b/sdk/sphere/arm-sphere/src/azureSphereManagementClient.ts deleted file mode 100644 index db7d89061973..000000000000 --- a/sdk/sphere/arm-sphere/src/azureSphereManagementClient.ts +++ /dev/null @@ -1,173 +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 coreClient from "@azure/core-client"; -import * as coreRestPipeline from "@azure/core-rest-pipeline"; -import { - PipelineRequest, - PipelineResponse, - SendRequest, -} from "@azure/core-rest-pipeline"; -import * as coreAuth from "@azure/core-auth"; -import { - OperationsImpl, - CatalogsImpl, - CertificatesImpl, - ImagesImpl, - ProductsImpl, - DeviceGroupsImpl, - DeploymentsImpl, - DevicesImpl, -} from "./operations/index.js"; -import { - Operations, - Catalogs, - Certificates, - Images, - Products, - DeviceGroups, - Deployments, - Devices, -} from "./operationsInterfaces/index.js"; -import { AzureSphereManagementClientOptionalParams } from "./models/index.js"; - -export class AzureSphereManagementClient extends coreClient.ServiceClient { - $host: string; - apiVersion: string; - subscriptionId: string; - - /** - * Initializes a new instance of the AzureSphereManagementClient class. - * @param credentials Subscription credentials which uniquely identify client subscription. - * @param subscriptionId The ID of the target subscription. - * @param options The parameter options - */ - constructor( - credentials: coreAuth.TokenCredential, - subscriptionId: string, - options?: AzureSphereManagementClientOptionalParams, - ) { - 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: AzureSphereManagementClientOptionalParams = { - requestContentType: "application/json; charset=utf-8", - credential: credentials, - }; - - const packageDetails = `azsdk-js-arm-sphere/1.0.1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; - - const optionsWithDefaults = { - ...defaults, - ...options, - userAgentOptions: { - userAgentPrefix, - }, - endpoint: - options.endpoint ?? options.baseUri ?? "https://management.azure.com", - }; - super(optionsWithDefaults); - - let bearerTokenAuthenticationPolicyFound: boolean = false; - if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = - options.pipeline.getOrderedPolicies(); - bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( - (pipelinePolicy) => - pipelinePolicy.name === - coreRestPipeline.bearerTokenAuthenticationPolicyName, - ); - } - if ( - !options || - !options.pipeline || - options.pipeline.getOrderedPolicies().length == 0 || - !bearerTokenAuthenticationPolicyFound - ) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName, - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - credential: credentials, - scopes: - optionsWithDefaults.credentialScopes ?? - `${optionsWithDefaults.endpoint}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge, - }, - }), - ); - } - // Parameter assignments - this.subscriptionId = subscriptionId; - - // Assigning values to Constant parameters - this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2024-04-01"; - this.operations = new OperationsImpl(this); - this.catalogs = new CatalogsImpl(this); - this.certificates = new CertificatesImpl(this); - this.images = new ImagesImpl(this); - this.products = new ProductsImpl(this); - this.deviceGroups = new DeviceGroupsImpl(this); - this.deployments = new DeploymentsImpl(this); - this.devices = new DevicesImpl(this); - this.addCustomApiVersionPolicy(options.apiVersion); - } - - /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ - private addCustomApiVersionPolicy(apiVersion?: string) { - if (!apiVersion) { - return; - } - const apiVersionPolicy = { - name: "CustomApiVersionPolicy", - async sendRequest( - request: PipelineRequest, - next: SendRequest, - ): Promise { - const param = request.url.split("?"); - if (param.length > 1) { - const newParams = param[1].split("&").map((item) => { - if (item.indexOf("api-version") > -1) { - return "api-version=" + apiVersion; - } else { - return item; - } - }); - request.url = param[0] + "?" + newParams.join("&"); - } - return next(request); - }, - }; - this.pipeline.addPolicy(apiVersionPolicy); - } - - operations: Operations; - catalogs: Catalogs; - certificates: Certificates; - images: Images; - products: Products; - deviceGroups: DeviceGroups; - deployments: Deployments; - devices: Devices; -} diff --git a/sdk/sphere/arm-sphere/src/classic/catalogs/index.ts b/sdk/sphere/arm-sphere/src/classic/catalogs/index.ts new file mode 100644 index 000000000000..2c9e2633bb2b --- /dev/null +++ b/sdk/sphere/arm-sphere/src/classic/catalogs/index.ts @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext } from "../../api/azureSphereContext.js"; +import { + Catalog, + CatalogUpdate, + CountDevicesResponse, + Deployment, + Image, + ListDeviceGroupsRequest, + DeviceGroup, + DeviceInsight, + Device, +} from "../../models/models.js"; +import { + CatalogsUploadImageOptionalParams, + CatalogsListDevicesOptionalParams, + CatalogsListDeviceInsightsOptionalParams, + CatalogsListDeviceGroupsOptionalParams, + CatalogsListDeploymentsOptionalParams, + CatalogsCountDevicesOptionalParams, + CatalogsListBySubscriptionOptionalParams, + CatalogsListByResourceGroupOptionalParams, + CatalogsDeleteOptionalParams, + CatalogsUpdateOptionalParams, + CatalogsCreateOrUpdateOptionalParams, + CatalogsGetOptionalParams, +} from "../../api/catalogs/options.js"; +import { + uploadImage, + listDevices, + listDeviceInsights, + listDeviceGroups, + listDeployments, + countDevices, + listBySubscription, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "../../api/catalogs/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Catalogs operations. */ +export interface CatalogsOperations { + /** Creates an image. Use this action when the image ID is unknown. */ + uploadImage: ( + resourceGroupName: string, + catalogName: string, + uploadImageRequest: Image, + options?: CatalogsUploadImageOptionalParams, + ) => PollerLike, void>; + /** Lists devices for catalog. */ + listDevices: ( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDevicesOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists device insights for catalog. */ + listDeviceInsights: ( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeviceInsightsOptionalParams, + ) => PagedAsyncIterableIterator; + /** List the device groups for the catalog. */ + listDeviceGroups: ( + resourceGroupName: string, + catalogName: string, + listDeviceGroupsRequest: ListDeviceGroupsRequest, + options?: CatalogsListDeviceGroupsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists deployments for catalog. */ + listDeployments: ( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeploymentsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Counts devices in catalog. */ + countDevices: ( + resourceGroupName: string, + catalogName: string, + options?: CatalogsCountDevicesOptionalParams, + ) => Promise; + /** List Catalog resources by subscription ID */ + listBySubscription: ( + options?: CatalogsListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; + /** List Catalog resources by resource group */ + listByResourceGroup: ( + resourceGroupName: string, + options?: CatalogsListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a Catalog */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + catalogName: string, + options?: CatalogsDeleteOptionalParams, + ) => PollerLike, void>; + /** Update a Catalog */ + update: ( + resourceGroupName: string, + catalogName: string, + properties: CatalogUpdate, + options?: CatalogsUpdateOptionalParams, + ) => Promise; + /** Create a Catalog */ + createOrUpdate: ( + resourceGroupName: string, + catalogName: string, + resource: Catalog, + options?: CatalogsCreateOrUpdateOptionalParams, + ) => PollerLike, Catalog>; + /** Get a Catalog */ + get: ( + resourceGroupName: string, + catalogName: string, + options?: CatalogsGetOptionalParams, + ) => Promise; +} + +function _getCatalogs(context: AzureSphereContext) { + return { + uploadImage: ( + resourceGroupName: string, + catalogName: string, + uploadImageRequest: Image, + options?: CatalogsUploadImageOptionalParams, + ) => uploadImage(context, resourceGroupName, catalogName, uploadImageRequest, options), + listDevices: ( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDevicesOptionalParams, + ) => listDevices(context, resourceGroupName, catalogName, options), + listDeviceInsights: ( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeviceInsightsOptionalParams, + ) => listDeviceInsights(context, resourceGroupName, catalogName, options), + listDeviceGroups: ( + resourceGroupName: string, + catalogName: string, + listDeviceGroupsRequest: ListDeviceGroupsRequest, + options?: CatalogsListDeviceGroupsOptionalParams, + ) => + listDeviceGroups(context, resourceGroupName, catalogName, listDeviceGroupsRequest, options), + listDeployments: ( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeploymentsOptionalParams, + ) => listDeployments(context, resourceGroupName, catalogName, options), + countDevices: ( + resourceGroupName: string, + catalogName: string, + options?: CatalogsCountDevicesOptionalParams, + ) => countDevices(context, resourceGroupName, catalogName, options), + listBySubscription: (options?: CatalogsListBySubscriptionOptionalParams) => + listBySubscription(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: CatalogsListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + catalogName: string, + options?: CatalogsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, catalogName, options), + update: ( + resourceGroupName: string, + catalogName: string, + properties: CatalogUpdate, + options?: CatalogsUpdateOptionalParams, + ) => update(context, resourceGroupName, catalogName, properties, options), + createOrUpdate: ( + resourceGroupName: string, + catalogName: string, + resource: Catalog, + options?: CatalogsCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, catalogName, resource, options), + get: (resourceGroupName: string, catalogName: string, options?: CatalogsGetOptionalParams) => + get(context, resourceGroupName, catalogName, options), + }; +} + +export function _getCatalogsOperations(context: AzureSphereContext): CatalogsOperations { + return { + ..._getCatalogs(context), + }; +} diff --git a/sdk/sphere/arm-sphere/src/classic/certificates/index.ts b/sdk/sphere/arm-sphere/src/classic/certificates/index.ts new file mode 100644 index 000000000000..8febca87a067 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/classic/certificates/index.ts @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext } from "../../api/azureSphereContext.js"; +import { + Certificate, + CertificateChainResponse, + ProofOfPossessionNonceRequest, + ProofOfPossessionNonceResponse, +} from "../../models/models.js"; +import { + CertificatesRetrieveProofOfPossessionNonceOptionalParams, + CertificatesRetrieveCertChainOptionalParams, + CertificatesListByCatalogOptionalParams, + CertificatesGetOptionalParams, +} from "../../api/certificates/options.js"; +import { + retrieveProofOfPossessionNonce, + retrieveCertChain, + listByCatalog, + get, +} from "../../api/certificates/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Certificates operations. */ +export interface CertificatesOperations { + /** Gets the proof of possession nonce. */ + retrieveProofOfPossessionNonce: ( + resourceGroupName: string, + catalogName: string, + serialNumber: string, + proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, + options?: CertificatesRetrieveProofOfPossessionNonceOptionalParams, + ) => Promise; + /** Retrieves cert chain. */ + retrieveCertChain: ( + resourceGroupName: string, + catalogName: string, + serialNumber: string, + options?: CertificatesRetrieveCertChainOptionalParams, + ) => Promise; + /** List Certificate resources by Catalog */ + listByCatalog: ( + resourceGroupName: string, + catalogName: string, + options?: CertificatesListByCatalogOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get a Certificate */ + get: ( + resourceGroupName: string, + catalogName: string, + serialNumber: string, + options?: CertificatesGetOptionalParams, + ) => Promise; +} + +function _getCertificates(context: AzureSphereContext) { + return { + retrieveProofOfPossessionNonce: ( + resourceGroupName: string, + catalogName: string, + serialNumber: string, + proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, + options?: CertificatesRetrieveProofOfPossessionNonceOptionalParams, + ) => + retrieveProofOfPossessionNonce( + context, + resourceGroupName, + catalogName, + serialNumber, + proofOfPossessionNonceRequest, + options, + ), + retrieveCertChain: ( + resourceGroupName: string, + catalogName: string, + serialNumber: string, + options?: CertificatesRetrieveCertChainOptionalParams, + ) => retrieveCertChain(context, resourceGroupName, catalogName, serialNumber, options), + listByCatalog: ( + resourceGroupName: string, + catalogName: string, + options?: CertificatesListByCatalogOptionalParams, + ) => listByCatalog(context, resourceGroupName, catalogName, options), + get: ( + resourceGroupName: string, + catalogName: string, + serialNumber: string, + options?: CertificatesGetOptionalParams, + ) => get(context, resourceGroupName, catalogName, serialNumber, options), + }; +} + +export function _getCertificatesOperations(context: AzureSphereContext): CertificatesOperations { + return { + ..._getCertificates(context), + }; +} diff --git a/sdk/sphere/arm-sphere/src/classic/deployments/index.ts b/sdk/sphere/arm-sphere/src/classic/deployments/index.ts new file mode 100644 index 000000000000..242a135e37a2 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/classic/deployments/index.ts @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext } from "../../api/azureSphereContext.js"; +import { Deployment } from "../../models/models.js"; +import { + DeploymentsListByDeviceGroupOptionalParams, + DeploymentsDeleteOptionalParams, + DeploymentsCreateOrUpdateOptionalParams, + DeploymentsGetOptionalParams, +} from "../../api/deployments/options.js"; +import { + listByDeviceGroup, + $delete, + createOrUpdate, + get, +} from "../../api/deployments/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Deployments operations. */ +export interface DeploymentsOperations { + /** List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ + listByDeviceGroup: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeploymentsListByDeviceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options?: DeploymentsDeleteOptionalParams, + ) => PollerLike, void>; + /** Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ + createOrUpdate: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + resource: Deployment, + options?: DeploymentsCreateOrUpdateOptionalParams, + ) => PollerLike, Deployment>; + /** Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ + get: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options?: DeploymentsGetOptionalParams, + ) => Promise; +} + +function _getDeployments(context: AzureSphereContext) { + return { + listByDeviceGroup: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeploymentsListByDeviceGroupOptionalParams, + ) => + listByDeviceGroup( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options, + ), + delete: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options?: DeploymentsDeleteOptionalParams, + ) => + $delete( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + resource: Deployment, + options?: DeploymentsCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + resource, + options, + ), + get: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options?: DeploymentsGetOptionalParams, + ) => + get( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + options, + ), + }; +} + +export function _getDeploymentsOperations(context: AzureSphereContext): DeploymentsOperations { + return { + ..._getDeployments(context), + }; +} diff --git a/sdk/sphere/arm-sphere/src/classic/deviceGroups/index.ts b/sdk/sphere/arm-sphere/src/classic/deviceGroups/index.ts new file mode 100644 index 000000000000..c00e7605ff14 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/classic/deviceGroups/index.ts @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext } from "../../api/azureSphereContext.js"; +import { + CountDevicesResponse, + DeviceGroup, + DeviceGroupUpdate, + ClaimDevicesRequest, +} from "../../models/models.js"; +import { + DeviceGroupsCountDevicesOptionalParams, + DeviceGroupsClaimDevicesOptionalParams, + DeviceGroupsListByProductOptionalParams, + DeviceGroupsDeleteOptionalParams, + DeviceGroupsUpdateOptionalParams, + DeviceGroupsCreateOrUpdateOptionalParams, + DeviceGroupsGetOptionalParams, +} from "../../api/deviceGroups/options.js"; +import { + countDevices, + claimDevices, + listByProduct, + $delete, + update, + createOrUpdate, + get, +} from "../../api/deviceGroups/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a DeviceGroups operations. */ +export interface DeviceGroupsOperations { + /** Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ + countDevices: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsCountDevicesOptionalParams, + ) => Promise; + /** Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk claiming devices to a catalog only. */ + claimDevices: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + claimDevicesRequest: ClaimDevicesRequest, + options?: DeviceGroupsClaimDevicesOptionalParams, + ) => PollerLike, void>; + /** List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ + listByProduct: ( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: DeviceGroupsListByProductOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsDeleteOptionalParams, + ) => PollerLike, void>; + /** Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ + update: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + properties: DeviceGroupUpdate, + options?: DeviceGroupsUpdateOptionalParams, + ) => PollerLike, DeviceGroup>; + /** Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ + createOrUpdate: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + resource: DeviceGroup, + options?: DeviceGroupsCreateOrUpdateOptionalParams, + ) => PollerLike, DeviceGroup>; + /** Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ + get: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsGetOptionalParams, + ) => Promise; +} + +function _getDeviceGroups(context: AzureSphereContext) { + return { + countDevices: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsCountDevicesOptionalParams, + ) => + countDevices(context, resourceGroupName, catalogName, productName, deviceGroupName, options), + claimDevices: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + claimDevicesRequest: ClaimDevicesRequest, + options?: DeviceGroupsClaimDevicesOptionalParams, + ) => + claimDevices( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + claimDevicesRequest, + options, + ), + listByProduct: ( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: DeviceGroupsListByProductOptionalParams, + ) => listByProduct(context, resourceGroupName, catalogName, productName, options), + delete: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, catalogName, productName, deviceGroupName, options), + update: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + properties: DeviceGroupUpdate, + options?: DeviceGroupsUpdateOptionalParams, + ) => + update( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + properties, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + resource: DeviceGroup, + options?: DeviceGroupsCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + resource, + options, + ), + get: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsGetOptionalParams, + ) => get(context, resourceGroupName, catalogName, productName, deviceGroupName, options), + }; +} + +export function _getDeviceGroupsOperations(context: AzureSphereContext): DeviceGroupsOperations { + return { + ..._getDeviceGroups(context), + }; +} diff --git a/sdk/sphere/arm-sphere/src/classic/devices/index.ts b/sdk/sphere/arm-sphere/src/classic/devices/index.ts new file mode 100644 index 000000000000..0cbb47fcb9d3 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/classic/devices/index.ts @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext } from "../../api/azureSphereContext.js"; +import { + Device, + DeviceUpdate, + GenerateCapabilityImageRequest, + SignedCapabilityImageResponse, +} from "../../models/models.js"; +import { + DevicesGenerateCapabilityImageOptionalParams, + DevicesListByDeviceGroupOptionalParams, + DevicesDeleteOptionalParams, + DevicesUpdateOptionalParams, + DevicesCreateOrUpdateOptionalParams, + DevicesGetOptionalParams, +} from "../../api/devices/options.js"; +import { + generateCapabilityImage, + listByDeviceGroup, + $delete, + update, + createOrUpdate, + get, +} from "../../api/devices/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Devices operations. */ +export interface DevicesOperations { + /** Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. */ + generateCapabilityImage: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, + options?: DevicesGenerateCapabilityImageOptionalParams, + ) => PollerLike, SignedCapabilityImageResponse>; + /** List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. */ + listByDeviceGroup: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DevicesListByDeviceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a Device */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options?: DevicesDeleteOptionalParams, + ) => PollerLike, void>; + /** Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. */ + update: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + properties: DeviceUpdate, + options?: DevicesUpdateOptionalParams, + ) => PollerLike, Device>; + /** Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the catalog only. */ + createOrUpdate: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + resource: Device, + options?: DevicesCreateOrUpdateOptionalParams, + ) => PollerLike, Device>; + /** Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not belong to a device group and product. */ + get: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options?: DevicesGetOptionalParams, + ) => Promise; +} + +function _getDevices(context: AzureSphereContext) { + return { + generateCapabilityImage: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, + options?: DevicesGenerateCapabilityImageOptionalParams, + ) => + generateCapabilityImage( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest, + options, + ), + listByDeviceGroup: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DevicesListByDeviceGroupOptionalParams, + ) => + listByDeviceGroup( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options, + ), + delete: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options?: DevicesDeleteOptionalParams, + ) => + $delete( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + options, + ), + update: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + properties: DeviceUpdate, + options?: DevicesUpdateOptionalParams, + ) => + update( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + properties, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + resource: Device, + options?: DevicesCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + resource, + options, + ), + get: ( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options?: DevicesGetOptionalParams, + ) => + get( + context, + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + options, + ), + }; +} + +export function _getDevicesOperations(context: AzureSphereContext): DevicesOperations { + return { + ..._getDevices(context), + }; +} diff --git a/sdk/sphere/arm-sphere/src/classic/images/index.ts b/sdk/sphere/arm-sphere/src/classic/images/index.ts new file mode 100644 index 000000000000..ffd43f7b2494 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/classic/images/index.ts @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext } from "../../api/azureSphereContext.js"; +import { Image } from "../../models/models.js"; +import { + ImagesListByCatalogOptionalParams, + ImagesDeleteOptionalParams, + ImagesCreateOrUpdateOptionalParams, + ImagesGetOptionalParams, +} from "../../api/images/options.js"; +import { listByCatalog, $delete, createOrUpdate, get } from "../../api/images/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Images operations. */ +export interface ImagesOperations { + /** List Image resources by Catalog */ + listByCatalog: ( + resourceGroupName: string, + catalogName: string, + options?: ImagesListByCatalogOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a Image */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + catalogName: string, + imageName: string, + options?: ImagesDeleteOptionalParams, + ) => PollerLike, void>; + /** Create a Image */ + createOrUpdate: ( + resourceGroupName: string, + catalogName: string, + imageName: string, + resource: Image, + options?: ImagesCreateOrUpdateOptionalParams, + ) => PollerLike, Image>; + /** Get a Image */ + get: ( + resourceGroupName: string, + catalogName: string, + imageName: string, + options?: ImagesGetOptionalParams, + ) => Promise; +} + +function _getImages(context: AzureSphereContext) { + return { + listByCatalog: ( + resourceGroupName: string, + catalogName: string, + options?: ImagesListByCatalogOptionalParams, + ) => listByCatalog(context, resourceGroupName, catalogName, options), + delete: ( + resourceGroupName: string, + catalogName: string, + imageName: string, + options?: ImagesDeleteOptionalParams, + ) => $delete(context, resourceGroupName, catalogName, imageName, options), + createOrUpdate: ( + resourceGroupName: string, + catalogName: string, + imageName: string, + resource: Image, + options?: ImagesCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, catalogName, imageName, resource, options), + get: ( + resourceGroupName: string, + catalogName: string, + imageName: string, + options?: ImagesGetOptionalParams, + ) => get(context, resourceGroupName, catalogName, imageName, options), + }; +} + +export function _getImagesOperations(context: AzureSphereContext): ImagesOperations { + return { + ..._getImages(context), + }; +} diff --git a/sdk/sphere/arm-sphere/src/classic/index.ts b/sdk/sphere/arm-sphere/src/classic/index.ts new file mode 100644 index 000000000000..0f52c9cd8a23 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/classic/index.ts @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { CatalogsOperations } from "./catalogs/index.js"; +export { CertificatesOperations } from "./certificates/index.js"; +export { DeploymentsOperations } from "./deployments/index.js"; +export { DeviceGroupsOperations } from "./deviceGroups/index.js"; +export { DevicesOperations } from "./devices/index.js"; +export { ImagesOperations } from "./images/index.js"; +export { OperationsOperations } from "./operations/index.js"; +export { ProductsOperations } from "./products/index.js"; diff --git a/sdk/sphere/arm-sphere/src/classic/operations/index.ts b/sdk/sphere/arm-sphere/src/classic/operations/index.ts new file mode 100644 index 000000000000..2bc1300f44fd --- /dev/null +++ b/sdk/sphere/arm-sphere/src/classic/operations/index.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext } from "../../api/azureSphereContext.js"; +import { Operation } from "../../models/models.js"; +import { OperationsListOptionalParams } from "../../api/operations/options.js"; +import { list } from "../../api/operations/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Operations operations. */ +export interface OperationsOperations { + /** List the operations for the provider */ + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +function _getOperations(context: AzureSphereContext) { + return { + list: (options?: OperationsListOptionalParams) => list(context, options), + }; +} + +export function _getOperationsOperations(context: AzureSphereContext): OperationsOperations { + return { + ..._getOperations(context), + }; +} diff --git a/sdk/sphere/arm-sphere/src/classic/products/index.ts b/sdk/sphere/arm-sphere/src/classic/products/index.ts new file mode 100644 index 000000000000..1ce8663e2947 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/classic/products/index.ts @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereContext } from "../../api/azureSphereContext.js"; +import { CountDevicesResponse, DeviceGroup, Product, ProductUpdate } from "../../models/models.js"; +import { + ProductsGenerateDefaultDeviceGroupsOptionalParams, + ProductsCountDevicesOptionalParams, + ProductsListByCatalogOptionalParams, + ProductsDeleteOptionalParams, + ProductsUpdateOptionalParams, + ProductsCreateOrUpdateOptionalParams, + ProductsGetOptionalParams, +} from "../../api/products/options.js"; +import { + generateDefaultDeviceGroups, + countDevices, + listByCatalog, + $delete, + update, + createOrUpdate, + get, +} from "../../api/products/operations.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Products operations. */ +export interface ProductsOperations { + /** Generates default device groups for the product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ + generateDefaultDeviceGroups: ( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsGenerateDefaultDeviceGroupsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ + countDevices: ( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsCountDevicesOptionalParams, + ) => Promise; + /** List Product resources by Catalog */ + listByCatalog: ( + resourceGroupName: string, + catalogName: string, + options?: ProductsListByCatalogOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name' */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsDeleteOptionalParams, + ) => PollerLike, void>; + /** Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ + update: ( + resourceGroupName: string, + catalogName: string, + productName: string, + properties: ProductUpdate, + options?: ProductsUpdateOptionalParams, + ) => PollerLike, Product>; + /** Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ + createOrUpdate: ( + resourceGroupName: string, + catalogName: string, + productName: string, + resource: Product, + options?: ProductsCreateOrUpdateOptionalParams, + ) => PollerLike, Product>; + /** Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. */ + get: ( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsGetOptionalParams, + ) => Promise; +} + +function _getProducts(context: AzureSphereContext) { + return { + generateDefaultDeviceGroups: ( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsGenerateDefaultDeviceGroupsOptionalParams, + ) => generateDefaultDeviceGroups(context, resourceGroupName, catalogName, productName, options), + countDevices: ( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsCountDevicesOptionalParams, + ) => countDevices(context, resourceGroupName, catalogName, productName, options), + listByCatalog: ( + resourceGroupName: string, + catalogName: string, + options?: ProductsListByCatalogOptionalParams, + ) => listByCatalog(context, resourceGroupName, catalogName, options), + delete: ( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, catalogName, productName, options), + update: ( + resourceGroupName: string, + catalogName: string, + productName: string, + properties: ProductUpdate, + options?: ProductsUpdateOptionalParams, + ) => update(context, resourceGroupName, catalogName, productName, properties, options), + createOrUpdate: ( + resourceGroupName: string, + catalogName: string, + productName: string, + resource: Product, + options?: ProductsCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, catalogName, productName, resource, options), + get: ( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsGetOptionalParams, + ) => get(context, resourceGroupName, catalogName, productName, options), + }; +} + +export function _getProductsOperations(context: AzureSphereContext): ProductsOperations { + return { + ..._getProducts(context), + }; +} diff --git a/sdk/sphere/arm-sphere/src/index.ts b/sdk/sphere/arm-sphere/src/index.ts index 07a3842f715d..0a9befbddc89 100644 --- a/sdk/sphere/arm-sphere/src/index.ts +++ b/sdk/sphere/arm-sphere/src/index.ts @@ -1,13 +1,147 @@ -/* - * 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. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. -/// -export { getContinuationToken } from "./pagingHelper.js"; -export * from "./models/index.js"; -export { AzureSphereManagementClient } from "./azureSphereManagementClient.js"; -export * from "./operationsInterfaces/index.js"; +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; + +export { AzureSphereClient } from "./azureSphereClient.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + Catalog, + CatalogProperties, + KnownProvisioningState, + ProvisioningState, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + CatalogUpdate, + CountDevicesResponse, + CountElementsResponse, + Deployment, + DeploymentProperties, + Image, + ImageProperties, + KnownRegionalDataBoundary, + RegionalDataBoundary, + KnownImageType, + ImageType, + ProxyResource, + ListDeviceGroupsRequest, + DeviceGroup, + DeviceGroupProperties, + KnownOSFeedType, + OSFeedType, + KnownUpdatePolicy, + UpdatePolicy, + KnownAllowCrashDumpCollection, + AllowCrashDumpCollection, + DeviceInsight, + Device, + DeviceProperties, + Certificate, + CertificateProperties, + KnownCertificateStatus, + CertificateStatus, + CertificateChainResponse, + ProofOfPossessionNonceRequest, + ProofOfPossessionNonceResponse, + Product, + ProductProperties, + ProductUpdate, + ProductUpdateProperties, + DeviceGroupUpdate, + DeviceGroupUpdateProperties, + ClaimDevicesRequest, + DeviceUpdate, + DeviceUpdateProperties, + GenerateCapabilityImageRequest, + KnownCapabilityType, + CapabilityType, + SignedCapabilityImageResponse, + KnownVersions, +} from "./models/index.js"; +export { AzureSphereClientOptionalParams } from "./api/index.js"; +export { + CatalogsUploadImageOptionalParams, + CatalogsListDevicesOptionalParams, + CatalogsListDeviceInsightsOptionalParams, + CatalogsListDeviceGroupsOptionalParams, + CatalogsListDeploymentsOptionalParams, + CatalogsCountDevicesOptionalParams, + CatalogsListBySubscriptionOptionalParams, + CatalogsListByResourceGroupOptionalParams, + CatalogsDeleteOptionalParams, + CatalogsUpdateOptionalParams, + CatalogsCreateOrUpdateOptionalParams, + CatalogsGetOptionalParams, +} from "./api/catalogs/index.js"; +export { + CertificatesRetrieveProofOfPossessionNonceOptionalParams, + CertificatesRetrieveCertChainOptionalParams, + CertificatesListByCatalogOptionalParams, + CertificatesGetOptionalParams, +} from "./api/certificates/index.js"; +export { + DeploymentsListByDeviceGroupOptionalParams, + DeploymentsDeleteOptionalParams, + DeploymentsCreateOrUpdateOptionalParams, + DeploymentsGetOptionalParams, +} from "./api/deployments/index.js"; +export { + DeviceGroupsCountDevicesOptionalParams, + DeviceGroupsClaimDevicesOptionalParams, + DeviceGroupsListByProductOptionalParams, + DeviceGroupsDeleteOptionalParams, + DeviceGroupsUpdateOptionalParams, + DeviceGroupsCreateOrUpdateOptionalParams, + DeviceGroupsGetOptionalParams, +} from "./api/deviceGroups/index.js"; +export { + DevicesGenerateCapabilityImageOptionalParams, + DevicesListByDeviceGroupOptionalParams, + DevicesDeleteOptionalParams, + DevicesUpdateOptionalParams, + DevicesCreateOrUpdateOptionalParams, + DevicesGetOptionalParams, +} from "./api/devices/index.js"; +export { + ImagesListByCatalogOptionalParams, + ImagesDeleteOptionalParams, + ImagesCreateOrUpdateOptionalParams, + ImagesGetOptionalParams, +} from "./api/images/index.js"; +export { OperationsListOptionalParams } from "./api/operations/index.js"; +export { + ProductsGenerateDefaultDeviceGroupsOptionalParams, + ProductsCountDevicesOptionalParams, + ProductsListByCatalogOptionalParams, + ProductsDeleteOptionalParams, + ProductsUpdateOptionalParams, + ProductsCreateOrUpdateOptionalParams, + ProductsGetOptionalParams, +} from "./api/products/index.js"; +export { + CatalogsOperations, + CertificatesOperations, + DeploymentsOperations, + DeviceGroupsOperations, + DevicesOperations, + ImagesOperations, + OperationsOperations, + ProductsOperations, +} from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/sdk/sphere/arm-sphere/src/logger.ts b/sdk/sphere/arm-sphere/src/logger.ts new file mode 100644 index 000000000000..5b622520177d --- /dev/null +++ b/sdk/sphere/arm-sphere/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-sphere"); diff --git a/sdk/sphere/arm-sphere/src/lroImpl.ts b/sdk/sphere/arm-sphere/src/lroImpl.ts deleted file mode 100644 index d8bc98987053..000000000000 --- a/sdk/sphere/arm-sphere/src/lroImpl.ts +++ /dev/null @@ -1,38 +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 { AbortSignalLike } from "@azure/abort-controller"; -import { LongRunningOperation, LroResponse } from "@azure/core-lro"; - -export function createLroSpec(inputs: { - sendOperationFn: (args: any, spec: any) => Promise>; - args: Record; - spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record; -}): LongRunningOperation { - const { args, spec, sendOperationFn } = inputs; - return { - requestMethod: spec.httpMethod, - requestPath: spec.path!, - sendInitialRequest: () => sendOperationFn(args, spec), - sendPollRequest: ( - path: string, - options?: { abortSignal?: AbortSignalLike }, - ) => { - const { requestBody, ...restSpec } = spec; - return sendOperationFn(args, { - ...restSpec, - httpMethod: "GET", - path, - abortSignal: options?.abortSignal, - }); - }, - }; -} diff --git a/sdk/sphere/arm-sphere/src/models/index.ts b/sdk/sphere/arm-sphere/src/models/index.ts index 3215b07d7c34..dea59aaae489 100644 --- a/sdk/sphere/arm-sphere/src/models/index.ts +++ b/sdk/sphere/arm-sphere/src/models/index.ts @@ -1,1602 +1,68 @@ -/* - * 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 coreClient from "@azure/core-client"; - -/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ -export interface OperationListResult { - /** - * List of operations supported by the resource provider - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Operation[]; - /** - * URL to get the next set of operation list results (if there are any). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Details of a REST API operation, returned from the Resource Provider Operations API */ -export interface Operation { - /** - * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly isDataAction?: boolean; - /** Localized display information for this particular operation. */ - display?: OperationDisplay; - /** - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly origin?: Origin; - /** - * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly actionType?: ActionType; -} - -/** Localized display information for this particular operation. */ -export interface OperationDisplay { - /** - * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provider?: string; - /** - * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly resource?: string; - /** - * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly operation?: string; - /** - * The short, localized friendly description of the operation; suitable for tool tips and detailed views. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; -} - -/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ -export interface ErrorResponse { - /** The error object. */ - error?: ErrorDetail; -} - -/** The error detail. */ -export interface ErrorDetail { - /** - * The error code. - * 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. - */ - readonly message?: string; - /** - * The error target. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly target?: string; - /** - * The error details. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly details?: ErrorDetail[]; - /** - * The error additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly additionalInfo?: ErrorAdditionalInfo[]; -} - -/** The resource management error additional info. */ -export interface ErrorAdditionalInfo { - /** - * The additional info type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * The additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly info?: Record; -} - -/** The response of a Catalog list operation. */ -export interface CatalogListResult { - /** The Catalog items on this page */ - value: Catalog[]; - /** - * The link to the next page of items - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Catalog properties */ -export interface CatalogProperties { - /** - * The Azure Sphere tenant ID associated with the catalog. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly tenantId?: string; - /** - * The status of the last operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; -} - -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface Resource { - /** - * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The name of the resource - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -/** The type used for update operations of the Catalog. */ -export interface CatalogUpdate { - /** Resource tags. */ - tags?: { [propertyName: string]: string }; -} - -/** The response of a Certificate list operation. */ -export interface CertificateListResult { - /** The Certificate items on this page */ - value: Certificate[]; - /** - * The link to the next page of items - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The properties of certificate */ -export interface CertificateProperties { - /** - * The certificate as a UTF-8 encoded base 64 string. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly certificate?: string; - /** - * The certificate status. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: CertificateStatus; - /** - * The certificate subject. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly subject?: string; - /** - * The certificate thumbprint. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly thumbprint?: string; - /** - * The certificate expiry date. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly expiryUtc?: Date; - /** - * The certificate not before date. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly notBeforeUtc?: Date; - /** - * The status of the last operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; -} - -/** The certificate chain response. */ -export interface CertificateChainResponse { - /** - * The certificate chain. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly certificateChain?: string; -} - -/** Request for the proof of possession nonce */ -export interface ProofOfPossessionNonceRequest { - /** The proof of possession nonce */ - proofOfPossessionNonce: string; -} - -/** Response of the count for elements. */ -export interface CountElementsResponse { - /** Number of children resources in parent resource. */ - value: number; -} - -/** The response of a Image list operation. */ -export interface ImageListResult { - /** The Image items on this page */ - value: Image[]; - /** - * The link to the next page of items - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The properties of image */ -export interface ImageProperties { - /** Image as a UTF-8 encoded base 64 string on image create. This field contains the image URI on image reads. */ - image?: string; - /** Image ID */ - imageId?: string; - /** - * Image name - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly imageName?: string; - /** Regional data boundary for an image */ - regionalDataBoundary?: RegionalDataBoundary; - /** - * Location the image - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly uri?: string; - /** - * The image description. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; - /** - * The image component id. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly componentId?: string; - /** - * The image type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly imageType?: ImageType; - /** - * The status of the last operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; -} - -/** The response of a Deployment list operation. */ -export interface DeploymentListResult { - /** The Deployment items on this page */ - value: Deployment[]; - /** - * The link to the next page of items - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The properties of deployment */ -export interface DeploymentProperties { - /** Deployment ID */ - deploymentId?: string; - /** Images deployed */ - deployedImages?: Image[]; - /** - * Deployment date UTC - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly deploymentDateUtc?: Date; - /** - * The status of the last operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; -} - -/** Request of the action to list device groups for a catalog. */ -export interface ListDeviceGroupsRequest { - /** Device Group name. */ - deviceGroupName?: string; -} - -/** The response of a DeviceGroup list operation. */ -export interface DeviceGroupListResult { - /** The DeviceGroup items on this page */ - value: DeviceGroup[]; - /** - * The link to the next page of items - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The properties of deviceGroup */ -export interface DeviceGroupProperties { - /** Description of the device group. */ - description?: string; - /** Operating system feed type of the device group. */ - osFeedType?: OSFeedType; - /** Update policy of the device group. */ - updatePolicy?: UpdatePolicy; - /** Flag to define if the user allows for crash dump collection. */ - allowCrashDumpsCollection?: AllowCrashDumpCollection; - /** Regional data boundary for the device group. */ - regionalDataBoundary?: RegionalDataBoundary; - /** - * Deployment status for the device group. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly hasDeployment?: boolean; - /** - * The status of the last operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; -} - -/** Paged collection of DeviceInsight items */ -export interface PagedDeviceInsight { - /** The DeviceInsight items on this page */ - value: DeviceInsight[]; - /** - * The link to the next page of items - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Device insight report. */ -export interface DeviceInsight { - /** Device ID */ - deviceId: string; - /** Event description */ - description: string; - /** Event start timestamp */ - startTimestampUtc: Date; - /** Event end timestamp */ - endTimestampUtc: Date; - /** Event category */ - eventCategory: string; - /** Event class */ - eventClass: string; - /** Event type */ - eventType: string; - /** Event count */ - eventCount: number; -} - -/** The response of a Device list operation. */ -export interface DeviceListResult { - /** The Device items on this page */ - value: Device[]; - /** - * The link to the next page of items - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The properties of device */ -export interface DeviceProperties { - /** Device ID */ - deviceId?: string; - /** - * SKU of the chip - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly chipSku?: string; - /** - * OS version available for installation when update requested - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly lastAvailableOsVersion?: string; - /** - * OS version running on device when update requested - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly lastInstalledOsVersion?: string; - /** - * Time when update requested and new OS version available - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly lastOsUpdateUtc?: Date; - /** - * Time when update was last requested - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly lastUpdateRequestUtc?: Date; - /** - * The status of the last operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; -} - -/** The response of a Product list operation. */ -export interface ProductListResult { - /** The Product items on this page */ - value: Product[]; - /** - * The link to the next page of items - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** The properties of product */ -export interface ProductProperties { - /** Description of the product */ - description?: string; - /** - * The status of the last operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; -} - -/** The type used for update operations of the Product. */ -export interface ProductUpdate { - /** The updatable properties of the Product. */ - properties?: ProductUpdateProperties; -} - -/** The updatable properties of the Product. */ -export interface ProductUpdateProperties { - /** Description of the product */ - description?: string; -} - -/** The type used for update operations of the DeviceGroup. */ -export interface DeviceGroupUpdate { - /** The updatable properties of the DeviceGroup. */ - properties?: DeviceGroupUpdateProperties; -} - -/** The updatable properties of the DeviceGroup. */ -export interface DeviceGroupUpdateProperties { - /** Description of the device group. */ - description?: string; - /** Operating system feed type of the device group. */ - osFeedType?: OSFeedType; - /** Update policy of the device group. */ - updatePolicy?: UpdatePolicy; - /** Flag to define if the user allows for crash dump collection. */ - allowCrashDumpsCollection?: AllowCrashDumpCollection; - /** Regional data boundary for the device group. */ - regionalDataBoundary?: RegionalDataBoundary; -} - -/** Request to the action call to bulk claim devices. */ -export interface ClaimDevicesRequest { - /** Device identifiers of the devices to be claimed. */ - deviceIdentifiers: string[]; -} - -/** The type used for update operations of the Device. */ -export interface DeviceUpdate { - /** The updatable properties of the Device. */ - properties?: DeviceUpdateProperties; -} - -/** The updatable properties of the Device. */ -export interface DeviceUpdateProperties { - /** Device group id */ - deviceGroupId?: string; -} - -/** Request of the action to create a signed device capability image */ -export interface GenerateCapabilityImageRequest { - /** List of capabilities to create */ - capabilities: CapabilityType[]; -} - -/** Signed device capability image response */ -export interface SignedCapabilityImageResponse { - /** - * The signed device capability image as a UTF-8 encoded base 64 string. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly image?: string; -} - -/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ -export interface TrackedResource extends Resource { - /** Resource tags. */ - tags?: { [propertyName: string]: string }; - /** The geo-location where the resource lives */ - location: string; -} - -/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ -export interface ProxyResource extends Resource {} - -/** Result of the action to generate a proof of possession nonce */ -export interface ProofOfPossessionNonceResponse extends CertificateProperties {} - -/** Response to the action call for count devices in a catalog. */ -export interface CountDevicesResponse extends CountElementsResponse {} - -/** Response to the action call for count devices in a catalog (preview API). */ -export interface CountDeviceResponse extends CountElementsResponse {} - -/** An Azure Sphere catalog */ -export interface Catalog extends TrackedResource { - /** The resource-specific properties for this resource. */ - properties?: CatalogProperties; -} - -/** An certificate resource belonging to a catalog resource. */ -export interface Certificate extends ProxyResource { - /** The resource-specific properties for this resource. */ - properties?: CertificateProperties; -} - -/** An image resource belonging to a catalog resource. */ -export interface Image extends ProxyResource { - /** The resource-specific properties for this resource. */ - properties?: ImageProperties; -} - -/** An deployment resource belonging to a device group resource. */ -export interface Deployment extends ProxyResource { - /** The resource-specific properties for this resource. */ - properties?: DeploymentProperties; -} - -/** An device group resource belonging to a product resource. */ -export interface DeviceGroup extends ProxyResource { - /** The resource-specific properties for this resource. */ - properties?: DeviceGroupProperties; -} - -/** An device resource belonging to a device group resource. */ -export interface Device extends ProxyResource { - /** The resource-specific properties for this resource. */ - properties?: DeviceProperties; -} - -/** An product resource belonging to a catalog resource. */ -export interface Product extends ProxyResource { - /** The resource-specific properties for this resource. */ - properties?: ProductProperties; -} - -/** Defines headers for Catalogs_createOrUpdate operation. */ -export interface CatalogsCreateOrUpdateHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for Catalogs_delete operation. */ -export interface CatalogsDeleteHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; -} - -/** Defines headers for Catalogs_uploadImage operation. */ -export interface CatalogsUploadImageHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; -} - -/** Defines headers for Images_createOrUpdate operation. */ -export interface ImagesCreateOrUpdateHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for Images_delete operation. */ -export interface ImagesDeleteHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; -} - -/** Defines headers for Products_createOrUpdate operation. */ -export interface ProductsCreateOrUpdateHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for Products_update operation. */ -export interface ProductsUpdateHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; -} - -/** Defines headers for Products_delete operation. */ -export interface ProductsDeleteHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; -} - -/** Defines headers for DeviceGroups_createOrUpdate operation. */ -export interface DeviceGroupsCreateOrUpdateHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for DeviceGroups_update operation. */ -export interface DeviceGroupsUpdateHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; -} - -/** Defines headers for DeviceGroups_delete operation. */ -export interface DeviceGroupsDeleteHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; -} - -/** Defines headers for DeviceGroups_claimDevices operation. */ -export interface DeviceGroupsClaimDevicesHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; -} - -/** Defines headers for Deployments_createOrUpdate operation. */ -export interface DeploymentsCreateOrUpdateHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for Deployments_delete operation. */ -export interface DeploymentsDeleteHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; -} - -/** Defines headers for Devices_createOrUpdate operation. */ -export interface DevicesCreateOrUpdateHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for Devices_update operation. */ -export interface DevicesUpdateHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for Devices_delete operation. */ -export interface DevicesDeleteHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; -} - -/** Defines headers for Devices_generateCapabilityImage operation. */ -export interface DevicesGenerateCapabilityImageHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; -} - -/** Known values of {@link Origin} that the service accepts. */ -export enum KnownOrigin { - /** User */ - User = "user", - /** System */ - System = "system", - /** UserSystem */ - UserSystem = "user,system", -} - -/** - * Defines values for Origin. \ - * {@link KnownOrigin} can be used interchangeably with Origin, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **user** \ - * **system** \ - * **user,system** - */ -export type Origin = string; - -/** Known values of {@link ActionType} that the service accepts. */ -export enum KnownActionType { - /** Internal */ - Internal = "Internal", -} - -/** - * Defines values for ActionType. \ - * {@link KnownActionType} can be used interchangeably with ActionType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Internal** - */ -export type ActionType = string; - -/** Known values of {@link ProvisioningState} that the service accepts. */ -export enum KnownProvisioningState { - /** Resource has been created. */ - Succeeded = "Succeeded", - /** Resource creation failed. */ - Failed = "Failed", - /** Resource creation was canceled. */ - Canceled = "Canceled", - /** The resource is being provisioned */ - Provisioning = "Provisioning", - /** The resource is being updated */ - Updating = "Updating", - /** The resource is being deleted */ - Deleting = "Deleting", - /** The resource create request has been accepted */ - Accepted = "Accepted", -} - -/** - * Defines values for ProvisioningState. \ - * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Succeeded**: Resource has been created. \ - * **Failed**: Resource creation failed. \ - * **Canceled**: Resource creation was canceled. \ - * **Provisioning**: The resource is being provisioned \ - * **Updating**: The resource is being updated \ - * **Deleting**: The resource is being deleted \ - * **Accepted**: The resource create request has been accepted - */ -export type ProvisioningState = string; - -/** Known values of {@link CreatedByType} that the service accepts. */ -export enum KnownCreatedByType { - /** User */ - User = "User", - /** Application */ - Application = "Application", - /** ManagedIdentity */ - ManagedIdentity = "ManagedIdentity", - /** Key */ - Key = "Key", -} - -/** - * Defines values for CreatedByType. \ - * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User** \ - * **Application** \ - * **ManagedIdentity** \ - * **Key** - */ -export type CreatedByType = string; - -/** Known values of {@link CertificateStatus} that the service accepts. */ -export enum KnownCertificateStatus { - /** Certificate is active */ - Active = "Active", - /** Certificate is inactive */ - Inactive = "Inactive", - /** Certificate has expired */ - Expired = "Expired", - /** Certificate has been revoked */ - Revoked = "Revoked", -} - -/** - * Defines values for CertificateStatus. \ - * {@link KnownCertificateStatus} can be used interchangeably with CertificateStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Active**: Certificate is active \ - * **Inactive**: Certificate is inactive \ - * **Expired**: Certificate has expired \ - * **Revoked**: Certificate has been revoked - */ -export type CertificateStatus = string; - -/** Known values of {@link RegionalDataBoundary} that the service accepts. */ -export enum KnownRegionalDataBoundary { - /** No data boundary */ - None = "None", - /** EU data boundary */ - EU = "EU", -} - -/** - * Defines values for RegionalDataBoundary. \ - * {@link KnownRegionalDataBoundary} can be used interchangeably with RegionalDataBoundary, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **None**: No data boundary \ - * **EU**: EU data boundary - */ -export type RegionalDataBoundary = string; - -/** Known values of {@link ImageType} that the service accepts. */ -export enum KnownImageType { - /** Invalid image. */ - InvalidImageType = "InvalidImageType", - /** One Bl image type */ - OneBl = "OneBl", - /** Pluton image type */ - PlutonRuntime = "PlutonRuntime", - /** Wifi firmware image type */ - WifiFirmware = "WifiFirmware", - /** Security monitor image type */ - SecurityMonitor = "SecurityMonitor", - /** Normal world loader image type */ - NormalWorldLoader = "NormalWorldLoader", - /** Normal world dtb image type */ - NormalWorldDtb = "NormalWorldDtb", - /** Normal world kernel image type */ - NormalWorldKernel = "NormalWorldKernel", - /** Root FS image type */ - RootFs = "RootFs", - /** Services image type */ - Services = "Services", - /** Applications image type */ - Applications = "Applications", - /** FW config image type */ - FwConfig = "FwConfig", - /** Boot manifest image type */ - BootManifest = "BootManifest", - /** Nwfs image type */ - Nwfs = "Nwfs", - /** Trusted key store image type */ - TrustedKeystore = "TrustedKeystore", - /** Policy image type */ - Policy = "Policy", - /** Customer board config image type */ - CustomerBoardConfig = "CustomerBoardConfig", - /** Update certificate store image type */ - UpdateCertStore = "UpdateCertStore", - /** Base system update manifest image type */ - BaseSystemUpdateManifest = "BaseSystemUpdateManifest", - /** Firmware update manifest image type */ - FirmwareUpdateManifest = "FirmwareUpdateManifest", - /** Customer update manifest image type */ - CustomerUpdateManifest = "CustomerUpdateManifest", - /** Recovery manifest image type */ - RecoveryManifest = "RecoveryManifest", - /** manifest set image type */ - ManifestSet = "ManifestSet", - /** Other image type */ - Other = "Other", -} - -/** - * Defines values for ImageType. \ - * {@link KnownImageType} can be used interchangeably with ImageType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **InvalidImageType**: Invalid image. \ - * **OneBl**: One Bl image type \ - * **PlutonRuntime**: Pluton image type \ - * **WifiFirmware**: Wifi firmware image type \ - * **SecurityMonitor**: Security monitor image type \ - * **NormalWorldLoader**: Normal world loader image type \ - * **NormalWorldDtb**: Normal world dtb image type \ - * **NormalWorldKernel**: Normal world kernel image type \ - * **RootFs**: Root FS image type \ - * **Services**: Services image type \ - * **Applications**: Applications image type \ - * **FwConfig**: FW config image type \ - * **BootManifest**: Boot manifest image type \ - * **Nwfs**: Nwfs image type \ - * **TrustedKeystore**: Trusted key store image type \ - * **Policy**: Policy image type \ - * **CustomerBoardConfig**: Customer board config image type \ - * **UpdateCertStore**: Update certificate store image type \ - * **BaseSystemUpdateManifest**: Base system update manifest image type \ - * **FirmwareUpdateManifest**: Firmware update manifest image type \ - * **CustomerUpdateManifest**: Customer update manifest image type \ - * **RecoveryManifest**: Recovery manifest image type \ - * **ManifestSet**: manifest set image type \ - * **Other**: Other image type - */ -export type ImageType = string; - -/** Known values of {@link OSFeedType} that the service accepts. */ -export enum KnownOSFeedType { - /** Retail OS feed type. */ - Retail = "Retail", - /** Retail evaluation OS feed type. */ - RetailEval = "RetailEval", -} - -/** - * Defines values for OSFeedType. \ - * {@link KnownOSFeedType} can be used interchangeably with OSFeedType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Retail**: Retail OS feed type. \ - * **RetailEval**: Retail evaluation OS feed type. - */ -export type OSFeedType = string; - -/** Known values of {@link UpdatePolicy} that the service accepts. */ -export enum KnownUpdatePolicy { - /** Update all policy. */ - UpdateAll = "UpdateAll", - /** No update for 3rd party app policy. */ - No3RdPartyAppUpdates = "No3rdPartyAppUpdates", -} - -/** - * Defines values for UpdatePolicy. \ - * {@link KnownUpdatePolicy} can be used interchangeably with UpdatePolicy, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **UpdateAll**: Update all policy. \ - * **No3rdPartyAppUpdates**: No update for 3rd party app policy. - */ -export type UpdatePolicy = string; - -/** Known values of {@link AllowCrashDumpCollection} that the service accepts. */ -export enum KnownAllowCrashDumpCollection { - /** Crash dump collection enabled */ - Enabled = "Enabled", - /** Crash dump collection disabled */ - Disabled = "Disabled", -} - -/** - * Defines values for AllowCrashDumpCollection. \ - * {@link KnownAllowCrashDumpCollection} can be used interchangeably with AllowCrashDumpCollection, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: Crash dump collection enabled \ - * **Disabled**: Crash dump collection disabled - */ -export type AllowCrashDumpCollection = string; - -/** Known values of {@link CapabilityType} that the service accepts. */ -export enum KnownCapabilityType { - /** Application development capability */ - ApplicationDevelopment = "ApplicationDevelopment", - /** Field servicing capability */ - FieldServicing = "FieldServicing", -} - -/** - * Defines values for CapabilityType. \ - * {@link KnownCapabilityType} can be used interchangeably with CapabilityType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **ApplicationDevelopment**: Application development capability \ - * **FieldServicing**: Field servicing capability - */ -export type CapabilityType = string; - -/** Optional parameters. */ -export interface OperationsListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type OperationsListResponse = OperationListResult; - -/** Optional parameters. */ -export interface OperationsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type OperationsListNextResponse = OperationListResult; - -/** Optional parameters. */ -export interface CatalogsListBySubscriptionOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscription operation. */ -export type CatalogsListBySubscriptionResponse = CatalogListResult; - -/** Optional parameters. */ -export interface CatalogsListByResourceGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroup operation. */ -export type CatalogsListByResourceGroupResponse = CatalogListResult; - -/** Optional parameters. */ -export interface CatalogsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type CatalogsGetResponse = Catalog; - -/** Optional parameters. */ -export interface CatalogsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type CatalogsCreateOrUpdateResponse = Catalog; - -/** Optional parameters. */ -export interface CatalogsUpdateOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the update operation. */ -export type CatalogsUpdateResponse = Catalog; - -/** Optional parameters. */ -export interface CatalogsDeleteOptionalParams - 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; -} - -/** Optional parameters. */ -export interface CatalogsCountDevicesOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the countDevices operation. */ -export type CatalogsCountDevicesResponse = CountDevicesResponse; - -/** Optional parameters. */ -export interface CatalogsListDeploymentsOptionalParams - extends coreClient.OperationOptions { - /** Filter the result list using the given expression */ - filter?: string; - /** The number of result items to return. */ - top?: number; - /** The number of result items to skip. */ - skip?: number; - /** The maximum number of result items per page. */ - maxpagesize?: number; -} - -/** Contains response data for the listDeployments operation. */ -export type CatalogsListDeploymentsResponse = DeploymentListResult; - -/** Optional parameters. */ -export interface CatalogsListDeviceGroupsOptionalParams - extends coreClient.OperationOptions { - /** Filter the result list using the given expression */ - filter?: string; - /** The number of result items to return. */ - top?: number; - /** The number of result items to skip. */ - skip?: number; - /** The maximum number of result items per page. */ - maxpagesize?: number; -} - -/** Contains response data for the listDeviceGroups operation. */ -export type CatalogsListDeviceGroupsResponse = DeviceGroupListResult; - -/** Optional parameters. */ -export interface CatalogsListDeviceInsightsOptionalParams - extends coreClient.OperationOptions { - /** Filter the result list using the given expression */ - filter?: string; - /** The number of result items to return. */ - top?: number; - /** The number of result items to skip. */ - skip?: number; - /** The maximum number of result items per page. */ - maxpagesize?: number; -} - -/** Contains response data for the listDeviceInsights operation. */ -export type CatalogsListDeviceInsightsResponse = PagedDeviceInsight; - -/** Optional parameters. */ -export interface CatalogsListDevicesOptionalParams - extends coreClient.OperationOptions { - /** Filter the result list using the given expression */ - filter?: string; - /** The number of result items to return. */ - top?: number; - /** The number of result items to skip. */ - skip?: number; - /** The maximum number of result items per page. */ - maxpagesize?: number; -} - -/** Contains response data for the listDevices operation. */ -export type CatalogsListDevicesResponse = DeviceListResult; - -/** Optional parameters. */ -export interface CatalogsUploadImageOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the uploadImage operation. */ -export type CatalogsUploadImageResponse = CatalogsUploadImageHeaders; - -/** Optional parameters. */ -export interface CatalogsListBySubscriptionNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscriptionNext operation. */ -export type CatalogsListBySubscriptionNextResponse = CatalogListResult; - -/** Optional parameters. */ -export interface CatalogsListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroupNext operation. */ -export type CatalogsListByResourceGroupNextResponse = CatalogListResult; - -/** Optional parameters. */ -export interface CatalogsListDeploymentsNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listDeploymentsNext operation. */ -export type CatalogsListDeploymentsNextResponse = DeploymentListResult; - -/** Optional parameters. */ -export interface CatalogsListDeviceGroupsNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listDeviceGroupsNext operation. */ -export type CatalogsListDeviceGroupsNextResponse = DeviceGroupListResult; - -/** Optional parameters. */ -export interface CatalogsListDeviceInsightsNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listDeviceInsightsNext operation. */ -export type CatalogsListDeviceInsightsNextResponse = PagedDeviceInsight; - -/** Optional parameters. */ -export interface CatalogsListDevicesNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listDevicesNext operation. */ -export type CatalogsListDevicesNextResponse = DeviceListResult; - -/** Optional parameters. */ -export interface CertificatesListByCatalogOptionalParams - extends coreClient.OperationOptions { - /** Filter the result list using the given expression */ - filter?: string; - /** The number of result items to return. */ - top?: number; - /** The number of result items to skip. */ - skip?: number; - /** The maximum number of result items per page. */ - maxpagesize?: number; -} - -/** Contains response data for the listByCatalog operation. */ -export type CertificatesListByCatalogResponse = CertificateListResult; - -/** Optional parameters. */ -export interface CertificatesGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type CertificatesGetResponse = Certificate; - -/** Optional parameters. */ -export interface CertificatesRetrieveCertChainOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the retrieveCertChain operation. */ -export type CertificatesRetrieveCertChainResponse = CertificateChainResponse; - -/** Optional parameters. */ -export interface CertificatesRetrieveProofOfPossessionNonceOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the retrieveProofOfPossessionNonce operation. */ -export type CertificatesRetrieveProofOfPossessionNonceResponse = - ProofOfPossessionNonceResponse; - -/** Optional parameters. */ -export interface CertificatesListByCatalogNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByCatalogNext operation. */ -export type CertificatesListByCatalogNextResponse = CertificateListResult; - -/** Optional parameters. */ -export interface ImagesListByCatalogOptionalParams - extends coreClient.OperationOptions { - /** Filter the result list using the given expression */ - filter?: string; - /** The number of result items to return. */ - top?: number; - /** The number of result items to skip. */ - skip?: number; - /** The maximum number of result items per page. */ - maxpagesize?: number; -} - -/** Contains response data for the listByCatalog operation. */ -export type ImagesListByCatalogResponse = ImageListResult; - -/** Optional parameters. */ -export interface ImagesGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type ImagesGetResponse = Image; - -/** Optional parameters. */ -export interface ImagesCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type ImagesCreateOrUpdateResponse = Image; - -/** Optional parameters. */ -export interface ImagesDeleteOptionalParams - 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; -} - -/** Optional parameters. */ -export interface ImagesListByCatalogNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByCatalogNext operation. */ -export type ImagesListByCatalogNextResponse = ImageListResult; - -/** Optional parameters. */ -export interface ProductsListByCatalogOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByCatalog operation. */ -export type ProductsListByCatalogResponse = ProductListResult; - -/** Optional parameters. */ -export interface ProductsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type ProductsGetResponse = Product; - -/** Optional parameters. */ -export interface ProductsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type ProductsCreateOrUpdateResponse = Product; - -/** Optional parameters. */ -export interface ProductsUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type ProductsUpdateResponse = Product; - -/** Optional parameters. */ -export interface ProductsDeleteOptionalParams - 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; -} - -/** Optional parameters. */ -export interface ProductsCountDevicesOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the countDevices operation. */ -export type ProductsCountDevicesResponse = CountDevicesResponse; - -/** Optional parameters. */ -export interface ProductsGenerateDefaultDeviceGroupsOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the generateDefaultDeviceGroups operation. */ -export type ProductsGenerateDefaultDeviceGroupsResponse = DeviceGroupListResult; - -/** Optional parameters. */ -export interface ProductsListByCatalogNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByCatalogNext operation. */ -export type ProductsListByCatalogNextResponse = ProductListResult; - -/** Optional parameters. */ -export interface ProductsGenerateDefaultDeviceGroupsNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the generateDefaultDeviceGroupsNext operation. */ -export type ProductsGenerateDefaultDeviceGroupsNextResponse = - DeviceGroupListResult; - -/** Optional parameters. */ -export interface DeviceGroupsListByProductOptionalParams - extends coreClient.OperationOptions { - /** Filter the result list using the given expression */ - filter?: string; - /** The number of result items to return. */ - top?: number; - /** The number of result items to skip. */ - skip?: number; - /** The maximum number of result items per page. */ - maxpagesize?: number; -} - -/** Contains response data for the listByProduct operation. */ -export type DeviceGroupsListByProductResponse = DeviceGroupListResult; - -/** Optional parameters. */ -export interface DeviceGroupsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type DeviceGroupsGetResponse = DeviceGroup; - -/** Optional parameters. */ -export interface DeviceGroupsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type DeviceGroupsCreateOrUpdateResponse = DeviceGroup; - -/** Optional parameters. */ -export interface DeviceGroupsUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type DeviceGroupsUpdateResponse = DeviceGroup; - -/** Optional parameters. */ -export interface DeviceGroupsDeleteOptionalParams - 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; -} - -/** Optional parameters. */ -export interface DeviceGroupsClaimDevicesOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the claimDevices operation. */ -export type DeviceGroupsClaimDevicesResponse = DeviceGroupsClaimDevicesHeaders; - -/** Optional parameters. */ -export interface DeviceGroupsCountDevicesOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the countDevices operation. */ -export type DeviceGroupsCountDevicesResponse = CountDevicesResponse; - -/** Optional parameters. */ -export interface DeviceGroupsListByProductNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByProductNext operation. */ -export type DeviceGroupsListByProductNextResponse = DeviceGroupListResult; - -/** Optional parameters. */ -export interface DeploymentsListByDeviceGroupOptionalParams - extends coreClient.OperationOptions { - /** Filter the result list using the given expression */ - filter?: string; - /** The number of result items to return. */ - top?: number; - /** The number of result items to skip. */ - skip?: number; - /** The maximum number of result items per page. */ - maxpagesize?: number; -} - -/** Contains response data for the listByDeviceGroup operation. */ -export type DeploymentsListByDeviceGroupResponse = DeploymentListResult; - -/** Optional parameters. */ -export interface DeploymentsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type DeploymentsGetResponse = Deployment; - -/** Optional parameters. */ -export interface DeploymentsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type DeploymentsCreateOrUpdateResponse = Deployment; - -/** Optional parameters. */ -export interface DeploymentsDeleteOptionalParams - 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; -} - -/** Optional parameters. */ -export interface DeploymentsListByDeviceGroupNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByDeviceGroupNext operation. */ -export type DeploymentsListByDeviceGroupNextResponse = DeploymentListResult; - -/** Optional parameters. */ -export interface DevicesListByDeviceGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByDeviceGroup operation. */ -export type DevicesListByDeviceGroupResponse = DeviceListResult; - -/** Optional parameters. */ -export interface DevicesGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type DevicesGetResponse = Device; - -/** Optional parameters. */ -export interface DevicesCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type DevicesCreateOrUpdateResponse = Device; - -/** Optional parameters. */ -export interface DevicesUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the update operation. */ -export type DevicesUpdateResponse = Device; - -/** Optional parameters. */ -export interface DevicesDeleteOptionalParams - 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; -} - -/** Optional parameters. */ -export interface DevicesGenerateCapabilityImageOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the generateCapabilityImage operation. */ -export type DevicesGenerateCapabilityImageResponse = - SignedCapabilityImageResponse; - -/** Optional parameters. */ -export interface DevicesListByDeviceGroupNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByDeviceGroupNext operation. */ -export type DevicesListByDeviceGroupNextResponse = DeviceListResult; - -/** Optional parameters. */ -export interface AzureSphereManagementClientOptionalParams - extends coreClient.ServiceClientOptions { - /** server parameter */ - $host?: string; - /** Api Version */ - apiVersion?: string; - /** Overrides client endpoint. */ - endpoint?: string; -} +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + Catalog, + CatalogProperties, + KnownProvisioningState, + ProvisioningState, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + CatalogUpdate, + CountDevicesResponse, + CountElementsResponse, + Deployment, + DeploymentProperties, + Image, + ImageProperties, + KnownRegionalDataBoundary, + RegionalDataBoundary, + KnownImageType, + ImageType, + ProxyResource, + ListDeviceGroupsRequest, + DeviceGroup, + DeviceGroupProperties, + KnownOSFeedType, + OSFeedType, + KnownUpdatePolicy, + UpdatePolicy, + KnownAllowCrashDumpCollection, + AllowCrashDumpCollection, + DeviceInsight, + Device, + DeviceProperties, + Certificate, + CertificateProperties, + KnownCertificateStatus, + CertificateStatus, + CertificateChainResponse, + ProofOfPossessionNonceRequest, + ProofOfPossessionNonceResponse, + Product, + ProductProperties, + ProductUpdate, + ProductUpdateProperties, + DeviceGroupUpdate, + DeviceGroupUpdateProperties, + ClaimDevicesRequest, + DeviceUpdate, + DeviceUpdateProperties, + GenerateCapabilityImageRequest, + KnownCapabilityType, + CapabilityType, + SignedCapabilityImageResponse, + KnownVersions, +} from "./models.js"; diff --git a/sdk/sphere/arm-sphere/src/models/mappers.ts b/sdk/sphere/arm-sphere/src/models/mappers.ts deleted file mode 100644 index 6c41f0fae324..000000000000 --- a/sdk/sphere/arm-sphere/src/models/mappers.ts +++ /dev/null @@ -1,1691 +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 coreClient from "@azure/core-client"; - -export const OperationListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Operation", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Operation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Operation", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - isDataAction: { - serializedName: "isDataAction", - readOnly: true, - type: { - name: "Boolean", - }, - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay", - }, - }, - origin: { - serializedName: "origin", - readOnly: true, - type: { - name: "String", - }, - }, - actionType: { - serializedName: "actionType", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -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 ErrorResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetail", - }, - }, - }, - }, -}; - -export const ErrorDetail: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorDetail", - modelProperties: { - code: { - serializedName: "code", - readOnly: true, - type: { - name: "String", - }, - }, - message: { - serializedName: "message", - readOnly: true, - type: { - name: "String", - }, - }, - target: { - serializedName: "target", - readOnly: true, - type: { - name: "String", - }, - }, - details: { - serializedName: "details", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorDetail", - }, - }, - }, - }, - additionalInfo: { - serializedName: "additionalInfo", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorAdditionalInfo", - }, - }, - }, - }, - }, - }, -}; - -export const ErrorAdditionalInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorAdditionalInfo", - modelProperties: { - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - info: { - serializedName: "info", - readOnly: true, - type: { - name: "Dictionary", - value: { type: { name: "any" } }, - }, - }, - }, - }, -}; - -export const CatalogListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CatalogListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Catalog", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CatalogProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CatalogProperties", - modelProperties: { - tenantId: { - serializedName: "tenantId", - readOnly: true, - type: { - name: "String", - }, - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Resource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Resource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String", - }, - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String", - }, - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData", - }, - }, - }, - }, -}; - -export const SystemData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SystemData", - modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String", - }, - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String", - }, - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime", - }, - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String", - }, - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", - type: { - name: "String", - }, - }, - lastModifiedAt: { - serializedName: "lastModifiedAt", - type: { - name: "DateTime", - }, - }, - }, - }, -}; - -export const CatalogUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CatalogUpdate", - modelProperties: { - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - }, - }, -}; - -export const CertificateListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CertificateListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Certificate", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CertificateProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CertificateProperties", - modelProperties: { - certificate: { - serializedName: "certificate", - readOnly: true, - type: { - name: "String", - }, - }, - status: { - serializedName: "status", - readOnly: true, - type: { - name: "String", - }, - }, - subject: { - serializedName: "subject", - readOnly: true, - type: { - name: "String", - }, - }, - thumbprint: { - serializedName: "thumbprint", - readOnly: true, - type: { - name: "String", - }, - }, - expiryUtc: { - serializedName: "expiryUtc", - readOnly: true, - type: { - name: "DateTime", - }, - }, - notBeforeUtc: { - serializedName: "notBeforeUtc", - readOnly: true, - type: { - name: "DateTime", - }, - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CertificateChainResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CertificateChainResponse", - modelProperties: { - certificateChain: { - serializedName: "certificateChain", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ProofOfPossessionNonceRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProofOfPossessionNonceRequest", - modelProperties: { - proofOfPossessionNonce: { - serializedName: "proofOfPossessionNonce", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CountElementsResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CountElementsResponse", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const ImageListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ImageListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Image", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ImageProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ImageProperties", - modelProperties: { - image: { - serializedName: "image", - type: { - name: "String", - }, - }, - imageId: { - serializedName: "imageId", - type: { - name: "String", - }, - }, - imageName: { - serializedName: "imageName", - readOnly: true, - type: { - name: "String", - }, - }, - regionalDataBoundary: { - serializedName: "regionalDataBoundary", - type: { - name: "String", - }, - }, - uri: { - serializedName: "uri", - readOnly: true, - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - readOnly: true, - type: { - name: "String", - }, - }, - componentId: { - serializedName: "componentId", - readOnly: true, - type: { - name: "String", - }, - }, - imageType: { - serializedName: "imageType", - readOnly: true, - type: { - name: "String", - }, - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DeploymentListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeploymentListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Deployment", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DeploymentProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeploymentProperties", - modelProperties: { - deploymentId: { - serializedName: "deploymentId", - type: { - name: "String", - }, - }, - deployedImages: { - serializedName: "deployedImages", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Image", - }, - }, - }, - }, - deploymentDateUtc: { - serializedName: "deploymentDateUtc", - readOnly: true, - type: { - name: "DateTime", - }, - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ListDeviceGroupsRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ListDeviceGroupsRequest", - modelProperties: { - deviceGroupName: { - serializedName: "deviceGroupName", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DeviceGroupListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceGroupListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DeviceGroup", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DeviceGroupProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceGroupProperties", - modelProperties: { - description: { - serializedName: "description", - type: { - name: "String", - }, - }, - osFeedType: { - serializedName: "osFeedType", - type: { - name: "String", - }, - }, - updatePolicy: { - serializedName: "updatePolicy", - type: { - name: "String", - }, - }, - allowCrashDumpsCollection: { - serializedName: "allowCrashDumpsCollection", - type: { - name: "String", - }, - }, - regionalDataBoundary: { - serializedName: "regionalDataBoundary", - type: { - name: "String", - }, - }, - hasDeployment: { - serializedName: "hasDeployment", - readOnly: true, - type: { - name: "Boolean", - }, - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const PagedDeviceInsight: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "PagedDeviceInsight", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DeviceInsight", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DeviceInsight: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceInsight", - modelProperties: { - deviceId: { - serializedName: "deviceId", - required: true, - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - required: true, - type: { - name: "String", - }, - }, - startTimestampUtc: { - serializedName: "startTimestampUtc", - required: true, - type: { - name: "DateTime", - }, - }, - endTimestampUtc: { - serializedName: "endTimestampUtc", - required: true, - type: { - name: "DateTime", - }, - }, - eventCategory: { - serializedName: "eventCategory", - required: true, - type: { - name: "String", - }, - }, - eventClass: { - serializedName: "eventClass", - required: true, - type: { - name: "String", - }, - }, - eventType: { - serializedName: "eventType", - required: true, - type: { - name: "String", - }, - }, - eventCount: { - serializedName: "eventCount", - required: true, - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const DeviceListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Device", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DeviceProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceProperties", - modelProperties: { - deviceId: { - serializedName: "deviceId", - type: { - name: "String", - }, - }, - chipSku: { - serializedName: "chipSku", - readOnly: true, - type: { - name: "String", - }, - }, - lastAvailableOsVersion: { - serializedName: "lastAvailableOsVersion", - readOnly: true, - type: { - name: "String", - }, - }, - lastInstalledOsVersion: { - serializedName: "lastInstalledOsVersion", - readOnly: true, - type: { - name: "String", - }, - }, - lastOsUpdateUtc: { - serializedName: "lastOsUpdateUtc", - readOnly: true, - type: { - name: "DateTime", - }, - }, - lastUpdateRequestUtc: { - serializedName: "lastUpdateRequestUtc", - readOnly: true, - type: { - name: "DateTime", - }, - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ProductListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProductListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Product", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ProductProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProductProperties", - modelProperties: { - description: { - serializedName: "description", - type: { - name: "String", - }, - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ProductUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProductUpdate", - modelProperties: { - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "ProductUpdateProperties", - }, - }, - }, - }, -}; - -export const ProductUpdateProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProductUpdateProperties", - modelProperties: { - description: { - serializedName: "description", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DeviceGroupUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceGroupUpdate", - modelProperties: { - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "DeviceGroupUpdateProperties", - }, - }, - }, - }, -}; - -export const DeviceGroupUpdateProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceGroupUpdateProperties", - modelProperties: { - description: { - serializedName: "description", - type: { - name: "String", - }, - }, - osFeedType: { - serializedName: "osFeedType", - type: { - name: "String", - }, - }, - updatePolicy: { - serializedName: "updatePolicy", - type: { - name: "String", - }, - }, - allowCrashDumpsCollection: { - serializedName: "allowCrashDumpsCollection", - type: { - name: "String", - }, - }, - regionalDataBoundary: { - serializedName: "regionalDataBoundary", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ClaimDevicesRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ClaimDevicesRequest", - modelProperties: { - deviceIdentifiers: { - serializedName: "deviceIdentifiers", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const DeviceUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceUpdate", - modelProperties: { - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "DeviceUpdateProperties", - }, - }, - }, - }, -}; - -export const DeviceUpdateProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceUpdateProperties", - modelProperties: { - deviceGroupId: { - serializedName: "deviceGroupId", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const GenerateCapabilityImageRequest: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "GenerateCapabilityImageRequest", - modelProperties: { - capabilities: { - serializedName: "capabilities", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "String", - }, - }, - }, - }, - }, - }, -}; - -export const SignedCapabilityImageResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SignedCapabilityImageResponse", - modelProperties: { - image: { - serializedName: "image", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const TrackedResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TrackedResource", - modelProperties: { - ...Resource.type.modelProperties, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - location: { - serializedName: "location", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ProxyResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProxyResource", - modelProperties: { - ...Resource.type.modelProperties, - }, - }, -}; - -export const ProofOfPossessionNonceResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProofOfPossessionNonceResponse", - modelProperties: { - ...CertificateProperties.type.modelProperties, - }, - }, -}; - -export const CountDevicesResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CountDevicesResponse", - modelProperties: { - ...CountElementsResponse.type.modelProperties, - }, - }, -}; - -export const CountDeviceResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CountDeviceResponse", - modelProperties: { - ...CountElementsResponse.type.modelProperties, - }, - }, -}; - -export const Catalog: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Catalog", - modelProperties: { - ...TrackedResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "CatalogProperties", - }, - }, - }, - }, -}; - -export const Certificate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Certificate", - modelProperties: { - ...ProxyResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "CertificateProperties", - }, - }, - }, - }, -}; - -export const Image: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Image", - modelProperties: { - ...ProxyResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "ImageProperties", - }, - }, - }, - }, -}; - -export const Deployment: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Deployment", - modelProperties: { - ...ProxyResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "DeploymentProperties", - }, - }, - }, - }, -}; - -export const DeviceGroup: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceGroup", - modelProperties: { - ...ProxyResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "DeviceGroupProperties", - }, - }, - }, - }, -}; - -export const Device: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Device", - modelProperties: { - ...ProxyResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "DeviceProperties", - }, - }, - }, - }, -}; - -export const Product: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Product", - modelProperties: { - ...ProxyResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "ProductProperties", - }, - }, - }, - }, -}; - -export const CatalogsCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CatalogsCreateOrUpdateHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const CatalogsDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CatalogsDeleteHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const CatalogsUploadImageHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CatalogsUploadImageHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ImagesCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ImagesCreateOrUpdateHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const ImagesDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ImagesDeleteHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ProductsCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProductsCreateOrUpdateHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const ProductsUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProductsUpdateHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ProductsDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProductsDeleteHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DeviceGroupsCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceGroupsCreateOrUpdateHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const DeviceGroupsUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceGroupsUpdateHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DeviceGroupsDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceGroupsDeleteHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DeviceGroupsClaimDevicesHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeviceGroupsClaimDevicesHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DeploymentsCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeploymentsCreateOrUpdateHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const DeploymentsDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DeploymentsDeleteHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DevicesCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DevicesCreateOrUpdateHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const DevicesUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DevicesUpdateHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const DevicesDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DevicesDeleteHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DevicesGenerateCapabilityImageHeaders: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "DevicesGenerateCapabilityImageHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - }, - }, - }; diff --git a/sdk/sphere/arm-sphere/src/models/models.ts b/sdk/sphere/arm-sphere/src/models/models.ts new file mode 100644 index 000000000000..a0b70b17a54f --- /dev/null +++ b/sdk/sphere/arm-sphere/src/models/models.ts @@ -0,0 +1,1399 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface _OperationListResult { + /** The Operation items on this page */ + value: Operation[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _operationListResultDeserializer(item: any): _OperationListResult { + return { + value: operationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationDeserializer(item); + }); +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ + readonly name?: string; + /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ + readonly origin?: Origin; + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ + readonly actionType?: ActionType; +} + +export function operationDeserializer(item: any): Operation { + return { + name: item["name"], + isDataAction: item["isDataAction"], + display: !item["display"] ? item["display"] : operationDisplayDeserializer(item["display"]), + origin: item["origin"], + actionType: item["actionType"], + }; +} + +/** Localized display information for and operation. */ +export interface OperationDisplay { + /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ + readonly provider?: string; + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ + readonly resource?: string; + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ + readonly operation?: string; + /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ + readonly description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ +export enum KnownOrigin { + /** Indicates the operation is initiated by a user. */ + User = "user", + /** Indicates the operation is initiated by a system. */ + System = "system", + /** Indicates the operation is initiated by a user or system. */ + UserSystem = "user,system", +} + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user**: Indicates the operation is initiated by a user. \ + * **system**: Indicates the operation is initiated by a system. \ + * **user,system**: Indicates the operation is initiated by a user or system. + */ +export type Origin = string; + +/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +export enum KnownActionType { + /** Actions are for internal-only APIs. */ + Internal = "Internal", +} + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal**: Actions are for internal-only APIs. + */ +export type ActionType = string; + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +export function errorResponseDeserializer(item: any): ErrorResponse { + return { + error: !item["error"] ? item["error"] : errorDetailDeserializer(item["error"]), + }; +} + +/** The error detail. */ +export interface ErrorDetail { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: ErrorDetail[]; + /** The error additional info. */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +export function errorDetailDeserializer(item: any): ErrorDetail { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] ? item["details"] : errorDetailArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), + }; +} + +export function errorDetailArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorDetailDeserializer(item); + }); +} + +export function errorAdditionalInfoArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorAdditionalInfoDeserializer(item); + }); +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: Record; +} + +export function errorAdditionalInfoDeserializer(item: any): ErrorAdditionalInfo { + return { + type: item["type"], + info: !item["info"] ? item["info"] : _errorAdditionalInfoInfoDeserializer(item["info"]), + }; +} + +/** model interface _ErrorAdditionalInfoInfo */ +export interface _ErrorAdditionalInfoInfo {} + +export function _errorAdditionalInfoInfoDeserializer(item: any): _ErrorAdditionalInfoInfo { + return item; +} + +/** An Azure Sphere catalog */ +export interface Catalog extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: CatalogProperties; +} + +export function catalogSerializer(item: Catalog): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : catalogPropertiesSerializer(item["properties"]), + }; +} + +export function catalogDeserializer(item: any): Catalog { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : catalogPropertiesDeserializer(item["properties"]), + }; +} + +/** Catalog properties */ +export interface CatalogProperties { + /** The Azure Sphere tenant ID associated with the catalog. */ + readonly tenantId?: string; + /** The status of the last operation. */ + readonly provisioningState?: ProvisioningState; +} + +export function catalogPropertiesSerializer(item: CatalogProperties): any { + return item; +} + +export function catalogPropertiesDeserializer(item: any): CatalogProperties { + return { + tenantId: item["tenantId"], + provisioningState: item["provisioningState"], + }; +} + +/** Provisioning state of resource. */ +export enum KnownProvisioningState { + /** Resource has been created. */ + Succeeded = "Succeeded", + /** Resource creation failed. */ + Failed = "Failed", + /** Resource creation was canceled. */ + Canceled = "Canceled", + /** The resource is being provisioned */ + Provisioning = "Provisioning", + /** The resource is being updated */ + Updating = "Updating", + /** The resource is being deleted */ + Deleting = "Deleting", + /** The resource create request has been accepted */ + Accepted = "Accepted", +} + +/** + * Provisioning state of resource. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: Resource has been created. \ + * **Failed**: Resource creation failed. \ + * **Canceled**: Resource creation was canceled. \ + * **Provisioning**: The resource is being provisioned \ + * **Updating**: The resource is being updated \ + * **Deleting**: The resource is being deleted \ + * **Accepted**: The resource create request has been accepted + */ +export type ProvisioningState = string; + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: item["tags"], + location: item["location"], + }; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(item: Resource): any { + return item; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnowncreatedByType} can be used interchangeably with createdByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** The type used for update operations of the Catalog. */ +export interface CatalogUpdate { + /** Resource tags. */ + tags?: Record; +} + +export function catalogUpdateSerializer(item: CatalogUpdate): any { + return { tags: item["tags"] }; +} + +/** The response of a Catalog list operation. */ +export interface _CatalogListResult { + /** The Catalog items on this page */ + value: Catalog[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _catalogListResultDeserializer(item: any): _CatalogListResult { + return { + value: catalogArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function catalogArraySerializer(result: Array): any[] { + return result.map((item) => { + return catalogSerializer(item); + }); +} + +export function catalogArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return catalogDeserializer(item); + }); +} + +/** Response to the action call for count devices in a catalog. */ +export interface CountDevicesResponse extends CountElementsResponse {} + +export function countDevicesResponseDeserializer(item: any): CountDevicesResponse { + return { + value: item["value"], + }; +} + +/** Response of the count for elements. */ +export interface CountElementsResponse { + /** Number of children resources in parent resource. */ + value: number; +} + +export function countElementsResponseDeserializer(item: any): CountElementsResponse { + return { + value: item["value"], + }; +} + +/** The response of a Deployment list operation. */ +export interface _DeploymentListResult { + /** The Deployment items on this page */ + value: Deployment[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _deploymentListResultDeserializer(item: any): _DeploymentListResult { + return { + value: deploymentArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function deploymentArraySerializer(result: Array): any[] { + return result.map((item) => { + return deploymentSerializer(item); + }); +} + +export function deploymentArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return deploymentDeserializer(item); + }); +} + +/** An deployment resource belonging to a device group resource. */ +export interface Deployment extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: DeploymentProperties; +} + +export function deploymentSerializer(item: Deployment): any { + return { + properties: !item["properties"] + ? item["properties"] + : deploymentPropertiesSerializer(item["properties"]), + }; +} + +export function deploymentDeserializer(item: any): Deployment { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : deploymentPropertiesDeserializer(item["properties"]), + }; +} + +/** The properties of deployment */ +export interface DeploymentProperties { + /** Deployment ID */ + deploymentId?: string; + /** Images deployed */ + deployedImages?: Image[]; + /** Deployment date UTC */ + readonly deploymentDateUtc?: Date; + /** The status of the last operation. */ + readonly provisioningState?: ProvisioningState; +} + +export function deploymentPropertiesSerializer(item: DeploymentProperties): any { + return { + deploymentId: item["deploymentId"], + deployedImages: !item["deployedImages"] + ? item["deployedImages"] + : imageArraySerializer(item["deployedImages"]), + }; +} + +export function deploymentPropertiesDeserializer(item: any): DeploymentProperties { + return { + deploymentId: item["deploymentId"], + deployedImages: !item["deployedImages"] + ? item["deployedImages"] + : imageArrayDeserializer(item["deployedImages"]), + deploymentDateUtc: !item["deploymentDateUtc"] + ? item["deploymentDateUtc"] + : new Date(item["deploymentDateUtc"]), + provisioningState: item["provisioningState"], + }; +} + +export function imageArraySerializer(result: Array): any[] { + return result.map((item) => { + return imageSerializer(item); + }); +} + +export function imageArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return imageDeserializer(item); + }); +} + +/** An image resource belonging to a catalog resource. */ +export interface Image extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: ImageProperties; +} + +export function imageSerializer(item: Image): any { + return { + properties: !item["properties"] + ? item["properties"] + : imagePropertiesSerializer(item["properties"]), + }; +} + +export function imageDeserializer(item: any): Image { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : imagePropertiesDeserializer(item["properties"]), + }; +} + +/** The properties of image */ +export interface ImageProperties { + /** Image as a UTF-8 encoded base 64 string on image create. This field contains the image URI on image reads. */ + image?: string; + /** Image ID */ + imageId?: string; + /** Image name */ + readonly imageName?: string; + /** Regional data boundary for an image */ + regionalDataBoundary?: RegionalDataBoundary; + /** Location the image */ + readonly uri?: string; + /** The image description. */ + readonly description?: string; + /** The image component id. */ + readonly componentId?: string; + /** The image type. */ + readonly imageType?: ImageType; + /** The status of the last operation. */ + readonly provisioningState?: ProvisioningState; +} + +export function imagePropertiesSerializer(item: ImageProperties): any { + return { + image: item["image"], + imageId: item["imageId"], + regionalDataBoundary: item["regionalDataBoundary"], + }; +} + +export function imagePropertiesDeserializer(item: any): ImageProperties { + return { + image: item["image"], + imageId: item["imageId"], + imageName: item["imageName"], + regionalDataBoundary: item["regionalDataBoundary"], + uri: item["uri"], + description: item["description"], + componentId: item["componentId"], + imageType: item["imageType"], + provisioningState: item["provisioningState"], + }; +} + +/** Regional data boundary values. */ +export enum KnownRegionalDataBoundary { + /** No data boundary */ + None = "None", + /** EU data boundary */ + EU = "EU", +} + +/** + * Regional data boundary values. \ + * {@link KnownRegionalDataBoundary} can be used interchangeably with RegionalDataBoundary, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None**: No data boundary \ + * **EU**: EU data boundary + */ +export type RegionalDataBoundary = string; + +/** Image type values. */ +export enum KnownImageType { + /** Invalid image. */ + InvalidImageType = "InvalidImageType", + /** One Bl image type */ + OneBl = "OneBl", + /** Pluton image type */ + PlutonRuntime = "PlutonRuntime", + /** Wifi firmware image type */ + WifiFirmware = "WifiFirmware", + /** Security monitor image type */ + SecurityMonitor = "SecurityMonitor", + /** Normal world loader image type */ + NormalWorldLoader = "NormalWorldLoader", + /** Normal world dtb image type */ + NormalWorldDtb = "NormalWorldDtb", + /** Normal world kernel image type */ + NormalWorldKernel = "NormalWorldKernel", + /** Root FS image type */ + RootFs = "RootFs", + /** Services image type */ + Services = "Services", + /** Applications image type */ + Applications = "Applications", + /** FW config image type */ + FwConfig = "FwConfig", + /** Boot manifest image type */ + BootManifest = "BootManifest", + /** Nwfs image type */ + Nwfs = "Nwfs", + /** Trusted key store image type */ + TrustedKeystore = "TrustedKeystore", + /** Policy image type */ + Policy = "Policy", + /** Customer board config image type */ + CustomerBoardConfig = "CustomerBoardConfig", + /** Update certificate store image type */ + UpdateCertStore = "UpdateCertStore", + /** Base system update manifest image type */ + BaseSystemUpdateManifest = "BaseSystemUpdateManifest", + /** Firmware update manifest image type */ + FirmwareUpdateManifest = "FirmwareUpdateManifest", + /** Customer update manifest image type */ + CustomerUpdateManifest = "CustomerUpdateManifest", + /** Recovery manifest image type */ + RecoveryManifest = "RecoveryManifest", + /** manifest set image type */ + ManifestSet = "ManifestSet", + /** Other image type */ + Other = "Other", +} + +/** + * Image type values. \ + * {@link KnownImageType} can be used interchangeably with ImageType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **InvalidImageType**: Invalid image. \ + * **OneBl**: One Bl image type \ + * **PlutonRuntime**: Pluton image type \ + * **WifiFirmware**: Wifi firmware image type \ + * **SecurityMonitor**: Security monitor image type \ + * **NormalWorldLoader**: Normal world loader image type \ + * **NormalWorldDtb**: Normal world dtb image type \ + * **NormalWorldKernel**: Normal world kernel image type \ + * **RootFs**: Root FS image type \ + * **Services**: Services image type \ + * **Applications**: Applications image type \ + * **FwConfig**: FW config image type \ + * **BootManifest**: Boot manifest image type \ + * **Nwfs**: Nwfs image type \ + * **TrustedKeystore**: Trusted key store image type \ + * **Policy**: Policy image type \ + * **CustomerBoardConfig**: Customer board config image type \ + * **UpdateCertStore**: Update certificate store image type \ + * **BaseSystemUpdateManifest**: Base system update manifest image type \ + * **FirmwareUpdateManifest**: Firmware update manifest image type \ + * **CustomerUpdateManifest**: Customer update manifest image type \ + * **RecoveryManifest**: Recovery manifest image type \ + * **ManifestSet**: manifest set image type \ + * **Other**: Other image type + */ +export type ImageType = string; + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +export function proxyResourceSerializer(item: ProxyResource): any { + return item; +} + +export function proxyResourceDeserializer(item: any): ProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Request of the action to list device groups for a catalog. */ +export interface ListDeviceGroupsRequest { + /** Device Group name. */ + deviceGroupName?: string; +} + +export function listDeviceGroupsRequestSerializer(item: ListDeviceGroupsRequest): any { + return { deviceGroupName: item["deviceGroupName"] }; +} + +/** The response of a DeviceGroup list operation. */ +export interface _DeviceGroupListResult { + /** The DeviceGroup items on this page */ + value: DeviceGroup[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _deviceGroupListResultDeserializer(item: any): _DeviceGroupListResult { + return { + value: deviceGroupArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function deviceGroupArraySerializer(result: Array): any[] { + return result.map((item) => { + return deviceGroupSerializer(item); + }); +} + +export function deviceGroupArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return deviceGroupDeserializer(item); + }); +} + +/** An device group resource belonging to a product resource. */ +export interface DeviceGroup extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: DeviceGroupProperties; +} + +export function deviceGroupSerializer(item: DeviceGroup): any { + return { + properties: !item["properties"] + ? item["properties"] + : deviceGroupPropertiesSerializer(item["properties"]), + }; +} + +export function deviceGroupDeserializer(item: any): DeviceGroup { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : deviceGroupPropertiesDeserializer(item["properties"]), + }; +} + +/** The properties of deviceGroup */ +export interface DeviceGroupProperties { + /** Description of the device group. */ + description?: string; + /** Operating system feed type of the device group. */ + osFeedType?: OSFeedType; + /** Update policy of the device group. */ + updatePolicy?: UpdatePolicy; + /** Flag to define if the user allows for crash dump collection. */ + allowCrashDumpsCollection?: AllowCrashDumpCollection; + /** Regional data boundary for the device group. */ + regionalDataBoundary?: RegionalDataBoundary; + /** Deployment status for the device group. */ + readonly hasDeployment?: boolean; + /** The status of the last operation. */ + readonly provisioningState?: ProvisioningState; +} + +export function deviceGroupPropertiesSerializer(item: DeviceGroupProperties): any { + return { + description: item["description"], + osFeedType: item["osFeedType"], + updatePolicy: item["updatePolicy"], + allowCrashDumpsCollection: item["allowCrashDumpsCollection"], + regionalDataBoundary: item["regionalDataBoundary"], + }; +} + +export function deviceGroupPropertiesDeserializer(item: any): DeviceGroupProperties { + return { + description: item["description"], + osFeedType: item["osFeedType"], + updatePolicy: item["updatePolicy"], + allowCrashDumpsCollection: item["allowCrashDumpsCollection"], + regionalDataBoundary: item["regionalDataBoundary"], + hasDeployment: item["hasDeployment"], + provisioningState: item["provisioningState"], + }; +} + +/** OS feed type values. */ +export enum KnownOSFeedType { + /** Retail OS feed type. */ + Retail = "Retail", + /** Retail evaluation OS feed type. */ + RetailEval = "RetailEval", +} + +/** + * OS feed type values. \ + * {@link KnownOSFeedType} can be used interchangeably with OSFeedType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Retail**: Retail OS feed type. \ + * **RetailEval**: Retail evaluation OS feed type. + */ +export type OSFeedType = string; + +/** Update policy values. */ +export enum KnownUpdatePolicy { + /** Update all policy. */ + UpdateAll = "UpdateAll", + /** No update for 3rd party app policy. */ + No3RdPartyAppUpdates = "No3rdPartyAppUpdates", +} + +/** + * Update policy values. \ + * {@link KnownUpdatePolicy} can be used interchangeably with UpdatePolicy, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **UpdateAll**: Update all policy. \ + * **No3rdPartyAppUpdates**: No update for 3rd party app policy. + */ +export type UpdatePolicy = string; + +/** Allow crash dumps values. */ +export enum KnownAllowCrashDumpCollection { + /** Crash dump collection enabled */ + Enabled = "Enabled", + /** Crash dump collection disabled */ + Disabled = "Disabled", +} + +/** + * Allow crash dumps values. \ + * {@link KnownAllowCrashDumpCollection} can be used interchangeably with AllowCrashDumpCollection, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled**: Crash dump collection enabled \ + * **Disabled**: Crash dump collection disabled + */ +export type AllowCrashDumpCollection = string; + +/** Paged collection of DeviceInsight items */ +export interface _PagedDeviceInsight { + /** The DeviceInsight items on this page */ + value: DeviceInsight[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _pagedDeviceInsightDeserializer(item: any): _PagedDeviceInsight { + return { + value: deviceInsightArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function deviceInsightArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return deviceInsightDeserializer(item); + }); +} + +/** Device insight report. */ +export interface DeviceInsight { + /** Device ID */ + deviceId: string; + /** Event description */ + description: string; + /** Event start timestamp */ + startTimestampUtc: Date; + /** Event end timestamp */ + endTimestampUtc: Date; + /** Event category */ + eventCategory: string; + /** Event class */ + eventClass: string; + /** Event type */ + eventType: string; + /** Event count */ + eventCount: number; +} + +export function deviceInsightDeserializer(item: any): DeviceInsight { + return { + deviceId: item["deviceId"], + description: item["description"], + startTimestampUtc: new Date(item["startTimestampUtc"]), + endTimestampUtc: new Date(item["endTimestampUtc"]), + eventCategory: item["eventCategory"], + eventClass: item["eventClass"], + eventType: item["eventType"], + eventCount: item["eventCount"], + }; +} + +/** The response of a Device list operation. */ +export interface _DeviceListResult { + /** The Device items on this page */ + value: Device[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _deviceListResultDeserializer(item: any): _DeviceListResult { + return { + value: deviceArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function deviceArraySerializer(result: Array): any[] { + return result.map((item) => { + return deviceSerializer(item); + }); +} + +export function deviceArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return deviceDeserializer(item); + }); +} + +/** An device resource belonging to a device group resource. */ +export interface Device extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: DeviceProperties; +} + +export function deviceSerializer(item: Device): any { + return { + properties: !item["properties"] + ? item["properties"] + : devicePropertiesSerializer(item["properties"]), + }; +} + +export function deviceDeserializer(item: any): Device { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : devicePropertiesDeserializer(item["properties"]), + }; +} + +/** The properties of device */ +export interface DeviceProperties { + /** Device ID */ + deviceId?: string; + /** SKU of the chip */ + readonly chipSku?: string; + /** OS version available for installation when update requested */ + readonly lastAvailableOsVersion?: string; + /** OS version running on device when update requested */ + readonly lastInstalledOsVersion?: string; + /** Time when update requested and new OS version available */ + readonly lastOsUpdateUtc?: Date; + /** Time when update was last requested */ + readonly lastUpdateRequestUtc?: Date; + /** The status of the last operation. */ + readonly provisioningState?: ProvisioningState; +} + +export function devicePropertiesSerializer(item: DeviceProperties): any { + return { deviceId: item["deviceId"] }; +} + +export function devicePropertiesDeserializer(item: any): DeviceProperties { + return { + deviceId: item["deviceId"], + chipSku: item["chipSku"], + lastAvailableOsVersion: item["lastAvailableOsVersion"], + lastInstalledOsVersion: item["lastInstalledOsVersion"], + lastOsUpdateUtc: !item["lastOsUpdateUtc"] + ? item["lastOsUpdateUtc"] + : new Date(item["lastOsUpdateUtc"]), + lastUpdateRequestUtc: !item["lastUpdateRequestUtc"] + ? item["lastUpdateRequestUtc"] + : new Date(item["lastUpdateRequestUtc"]), + provisioningState: item["provisioningState"], + }; +} + +/** An certificate resource belonging to a catalog resource. */ +export interface Certificate extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: CertificateProperties; +} + +export function certificateDeserializer(item: any): Certificate { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : certificatePropertiesDeserializer(item["properties"]), + }; +} + +/** The properties of certificate */ +export interface CertificateProperties { + /** The certificate as a UTF-8 encoded base 64 string. */ + readonly certificate?: string; + /** The certificate status. */ + readonly status?: CertificateStatus; + /** The certificate subject. */ + readonly subject?: string; + /** The certificate thumbprint. */ + readonly thumbprint?: string; + /** The certificate expiry date. */ + readonly expiryUtc?: Date; + /** The certificate not before date. */ + readonly notBeforeUtc?: Date; + /** The status of the last operation. */ + readonly provisioningState?: ProvisioningState; +} + +export function certificatePropertiesDeserializer(item: any): CertificateProperties { + return { + certificate: item["certificate"], + status: item["status"], + subject: item["subject"], + thumbprint: item["thumbprint"], + expiryUtc: !item["expiryUtc"] ? item["expiryUtc"] : new Date(item["expiryUtc"]), + notBeforeUtc: !item["notBeforeUtc"] ? item["notBeforeUtc"] : new Date(item["notBeforeUtc"]), + provisioningState: item["provisioningState"], + }; +} + +/** Certificate status values. */ +export enum KnownCertificateStatus { + /** Certificate is active */ + Active = "Active", + /** Certificate is inactive */ + Inactive = "Inactive", + /** Certificate has expired */ + Expired = "Expired", + /** Certificate has been revoked */ + Revoked = "Revoked", +} + +/** + * Certificate status values. \ + * {@link KnownCertificateStatus} can be used interchangeably with CertificateStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active**: Certificate is active \ + * **Inactive**: Certificate is inactive \ + * **Expired**: Certificate has expired \ + * **Revoked**: Certificate has been revoked + */ +export type CertificateStatus = string; + +/** The response of a Certificate list operation. */ +export interface _CertificateListResult { + /** The Certificate items on this page */ + value: Certificate[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _certificateListResultDeserializer(item: any): _CertificateListResult { + return { + value: certificateArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function certificateArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return certificateDeserializer(item); + }); +} + +/** The certificate chain response. */ +export interface CertificateChainResponse { + /** The certificate chain. */ + readonly certificateChain?: string; +} + +export function certificateChainResponseDeserializer(item: any): CertificateChainResponse { + return { + certificateChain: item["certificateChain"], + }; +} + +/** Request for the proof of possession nonce */ +export interface ProofOfPossessionNonceRequest { + /** The proof of possession nonce */ + proofOfPossessionNonce: string; +} + +export function proofOfPossessionNonceRequestSerializer(item: ProofOfPossessionNonceRequest): any { + return { proofOfPossessionNonce: item["proofOfPossessionNonce"] }; +} + +/** Result of the action to generate a proof of possession nonce */ +export interface ProofOfPossessionNonceResponse extends CertificateProperties {} + +export function proofOfPossessionNonceResponseDeserializer( + item: any, +): ProofOfPossessionNonceResponse { + return { + certificate: item["certificate"], + status: item["status"], + subject: item["subject"], + thumbprint: item["thumbprint"], + expiryUtc: !item["expiryUtc"] ? item["expiryUtc"] : new Date(item["expiryUtc"]), + notBeforeUtc: !item["notBeforeUtc"] ? item["notBeforeUtc"] : new Date(item["notBeforeUtc"]), + provisioningState: item["provisioningState"], + }; +} + +/** The response of a Image list operation. */ +export interface _ImageListResult { + /** The Image items on this page */ + value: Image[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _imageListResultDeserializer(item: any): _ImageListResult { + return { + value: imageArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +/** An product resource belonging to a catalog resource. */ +export interface Product extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: ProductProperties; +} + +export function productSerializer(item: Product): any { + return { + properties: !item["properties"] + ? item["properties"] + : productPropertiesSerializer(item["properties"]), + }; +} + +export function productDeserializer(item: any): Product { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : productPropertiesDeserializer(item["properties"]), + }; +} + +/** The properties of product */ +export interface ProductProperties { + /** Description of the product */ + description?: string; + /** The status of the last operation. */ + readonly provisioningState?: ProvisioningState; +} + +export function productPropertiesSerializer(item: ProductProperties): any { + return { description: item["description"] }; +} + +export function productPropertiesDeserializer(item: any): ProductProperties { + return { + description: item["description"], + provisioningState: item["provisioningState"], + }; +} + +/** The type used for update operations of the Product. */ +export interface ProductUpdate { + /** The updatable properties of the Product. */ + properties?: ProductUpdateProperties; +} + +export function productUpdateSerializer(item: ProductUpdate): any { + return { + properties: !item["properties"] + ? item["properties"] + : productUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** The updatable properties of the Product. */ +export interface ProductUpdateProperties { + /** Description of the product */ + description?: string; +} + +export function productUpdatePropertiesSerializer(item: ProductUpdateProperties): any { + return { description: item["description"] }; +} + +/** The response of a Product list operation. */ +export interface _ProductListResult { + /** The Product items on this page */ + value: Product[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _productListResultDeserializer(item: any): _ProductListResult { + return { + value: productArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function productArraySerializer(result: Array): any[] { + return result.map((item) => { + return productSerializer(item); + }); +} + +export function productArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return productDeserializer(item); + }); +} + +/** The type used for update operations of the DeviceGroup. */ +export interface DeviceGroupUpdate { + /** The updatable properties of the DeviceGroup. */ + properties?: DeviceGroupUpdateProperties; +} + +export function deviceGroupUpdateSerializer(item: DeviceGroupUpdate): any { + return { + properties: !item["properties"] + ? item["properties"] + : deviceGroupUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** The updatable properties of the DeviceGroup. */ +export interface DeviceGroupUpdateProperties { + /** Description of the device group. */ + description?: string; + /** Operating system feed type of the device group. */ + osFeedType?: OSFeedType; + /** Update policy of the device group. */ + updatePolicy?: UpdatePolicy; + /** Flag to define if the user allows for crash dump collection. */ + allowCrashDumpsCollection?: AllowCrashDumpCollection; + /** Regional data boundary for the device group. */ + regionalDataBoundary?: RegionalDataBoundary; +} + +export function deviceGroupUpdatePropertiesSerializer(item: DeviceGroupUpdateProperties): any { + return { + description: item["description"], + osFeedType: item["osFeedType"], + updatePolicy: item["updatePolicy"], + allowCrashDumpsCollection: item["allowCrashDumpsCollection"], + regionalDataBoundary: item["regionalDataBoundary"], + }; +} + +/** Request to the action call to bulk claim devices. */ +export interface ClaimDevicesRequest { + /** Device identifiers of the devices to be claimed. */ + deviceIdentifiers: string[]; +} + +export function claimDevicesRequestSerializer(item: ClaimDevicesRequest): any { + return { + deviceIdentifiers: item["deviceIdentifiers"].map((p: any) => { + return p; + }), + }; +} + +/** The type used for update operations of the Device. */ +export interface DeviceUpdate { + /** The updatable properties of the Device. */ + properties?: DeviceUpdateProperties; +} + +export function deviceUpdateSerializer(item: DeviceUpdate): any { + return { + properties: !item["properties"] + ? item["properties"] + : deviceUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** The updatable properties of the Device. */ +export interface DeviceUpdateProperties { + /** Device group id */ + deviceGroupId?: string; +} + +export function deviceUpdatePropertiesSerializer(item: DeviceUpdateProperties): any { + return { deviceGroupId: item["deviceGroupId"] }; +} + +/** Request of the action to create a signed device capability image */ +export interface GenerateCapabilityImageRequest { + /** List of capabilities to create */ + capabilities: CapabilityType[]; +} + +export function generateCapabilityImageRequestSerializer( + item: GenerateCapabilityImageRequest, +): any { + return { + capabilities: item["capabilities"].map((p: any) => { + return p; + }), + }; +} + +/** Capability image type */ +export enum KnownCapabilityType { + /** Application development capability */ + ApplicationDevelopment = "ApplicationDevelopment", + /** Field servicing capability */ + FieldServicing = "FieldServicing", +} + +/** + * Capability image type \ + * {@link KnownCapabilityType} can be used interchangeably with CapabilityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ApplicationDevelopment**: Application development capability \ + * **FieldServicing**: Field servicing capability + */ +export type CapabilityType = string; + +/** Signed device capability image response */ +export interface SignedCapabilityImageResponse { + /** The signed device capability image as a UTF-8 encoded base 64 string. */ + readonly image?: string; +} + +export function signedCapabilityImageResponseDeserializer( + item: any, +): SignedCapabilityImageResponse { + return { + image: item["image"], + }; +} + +/** The available API versions. */ +export enum KnownVersions { + /** The 2024-04-01 API version. */ + V20240401 = "2024-04-01", +} diff --git a/sdk/sphere/arm-sphere/src/models/parameters.ts b/sdk/sphere/arm-sphere/src/models/parameters.ts deleted file mode 100644 index 1aa354ebef20..000000000000 --- a/sdk/sphere/arm-sphere/src/models/parameters.ts +++ /dev/null @@ -1,326 +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 { - OperationParameter, - OperationURLParameter, - OperationQueryParameter, -} from "@azure/core-client"; -import { - Catalog as CatalogMapper, - CatalogUpdate as CatalogUpdateMapper, - ListDeviceGroupsRequest as ListDeviceGroupsRequestMapper, - Image as ImageMapper, - ProofOfPossessionNonceRequest as ProofOfPossessionNonceRequestMapper, - Product as ProductMapper, - ProductUpdate as ProductUpdateMapper, - DeviceGroup as DeviceGroupMapper, - DeviceGroupUpdate as DeviceGroupUpdateMapper, - ClaimDevicesRequest as ClaimDevicesRequestMapper, - Deployment as DeploymentMapper, - Device as DeviceMapper, - DeviceUpdate as DeviceUpdateMapper, - GenerateCapabilityImageRequest as GenerateCapabilityImageRequestMapper, -} from "../models/mappers.js"; - -export const accept: OperationParameter = { - parameterPath: "accept", - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Accept", - type: { - name: "String", - }, - }, -}; - -export const $host: OperationURLParameter = { - parameterPath: "$host", - mapper: { - serializedName: "$host", - required: true, - type: { - name: "String", - }, - }, - skipEncoding: true, -}; - -export const apiVersion: OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - defaultValue: "2024-04-01", - isConstant: true, - serializedName: "api-version", - type: { - name: "String", - }, - }, -}; - -export const nextLink: OperationURLParameter = { - parameterPath: "nextLink", - mapper: { - serializedName: "nextLink", - required: true, - type: { - name: "String", - }, - }, - skipEncoding: true, -}; - -export const subscriptionId: OperationURLParameter = { - parameterPath: "subscriptionId", - mapper: { - constraints: { - MinLength: 1, - }, - serializedName: "subscriptionId", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resourceGroupName: OperationURLParameter = { - parameterPath: "resourceGroupName", - mapper: { - constraints: { - MaxLength: 90, - MinLength: 1, - }, - serializedName: "resourceGroupName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const catalogName: OperationURLParameter = { - parameterPath: "catalogName", - mapper: { - constraints: { - Pattern: new RegExp("^[A-Za-z0-9_-]{1,50}$"), - }, - serializedName: "catalogName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Content-Type", - type: { - name: "String", - }, - }, -}; - -export const resource: OperationParameter = { - parameterPath: "resource", - mapper: CatalogMapper, -}; - -export const properties: OperationParameter = { - parameterPath: "properties", - mapper: CatalogUpdateMapper, -}; - -export const filter: OperationQueryParameter = { - parameterPath: ["options", "filter"], - mapper: { - serializedName: "$filter", - type: { - name: "String", - }, - }, -}; - -export const top: OperationQueryParameter = { - parameterPath: ["options", "top"], - mapper: { - serializedName: "$top", - type: { - name: "Number", - }, - }, -}; - -export const skip: OperationQueryParameter = { - parameterPath: ["options", "skip"], - mapper: { - serializedName: "$skip", - type: { - name: "Number", - }, - }, -}; - -export const maxpagesize: OperationQueryParameter = { - parameterPath: ["options", "maxpagesize"], - mapper: { - serializedName: "$maxpagesize", - type: { - name: "Number", - }, - }, -}; - -export const listDeviceGroupsRequest: OperationParameter = { - parameterPath: "listDeviceGroupsRequest", - mapper: ListDeviceGroupsRequestMapper, -}; - -export const uploadImageRequest: OperationParameter = { - parameterPath: "uploadImageRequest", - mapper: ImageMapper, -}; - -export const serialNumber: OperationURLParameter = { - parameterPath: "serialNumber", - mapper: { - serializedName: "serialNumber", - required: true, - type: { - name: "String", - }, - }, -}; - -export const proofOfPossessionNonceRequest: OperationParameter = { - parameterPath: "proofOfPossessionNonceRequest", - mapper: ProofOfPossessionNonceRequestMapper, -}; - -export const imageName: OperationURLParameter = { - parameterPath: "imageName", - mapper: { - serializedName: "imageName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resource1: OperationParameter = { - parameterPath: "resource", - mapper: ImageMapper, -}; - -export const productName: OperationURLParameter = { - parameterPath: "productName", - mapper: { - constraints: { - Pattern: new RegExp( - "^[\\w][\\w\\s]{1,48}[\\w]$|^\\.default$|^\\.unassigned$", - ), - }, - serializedName: "productName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resource2: OperationParameter = { - parameterPath: "resource", - mapper: ProductMapper, -}; - -export const properties1: OperationParameter = { - parameterPath: "properties", - mapper: ProductUpdateMapper, -}; - -export const deviceGroupName: OperationURLParameter = { - parameterPath: "deviceGroupName", - mapper: { - constraints: { - Pattern: new RegExp( - "^[A-Za-z0-9]{1,2}$|^[A-Za-z0-9][A-Za-z0-9\\s]{1,48}[A-Za-z0-9]$|^\\.default$|^\\.unassigned$", - ), - }, - serializedName: "deviceGroupName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resource3: OperationParameter = { - parameterPath: "resource", - mapper: DeviceGroupMapper, -}; - -export const properties2: OperationParameter = { - parameterPath: "properties", - mapper: DeviceGroupUpdateMapper, -}; - -export const claimDevicesRequest: OperationParameter = { - parameterPath: "claimDevicesRequest", - mapper: ClaimDevicesRequestMapper, -}; - -export const deploymentName: OperationURLParameter = { - parameterPath: "deploymentName", - mapper: { - serializedName: "deploymentName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resource4: OperationParameter = { - parameterPath: "resource", - mapper: DeploymentMapper, -}; - -export const deviceName: OperationURLParameter = { - parameterPath: "deviceName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z0-9-]{128}$"), - }, - serializedName: "deviceName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resource5: OperationParameter = { - parameterPath: "resource", - mapper: DeviceMapper, -}; - -export const properties3: OperationParameter = { - parameterPath: "properties", - mapper: DeviceUpdateMapper, -}; - -export const generateDeviceCapabilityRequest: OperationParameter = { - parameterPath: "generateDeviceCapabilityRequest", - mapper: GenerateCapabilityImageRequestMapper, -}; diff --git a/sdk/sphere/arm-sphere/src/operations/catalogs.ts b/sdk/sphere/arm-sphere/src/operations/catalogs.ts deleted file mode 100644 index bc9392a2390c..000000000000 --- a/sdk/sphere/arm-sphere/src/operations/catalogs.ts +++ /dev/null @@ -1,1507 +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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Catalogs } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { AzureSphereManagementClient } from "../azureSphereManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - Catalog, - CatalogsListBySubscriptionNextOptionalParams, - CatalogsListBySubscriptionOptionalParams, - CatalogsListBySubscriptionResponse, - CatalogsListByResourceGroupNextOptionalParams, - CatalogsListByResourceGroupOptionalParams, - CatalogsListByResourceGroupResponse, - Deployment, - CatalogsListDeploymentsNextOptionalParams, - CatalogsListDeploymentsOptionalParams, - CatalogsListDeploymentsResponse, - DeviceGroup, - ListDeviceGroupsRequest, - CatalogsListDeviceGroupsNextOptionalParams, - CatalogsListDeviceGroupsOptionalParams, - CatalogsListDeviceGroupsResponse, - DeviceInsight, - CatalogsListDeviceInsightsNextOptionalParams, - CatalogsListDeviceInsightsOptionalParams, - CatalogsListDeviceInsightsResponse, - Device, - CatalogsListDevicesNextOptionalParams, - CatalogsListDevicesOptionalParams, - CatalogsListDevicesResponse, - CatalogsGetOptionalParams, - CatalogsGetResponse, - CatalogsCreateOrUpdateOptionalParams, - CatalogsCreateOrUpdateResponse, - CatalogUpdate, - CatalogsUpdateOptionalParams, - CatalogsUpdateResponse, - CatalogsDeleteOptionalParams, - CatalogsCountDevicesOptionalParams, - CatalogsCountDevicesResponse, - Image, - CatalogsUploadImageOptionalParams, - CatalogsUploadImageResponse, - CatalogsListBySubscriptionNextResponse, - CatalogsListByResourceGroupNextResponse, - CatalogsListDeploymentsNextResponse, - CatalogsListDeviceGroupsNextResponse, - CatalogsListDeviceInsightsNextResponse, - CatalogsListDevicesNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Catalogs operations. */ -export class CatalogsImpl implements Catalogs { - private readonly client: AzureSphereManagementClient; - - /** - * Initialize a new instance of the class Catalogs class. - * @param client Reference to the service client - */ - constructor(client: AzureSphereManagementClient) { - this.client = client; - } - - /** - * List Catalog resources by subscription ID - * @param options The options parameters. - */ - public listBySubscription( - options?: CatalogsListBySubscriptionOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listBySubscriptionPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listBySubscriptionPagingPage(options, settings); - }, - }; - } - - private async *listBySubscriptionPagingPage( - options?: CatalogsListBySubscriptionOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: CatalogsListBySubscriptionResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listBySubscription(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listBySubscriptionNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listBySubscriptionPagingAll( - options?: CatalogsListBySubscriptionOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listBySubscriptionPagingPage(options)) { - yield* page; - } - } - - /** - * List Catalog resources by resource group - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - public listByResourceGroup( - resourceGroupName: string, - options?: CatalogsListByResourceGroupOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByResourceGroupPagingPage( - resourceGroupName, - options, - settings, - ); - }, - }; - } - - private async *listByResourceGroupPagingPage( - resourceGroupName: string, - options?: CatalogsListByResourceGroupOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: CatalogsListByResourceGroupResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByResourceGroup(resourceGroupName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByResourceGroupNext( - resourceGroupName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByResourceGroupPagingAll( - resourceGroupName: string, - options?: CatalogsListByResourceGroupOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByResourceGroupPagingPage( - resourceGroupName, - options, - )) { - yield* page; - } - } - - /** - * Lists deployments for catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - public listDeployments( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDeploymentsOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listDeploymentsPagingAll( - resourceGroupName, - catalogName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listDeploymentsPagingPage( - resourceGroupName, - catalogName, - options, - settings, - ); - }, - }; - } - - private async *listDeploymentsPagingPage( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDeploymentsOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: CatalogsListDeploymentsResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listDeployments( - resourceGroupName, - catalogName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listDeploymentsNext( - resourceGroupName, - catalogName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listDeploymentsPagingAll( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDeploymentsOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listDeploymentsPagingPage( - resourceGroupName, - catalogName, - options, - )) { - yield* page; - } - } - - /** - * List the device groups for the catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param listDeviceGroupsRequest List device groups for catalog. - * @param options The options parameters. - */ - public listDeviceGroups( - resourceGroupName: string, - catalogName: string, - listDeviceGroupsRequest: ListDeviceGroupsRequest, - options?: CatalogsListDeviceGroupsOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listDeviceGroupsPagingAll( - resourceGroupName, - catalogName, - listDeviceGroupsRequest, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listDeviceGroupsPagingPage( - resourceGroupName, - catalogName, - listDeviceGroupsRequest, - options, - settings, - ); - }, - }; - } - - private async *listDeviceGroupsPagingPage( - resourceGroupName: string, - catalogName: string, - listDeviceGroupsRequest: ListDeviceGroupsRequest, - options?: CatalogsListDeviceGroupsOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: CatalogsListDeviceGroupsResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listDeviceGroups( - resourceGroupName, - catalogName, - listDeviceGroupsRequest, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listDeviceGroupsNext( - resourceGroupName, - catalogName, - listDeviceGroupsRequest, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listDeviceGroupsPagingAll( - resourceGroupName: string, - catalogName: string, - listDeviceGroupsRequest: ListDeviceGroupsRequest, - options?: CatalogsListDeviceGroupsOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listDeviceGroupsPagingPage( - resourceGroupName, - catalogName, - listDeviceGroupsRequest, - options, - )) { - yield* page; - } - } - - /** - * Lists device insights for catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - public listDeviceInsights( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDeviceInsightsOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listDeviceInsightsPagingAll( - resourceGroupName, - catalogName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listDeviceInsightsPagingPage( - resourceGroupName, - catalogName, - options, - settings, - ); - }, - }; - } - - private async *listDeviceInsightsPagingPage( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDeviceInsightsOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: CatalogsListDeviceInsightsResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listDeviceInsights( - resourceGroupName, - catalogName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listDeviceInsightsNext( - resourceGroupName, - catalogName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listDeviceInsightsPagingAll( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDeviceInsightsOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listDeviceInsightsPagingPage( - resourceGroupName, - catalogName, - options, - )) { - yield* page; - } - } - - /** - * Lists devices for catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - public listDevices( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDevicesOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listDevicesPagingAll( - resourceGroupName, - catalogName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listDevicesPagingPage( - resourceGroupName, - catalogName, - options, - settings, - ); - }, - }; - } - - private async *listDevicesPagingPage( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDevicesOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: CatalogsListDevicesResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listDevices(resourceGroupName, catalogName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listDevicesNext( - resourceGroupName, - catalogName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listDevicesPagingAll( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDevicesOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listDevicesPagingPage( - resourceGroupName, - catalogName, - options, - )) { - yield* page; - } - } - - /** - * List Catalog resources by subscription ID - * @param options The options parameters. - */ - private _listBySubscription( - options?: CatalogsListBySubscriptionOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { options }, - listBySubscriptionOperationSpec, - ); - } - - /** - * List Catalog resources by resource group - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - private _listByResourceGroup( - resourceGroupName: string, - options?: CatalogsListByResourceGroupOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, options }, - listByResourceGroupOperationSpec, - ); - } - - /** - * Get a Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - options?: CatalogsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, options }, - getOperationSpec, - ); - } - - /** - * Create a Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - catalogName: string, - resource: Catalog, - options?: CatalogsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - CatalogsCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, catalogName, resource, options }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - CatalogsCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create a Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - catalogName: string, - resource: Catalog, - options?: CatalogsCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - catalogName, - resource, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Update a Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - update( - resourceGroupName: string, - catalogName: string, - properties: CatalogUpdate, - options?: CatalogsUpdateOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, properties, options }, - updateOperationSpec, - ); - } - - /** - * Delete a Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - catalogName: string, - options?: CatalogsDeleteOptionalParams, - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, catalogName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Delete a Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - catalogName: string, - options?: CatalogsDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - catalogName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Counts devices in catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - countDevices( - resourceGroupName: string, - catalogName: string, - options?: CatalogsCountDevicesOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, options }, - countDevicesOperationSpec, - ); - } - - /** - * Lists deployments for catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - private _listDeployments( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDeploymentsOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, options }, - listDeploymentsOperationSpec, - ); - } - - /** - * List the device groups for the catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param listDeviceGroupsRequest List device groups for catalog. - * @param options The options parameters. - */ - private _listDeviceGroups( - resourceGroupName: string, - catalogName: string, - listDeviceGroupsRequest: ListDeviceGroupsRequest, - options?: CatalogsListDeviceGroupsOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, listDeviceGroupsRequest, options }, - listDeviceGroupsOperationSpec, - ); - } - - /** - * Lists device insights for catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - private _listDeviceInsights( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDeviceInsightsOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, options }, - listDeviceInsightsOperationSpec, - ); - } - - /** - * Lists devices for catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - private _listDevices( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDevicesOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, options }, - listDevicesOperationSpec, - ); - } - - /** - * Creates an image. Use this action when the image ID is unknown. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param uploadImageRequest Image upload request body. - * @param options The options parameters. - */ - async beginUploadImage( - resourceGroupName: string, - catalogName: string, - uploadImageRequest: Image, - options?: CatalogsUploadImageOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - CatalogsUploadImageResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, catalogName, uploadImageRequest, options }, - spec: uploadImageOperationSpec, - }); - const poller = await createHttpPoller< - CatalogsUploadImageResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Creates an image. Use this action when the image ID is unknown. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param uploadImageRequest Image upload request body. - * @param options The options parameters. - */ - async beginUploadImageAndWait( - resourceGroupName: string, - catalogName: string, - uploadImageRequest: Image, - options?: CatalogsUploadImageOptionalParams, - ): Promise { - const poller = await this.beginUploadImage( - resourceGroupName, - catalogName, - uploadImageRequest, - options, - ); - return poller.pollUntilDone(); - } - - /** - * ListBySubscriptionNext - * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. - * @param options The options parameters. - */ - private _listBySubscriptionNext( - nextLink: string, - options?: CatalogsListBySubscriptionNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listBySubscriptionNextOperationSpec, - ); - } - - /** - * ListByResourceGroupNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. - * @param options The options parameters. - */ - private _listByResourceGroupNext( - resourceGroupName: string, - nextLink: string, - options?: CatalogsListByResourceGroupNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, nextLink, options }, - listByResourceGroupNextOperationSpec, - ); - } - - /** - * ListDeploymentsNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param nextLink The nextLink from the previous successful call to the ListDeployments method. - * @param options The options parameters. - */ - private _listDeploymentsNext( - resourceGroupName: string, - catalogName: string, - nextLink: string, - options?: CatalogsListDeploymentsNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, nextLink, options }, - listDeploymentsNextOperationSpec, - ); - } - - /** - * ListDeviceGroupsNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param listDeviceGroupsRequest List device groups for catalog. - * @param nextLink The nextLink from the previous successful call to the ListDeviceGroups method. - * @param options The options parameters. - */ - private _listDeviceGroupsNext( - resourceGroupName: string, - catalogName: string, - listDeviceGroupsRequest: ListDeviceGroupsRequest, - nextLink: string, - options?: CatalogsListDeviceGroupsNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - catalogName, - listDeviceGroupsRequest, - nextLink, - options, - }, - listDeviceGroupsNextOperationSpec, - ); - } - - /** - * ListDeviceInsightsNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param nextLink The nextLink from the previous successful call to the ListDeviceInsights method. - * @param options The options parameters. - */ - private _listDeviceInsightsNext( - resourceGroupName: string, - catalogName: string, - nextLink: string, - options?: CatalogsListDeviceInsightsNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, nextLink, options }, - listDeviceInsightsNextOperationSpec, - ); - } - - /** - * ListDevicesNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param nextLink The nextLink from the previous successful call to the ListDevices method. - * @param options The options parameters. - */ - private _listDevicesNext( - resourceGroupName: string, - catalogName: string, - nextLink: string, - options?: CatalogsListDevicesNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, nextLink, options }, - listDevicesNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listBySubscriptionOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.AzureSphere/catalogs", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CatalogListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer, -}; -const listByResourceGroupOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CatalogListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Catalog, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Catalog, - }, - 201: { - bodyMapper: Mappers.Catalog, - }, - 202: { - bodyMapper: Mappers.Catalog, - }, - 204: { - bodyMapper: Mappers.Catalog, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.resource, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.Catalog, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.properties, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const countDevicesOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/countDevices", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.CountDevicesResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listDeploymentsOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeployments", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.DeploymentListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.top, - Parameters.skip, - Parameters.maxpagesize, - ], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listDeviceGroupsOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceGroups", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.DeviceGroupListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.listDeviceGroupsRequest, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.top, - Parameters.skip, - Parameters.maxpagesize, - ], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const listDeviceInsightsOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceInsights", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.PagedDeviceInsight, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.top, - Parameters.skip, - Parameters.maxpagesize, - ], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listDevicesOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDevices", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.DeviceListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.top, - Parameters.skip, - Parameters.maxpagesize, - ], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const uploadImageOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/uploadImage", - httpMethod: "POST", - responses: { - 200: { - headersMapper: Mappers.CatalogsUploadImageHeaders, - }, - 201: { - headersMapper: Mappers.CatalogsUploadImageHeaders, - }, - 202: { - headersMapper: Mappers.CatalogsUploadImageHeaders, - }, - 204: { - headersMapper: Mappers.CatalogsUploadImageHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.uploadImageRequest, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CatalogListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CatalogListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listDeploymentsNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DeploymentListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listDeviceGroupsNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DeviceGroupListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const listDeviceInsightsNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.PagedDeviceInsight, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listDevicesNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DeviceListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/sphere/arm-sphere/src/operations/certificates.ts b/sdk/sphere/arm-sphere/src/operations/certificates.ts deleted file mode 100644 index 6e0339f48423..000000000000 --- a/sdk/sphere/arm-sphere/src/operations/certificates.ts +++ /dev/null @@ -1,350 +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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Certificates } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { AzureSphereManagementClient } from "../azureSphereManagementClient.js"; -import { - Certificate, - CertificatesListByCatalogNextOptionalParams, - CertificatesListByCatalogOptionalParams, - CertificatesListByCatalogResponse, - CertificatesGetOptionalParams, - CertificatesGetResponse, - CertificatesRetrieveCertChainOptionalParams, - CertificatesRetrieveCertChainResponse, - ProofOfPossessionNonceRequest, - CertificatesRetrieveProofOfPossessionNonceOptionalParams, - CertificatesRetrieveProofOfPossessionNonceResponse, - CertificatesListByCatalogNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Certificates operations. */ -export class CertificatesImpl implements Certificates { - private readonly client: AzureSphereManagementClient; - - /** - * Initialize a new instance of the class Certificates class. - * @param client Reference to the service client - */ - constructor(client: AzureSphereManagementClient) { - this.client = client; - } - - /** - * List Certificate resources by Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - public listByCatalog( - resourceGroupName: string, - catalogName: string, - options?: CertificatesListByCatalogOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByCatalogPagingAll( - resourceGroupName, - catalogName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByCatalogPagingPage( - resourceGroupName, - catalogName, - options, - settings, - ); - }, - }; - } - - private async *listByCatalogPagingPage( - resourceGroupName: string, - catalogName: string, - options?: CertificatesListByCatalogOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: CertificatesListByCatalogResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByCatalog( - resourceGroupName, - catalogName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByCatalogNext( - resourceGroupName, - catalogName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByCatalogPagingAll( - resourceGroupName: string, - catalogName: string, - options?: CertificatesListByCatalogOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByCatalogPagingPage( - resourceGroupName, - catalogName, - options, - )) { - yield* page; - } - } - - /** - * List Certificate resources by Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - private _listByCatalog( - resourceGroupName: string, - catalogName: string, - options?: CertificatesListByCatalogOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, options }, - listByCatalogOperationSpec, - ); - } - - /** - * Get a Certificate - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param serialNumber Serial number of the certificate. Use '.default' to get current active - * certificate. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - serialNumber: string, - options?: CertificatesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, serialNumber, options }, - getOperationSpec, - ); - } - - /** - * Retrieves cert chain. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param serialNumber Serial number of the certificate. Use '.default' to get current active - * certificate. - * @param options The options parameters. - */ - retrieveCertChain( - resourceGroupName: string, - catalogName: string, - serialNumber: string, - options?: CertificatesRetrieveCertChainOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, serialNumber, options }, - retrieveCertChainOperationSpec, - ); - } - - /** - * Gets the proof of possession nonce. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param serialNumber Serial number of the certificate. Use '.default' to get current active - * certificate. - * @param proofOfPossessionNonceRequest Proof of possession nonce request body - * @param options The options parameters. - */ - retrieveProofOfPossessionNonce( - resourceGroupName: string, - catalogName: string, - serialNumber: string, - proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, - options?: CertificatesRetrieveProofOfPossessionNonceOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - catalogName, - serialNumber, - proofOfPossessionNonceRequest, - options, - }, - retrieveProofOfPossessionNonceOperationSpec, - ); - } - - /** - * ListByCatalogNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param nextLink The nextLink from the previous successful call to the ListByCatalog method. - * @param options The options parameters. - */ - private _listByCatalogNext( - resourceGroupName: string, - catalogName: string, - nextLink: string, - options?: CertificatesListByCatalogNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, nextLink, options }, - listByCatalogNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByCatalogOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CertificateListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.top, - Parameters.skip, - Parameters.maxpagesize, - ], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Certificate, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.serialNumber, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const retrieveCertChainOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveCertChain", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.CertificateChainResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.serialNumber, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const retrieveProofOfPossessionNonceOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveProofOfPossessionNonce", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.ProofOfPossessionNonceResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.proofOfPossessionNonceRequest, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.serialNumber, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const listByCatalogNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.CertificateListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/sphere/arm-sphere/src/operations/deployments.ts b/sdk/sphere/arm-sphere/src/operations/deployments.ts deleted file mode 100644 index 41e1d8a2b066..000000000000 --- a/sdk/sphere/arm-sphere/src/operations/deployments.ts +++ /dev/null @@ -1,603 +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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Deployments } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { AzureSphereManagementClient } from "../azureSphereManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - Deployment, - DeploymentsListByDeviceGroupNextOptionalParams, - DeploymentsListByDeviceGroupOptionalParams, - DeploymentsListByDeviceGroupResponse, - DeploymentsGetOptionalParams, - DeploymentsGetResponse, - DeploymentsCreateOrUpdateOptionalParams, - DeploymentsCreateOrUpdateResponse, - DeploymentsDeleteOptionalParams, - DeploymentsListByDeviceGroupNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Deployments operations. */ -export class DeploymentsImpl implements Deployments { - private readonly client: AzureSphereManagementClient; - - /** - * Initialize a new instance of the class Deployments class. - * @param client Reference to the service client - */ - constructor(client: AzureSphereManagementClient) { - this.client = client; - } - - /** - * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and - * cannot be used for product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - public listByDeviceGroup( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DeploymentsListByDeviceGroupOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByDeviceGroupPagingAll( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByDeviceGroupPagingPage( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - options, - settings, - ); - }, - }; - } - - private async *listByDeviceGroupPagingPage( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DeploymentsListByDeviceGroupOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: DeploymentsListByDeviceGroupResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByDeviceGroup( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByDeviceGroupNext( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByDeviceGroupPagingAll( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DeploymentsListByDeviceGroupOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByDeviceGroupPagingPage( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - options, - )) { - yield* page; - } - } - - /** - * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and - * cannot be used for product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - private _listByDeviceGroup( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DeploymentsListByDeviceGroupOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, productName, deviceGroupName, options }, - listByDeviceGroupOperationSpec, - ); - } - - /** - * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deploymentName Deployment name. Use .default for deployment creation and to get the current - * deployment for the associated device group. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deploymentName: string, - options?: DeploymentsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, - options, - }, - getOperationSpec, - ); - } - - /** - * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deploymentName Deployment name. Use .default for deployment creation and to get the current - * deployment for the associated device group. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deploymentName: string, - resource: Deployment, - options?: DeploymentsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DeploymentsCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, - resource, - options, - }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - DeploymentsCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deploymentName Deployment name. Use .default for deployment creation and to get the current - * deployment for the associated device group. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deploymentName: string, - resource: Deployment, - options?: DeploymentsCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, - resource, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deploymentName Deployment name. Use .default for deployment creation and to get the current - * deployment for the associated device group. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deploymentName: string, - options?: DeploymentsDeleteOptionalParams, - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, - options, - }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deploymentName Deployment name. Use .default for deployment creation and to get the current - * deployment for the associated device group. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deploymentName: string, - options?: DeploymentsDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deploymentName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * ListByDeviceGroupNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param nextLink The nextLink from the previous successful call to the ListByDeviceGroup method. - * @param options The options parameters. - */ - private _listByDeviceGroupNext( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - nextLink: string, - options?: DeploymentsListByDeviceGroupNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - nextLink, - options, - }, - listByDeviceGroupNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByDeviceGroupOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DeploymentListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.top, - Parameters.skip, - Parameters.maxpagesize, - ], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Deployment, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - Parameters.deploymentName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Deployment, - }, - 201: { - bodyMapper: Mappers.Deployment, - }, - 202: { - bodyMapper: Mappers.Deployment, - }, - 204: { - bodyMapper: Mappers.Deployment, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.resource4, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - Parameters.deploymentName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - Parameters.deploymentName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByDeviceGroupNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DeploymentListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/sphere/arm-sphere/src/operations/deviceGroups.ts b/sdk/sphere/arm-sphere/src/operations/deviceGroups.ts deleted file mode 100644 index d99ba0100455..000000000000 --- a/sdk/sphere/arm-sphere/src/operations/deviceGroups.ts +++ /dev/null @@ -1,901 +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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { DeviceGroups } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { AzureSphereManagementClient } from "../azureSphereManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - DeviceGroup, - DeviceGroupsListByProductNextOptionalParams, - DeviceGroupsListByProductOptionalParams, - DeviceGroupsListByProductResponse, - DeviceGroupsGetOptionalParams, - DeviceGroupsGetResponse, - DeviceGroupsCreateOrUpdateOptionalParams, - DeviceGroupsCreateOrUpdateResponse, - DeviceGroupUpdate, - DeviceGroupsUpdateOptionalParams, - DeviceGroupsUpdateResponse, - DeviceGroupsDeleteOptionalParams, - ClaimDevicesRequest, - DeviceGroupsClaimDevicesOptionalParams, - DeviceGroupsClaimDevicesResponse, - DeviceGroupsCountDevicesOptionalParams, - DeviceGroupsCountDevicesResponse, - DeviceGroupsListByProductNextResponse, -} from "../models/index.js"; - -/// -/** Class containing DeviceGroups operations. */ -export class DeviceGroupsImpl implements DeviceGroups { - private readonly client: AzureSphereManagementClient; - - /** - * Initialize a new instance of the class DeviceGroups class. - * @param client Reference to the service client - */ - constructor(client: AzureSphereManagementClient) { - this.client = client; - } - - /** - * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and - * cannot be used for product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - public listByProduct( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: DeviceGroupsListByProductOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByProductPagingAll( - resourceGroupName, - catalogName, - productName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByProductPagingPage( - resourceGroupName, - catalogName, - productName, - options, - settings, - ); - }, - }; - } - - private async *listByProductPagingPage( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: DeviceGroupsListByProductOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: DeviceGroupsListByProductResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByProduct( - resourceGroupName, - catalogName, - productName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByProductNext( - resourceGroupName, - catalogName, - productName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByProductPagingAll( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: DeviceGroupsListByProductOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByProductPagingPage( - resourceGroupName, - catalogName, - productName, - options, - )) { - yield* page; - } - } - - /** - * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and - * cannot be used for product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - private _listByProduct( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: DeviceGroupsListByProductOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, productName, options }, - listByProductOperationSpec, - ); - } - - /** - * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DeviceGroupsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, productName, deviceGroupName, options }, - getOperationSpec, - ); - } - - /** - * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - resource: DeviceGroup, - options?: DeviceGroupsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DeviceGroupsCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - resource, - options, - }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - DeviceGroupsCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - resource: DeviceGroup, - options?: DeviceGroupsCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - resource, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - properties: DeviceGroupUpdate, - options?: DeviceGroupsUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DeviceGroupsUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - properties, - options, - }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - DeviceGroupsUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - properties: DeviceGroupUpdate, - options?: DeviceGroupsUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - properties, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DeviceGroupsDeleteOptionalParams, - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - options, - }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DeviceGroupsDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when - * bulk claiming devices to a catalog only. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param claimDevicesRequest Bulk claim devices request body. - * @param options The options parameters. - */ - async beginClaimDevices( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - claimDevicesRequest: ClaimDevicesRequest, - options?: DeviceGroupsClaimDevicesOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DeviceGroupsClaimDevicesResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - claimDevicesRequest, - options, - }, - spec: claimDevicesOperationSpec, - }); - const poller = await createHttpPoller< - DeviceGroupsClaimDevicesResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when - * bulk claiming devices to a catalog only. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param claimDevicesRequest Bulk claim devices request body. - * @param options The options parameters. - */ - async beginClaimDevicesAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - claimDevicesRequest: ClaimDevicesRequest, - options?: DeviceGroupsClaimDevicesOptionalParams, - ): Promise { - const poller = await this.beginClaimDevices( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - claimDevicesRequest, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be - * used for product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - countDevices( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DeviceGroupsCountDevicesOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, productName, deviceGroupName, options }, - countDevicesOperationSpec, - ); - } - - /** - * ListByProductNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param nextLink The nextLink from the previous successful call to the ListByProduct method. - * @param options The options parameters. - */ - private _listByProductNext( - resourceGroupName: string, - catalogName: string, - productName: string, - nextLink: string, - options?: DeviceGroupsListByProductNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, productName, nextLink, options }, - listByProductNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByProductOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DeviceGroupListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.top, - Parameters.skip, - Parameters.maxpagesize, - ], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DeviceGroup, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.DeviceGroup, - }, - 201: { - bodyMapper: Mappers.DeviceGroup, - }, - 202: { - bodyMapper: Mappers.DeviceGroup, - }, - 204: { - bodyMapper: Mappers.DeviceGroup, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.resource3, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.DeviceGroup, - }, - 201: { - bodyMapper: Mappers.DeviceGroup, - }, - 202: { - bodyMapper: Mappers.DeviceGroup, - }, - 204: { - bodyMapper: Mappers.DeviceGroup, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.properties2, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const claimDevicesOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices", - httpMethod: "POST", - responses: { - 200: { - headersMapper: Mappers.DeviceGroupsClaimDevicesHeaders, - }, - 201: { - headersMapper: Mappers.DeviceGroupsClaimDevicesHeaders, - }, - 202: { - headersMapper: Mappers.DeviceGroupsClaimDevicesHeaders, - }, - 204: { - headersMapper: Mappers.DeviceGroupsClaimDevicesHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.claimDevicesRequest, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const countDevicesOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/countDevices", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.CountDevicesResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByProductNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DeviceGroupListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/sphere/arm-sphere/src/operations/devices.ts b/sdk/sphere/arm-sphere/src/operations/devices.ts deleted file mode 100644 index cc6b340be827..000000000000 --- a/sdk/sphere/arm-sphere/src/operations/devices.ts +++ /dev/null @@ -1,908 +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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Devices } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { AzureSphereManagementClient } from "../azureSphereManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - Device, - DevicesListByDeviceGroupNextOptionalParams, - DevicesListByDeviceGroupOptionalParams, - DevicesListByDeviceGroupResponse, - DevicesGetOptionalParams, - DevicesGetResponse, - DevicesCreateOrUpdateOptionalParams, - DevicesCreateOrUpdateResponse, - DeviceUpdate, - DevicesUpdateOptionalParams, - DevicesUpdateResponse, - DevicesDeleteOptionalParams, - GenerateCapabilityImageRequest, - DevicesGenerateCapabilityImageOptionalParams, - DevicesGenerateCapabilityImageResponse, - DevicesListByDeviceGroupNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Devices operations. */ -export class DevicesImpl implements Devices { - private readonly client: AzureSphereManagementClient; - - /** - * Initialize a new instance of the class Devices class. - * @param client Reference to the service client - */ - constructor(client: AzureSphereManagementClient) { - this.client = client; - } - - /** - * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and - * cannot be used for product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - public listByDeviceGroup( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DevicesListByDeviceGroupOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByDeviceGroupPagingAll( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByDeviceGroupPagingPage( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - options, - settings, - ); - }, - }; - } - - private async *listByDeviceGroupPagingPage( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DevicesListByDeviceGroupOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: DevicesListByDeviceGroupResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByDeviceGroup( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByDeviceGroupNext( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByDeviceGroupPagingAll( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DevicesListByDeviceGroupOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByDeviceGroupPagingPage( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - options, - )) { - yield* page; - } - } - - /** - * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and - * cannot be used for product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - private _listByDeviceGroup( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DevicesListByDeviceGroupOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, productName, deviceGroupName, options }, - listByDeviceGroupOperationSpec, - ); - } - - /** - * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device - * does not belong to a device group and product. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - options?: DevicesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - options, - }, - getOperationSpec, - ); - } - - /** - * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a - * device to the catalog only. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - resource: Device, - options?: DevicesCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DevicesCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - resource, - options, - }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - DevicesCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a - * device to the catalog only. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - resource: Device, - options?: DevicesCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - resource, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a - * device to the catalog level. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - properties: DeviceUpdate, - options?: DevicesUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DevicesUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - properties, - options, - }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - DevicesUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a - * device to the catalog level. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - properties: DeviceUpdate, - options?: DevicesUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - properties, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Delete a Device - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - options?: DevicesDeleteOptionalParams, - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - options, - }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Delete a Device - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - options?: DevicesDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group - * and product names to generate the image for a device that does not belong to a specific device group - * and product. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param generateDeviceCapabilityRequest Generate capability image request body. - * @param options The options parameters. - */ - async beginGenerateCapabilityImage( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, - options?: DevicesGenerateCapabilityImageOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DevicesGenerateCapabilityImageResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - generateDeviceCapabilityRequest, - options, - }, - spec: generateCapabilityImageOperationSpec, - }); - const poller = await createHttpPoller< - DevicesGenerateCapabilityImageResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group - * and product names to generate the image for a device that does not belong to a specific device group - * and product. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param generateDeviceCapabilityRequest Generate capability image request body. - * @param options The options parameters. - */ - async beginGenerateCapabilityImageAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, - options?: DevicesGenerateCapabilityImageOptionalParams, - ): Promise { - const poller = await this.beginGenerateCapabilityImage( - resourceGroupName, - catalogName, - productName, - deviceGroupName, - deviceName, - generateDeviceCapabilityRequest, - options, - ); - return poller.pollUntilDone(); - } - - /** - * ListByDeviceGroupNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param nextLink The nextLink from the previous successful call to the ListByDeviceGroup method. - * @param options The options parameters. - */ - private _listByDeviceGroupNext( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - nextLink: string, - options?: DevicesListByDeviceGroupNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - catalogName, - productName, - deviceGroupName, - nextLink, - options, - }, - listByDeviceGroupNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByDeviceGroupOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DeviceListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Device, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - Parameters.deviceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Device, - }, - 201: { - bodyMapper: Mappers.Device, - }, - 202: { - bodyMapper: Mappers.Device, - }, - 204: { - bodyMapper: Mappers.Device, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.resource5, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - Parameters.deviceName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.Device, - }, - 201: { - bodyMapper: Mappers.Device, - }, - 202: { - bodyMapper: Mappers.Device, - }, - 204: { - bodyMapper: Mappers.Device, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.properties3, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - Parameters.deviceName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - Parameters.deviceName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const generateCapabilityImageOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.SignedCapabilityImageResponse, - }, - 201: { - bodyMapper: Mappers.SignedCapabilityImageResponse, - }, - 202: { - bodyMapper: Mappers.SignedCapabilityImageResponse, - }, - 204: { - bodyMapper: Mappers.SignedCapabilityImageResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.generateDeviceCapabilityRequest, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - Parameters.deviceName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const listByDeviceGroupNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DeviceListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - Parameters.deviceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/sphere/arm-sphere/src/operations/images.ts b/sdk/sphere/arm-sphere/src/operations/images.ts deleted file mode 100644 index d6cf8aee7654..000000000000 --- a/sdk/sphere/arm-sphere/src/operations/images.ts +++ /dev/null @@ -1,502 +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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Images } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { AzureSphereManagementClient } from "../azureSphereManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - Image, - ImagesListByCatalogNextOptionalParams, - ImagesListByCatalogOptionalParams, - ImagesListByCatalogResponse, - ImagesGetOptionalParams, - ImagesGetResponse, - ImagesCreateOrUpdateOptionalParams, - ImagesCreateOrUpdateResponse, - ImagesDeleteOptionalParams, - ImagesListByCatalogNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Images operations. */ -export class ImagesImpl implements Images { - private readonly client: AzureSphereManagementClient; - - /** - * Initialize a new instance of the class Images class. - * @param client Reference to the service client - */ - constructor(client: AzureSphereManagementClient) { - this.client = client; - } - - /** - * List Image resources by Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - public listByCatalog( - resourceGroupName: string, - catalogName: string, - options?: ImagesListByCatalogOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByCatalogPagingAll( - resourceGroupName, - catalogName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByCatalogPagingPage( - resourceGroupName, - catalogName, - options, - settings, - ); - }, - }; - } - - private async *listByCatalogPagingPage( - resourceGroupName: string, - catalogName: string, - options?: ImagesListByCatalogOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: ImagesListByCatalogResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByCatalog( - resourceGroupName, - catalogName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByCatalogNext( - resourceGroupName, - catalogName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByCatalogPagingAll( - resourceGroupName: string, - catalogName: string, - options?: ImagesListByCatalogOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByCatalogPagingPage( - resourceGroupName, - catalogName, - options, - )) { - yield* page; - } - } - - /** - * List Image resources by Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - private _listByCatalog( - resourceGroupName: string, - catalogName: string, - options?: ImagesListByCatalogOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, options }, - listByCatalogOperationSpec, - ); - } - - /** - * Get a Image - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param imageName Image name. Use an image GUID for GA versions of the API. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - imageName: string, - options?: ImagesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, imageName, options }, - getOperationSpec, - ); - } - - /** - * Create a Image - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param imageName Image name. Use an image GUID for GA versions of the API. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - catalogName: string, - imageName: string, - resource: Image, - options?: ImagesCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ImagesCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, catalogName, imageName, resource, options }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - ImagesCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create a Image - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param imageName Image name. Use an image GUID for GA versions of the API. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - catalogName: string, - imageName: string, - resource: Image, - options?: ImagesCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - catalogName, - imageName, - resource, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Delete a Image - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param imageName Image name. Use an image GUID for GA versions of the API. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - catalogName: string, - imageName: string, - options?: ImagesDeleteOptionalParams, - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, catalogName, imageName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Delete a Image - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param imageName Image name. Use an image GUID for GA versions of the API. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - catalogName: string, - imageName: string, - options?: ImagesDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - catalogName, - imageName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * ListByCatalogNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param nextLink The nextLink from the previous successful call to the ListByCatalog method. - * @param options The options parameters. - */ - private _listByCatalogNext( - resourceGroupName: string, - catalogName: string, - nextLink: string, - options?: ImagesListByCatalogNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, nextLink, options }, - listByCatalogNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByCatalogOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ImageListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.top, - Parameters.skip, - Parameters.maxpagesize, - ], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Image, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.imageName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Image, - }, - 201: { - bodyMapper: Mappers.Image, - }, - 202: { - bodyMapper: Mappers.Image, - }, - 204: { - bodyMapper: Mappers.Image, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.resource1, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.imageName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.imageName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByCatalogNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ImageListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/sphere/arm-sphere/src/operations/index.ts b/sdk/sphere/arm-sphere/src/operations/index.ts deleted file mode 100644 index af7536d3b88b..000000000000 --- a/sdk/sphere/arm-sphere/src/operations/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./operations.js"; -export * from "./catalogs.js"; -export * from "./certificates.js"; -export * from "./images.js"; -export * from "./products.js"; -export * from "./deviceGroups.js"; -export * from "./deployments.js"; -export * from "./devices.js"; diff --git a/sdk/sphere/arm-sphere/src/operations/operations.ts b/sdk/sphere/arm-sphere/src/operations/operations.ts deleted file mode 100644 index 86c6d2563916..000000000000 --- a/sdk/sphere/arm-sphere/src/operations/operations.ts +++ /dev/null @@ -1,149 +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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Operations } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { AzureSphereManagementClient } from "../azureSphereManagementClient.js"; -import { - Operation, - OperationsListNextOptionalParams, - OperationsListOptionalParams, - OperationsListResponse, - OperationsListNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Operations operations. */ -export class OperationsImpl implements Operations { - private readonly client: AzureSphereManagementClient; - - /** - * Initialize a new instance of the class Operations class. - * @param client Reference to the service client - */ - constructor(client: AzureSphereManagementClient) { - this.client = client; - } - - /** - * List the operations for the provider - * @param options The options parameters. - */ - public list( - options?: OperationsListOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - }, - }; - } - - private async *listPagingPage( - options?: OperationsListOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: OperationsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: OperationsListOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * List the operations for the provider - * @param options The options parameters. - */ - private _list( - options?: OperationsListOptionalParams, - ): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: OperationsListNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.AzureSphere/operations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer, -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [Parameters.$host, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/sphere/arm-sphere/src/operations/products.ts b/sdk/sphere/arm-sphere/src/operations/products.ts deleted file mode 100644 index 95b5948d077e..000000000000 --- a/sdk/sphere/arm-sphere/src/operations/products.ts +++ /dev/null @@ -1,874 +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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper.js"; -import { Products } from "../operationsInterfaces/index.js"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers.js"; -import * as Parameters from "../models/parameters.js"; -import { AzureSphereManagementClient } from "../azureSphereManagementClient.js"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl.js"; -import { - Product, - ProductsListByCatalogNextOptionalParams, - ProductsListByCatalogOptionalParams, - ProductsListByCatalogResponse, - DeviceGroup, - ProductsGenerateDefaultDeviceGroupsNextOptionalParams, - ProductsGenerateDefaultDeviceGroupsOptionalParams, - ProductsGenerateDefaultDeviceGroupsResponse, - ProductsGetOptionalParams, - ProductsGetResponse, - ProductsCreateOrUpdateOptionalParams, - ProductsCreateOrUpdateResponse, - ProductUpdate, - ProductsUpdateOptionalParams, - ProductsUpdateResponse, - ProductsDeleteOptionalParams, - ProductsCountDevicesOptionalParams, - ProductsCountDevicesResponse, - ProductsListByCatalogNextResponse, - ProductsGenerateDefaultDeviceGroupsNextResponse, -} from "../models/index.js"; - -/// -/** Class containing Products operations. */ -export class ProductsImpl implements Products { - private readonly client: AzureSphereManagementClient; - - /** - * Initialize a new instance of the class Products class. - * @param client Reference to the service client - */ - constructor(client: AzureSphereManagementClient) { - this.client = client; - } - - /** - * List Product resources by Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - public listByCatalog( - resourceGroupName: string, - catalogName: string, - options?: ProductsListByCatalogOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.listByCatalogPagingAll( - resourceGroupName, - catalogName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByCatalogPagingPage( - resourceGroupName, - catalogName, - options, - settings, - ); - }, - }; - } - - private async *listByCatalogPagingPage( - resourceGroupName: string, - catalogName: string, - options?: ProductsListByCatalogOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: ProductsListByCatalogResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByCatalog( - resourceGroupName, - catalogName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByCatalogNext( - resourceGroupName, - catalogName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByCatalogPagingAll( - resourceGroupName: string, - catalogName: string, - options?: ProductsListByCatalogOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByCatalogPagingPage( - resourceGroupName, - catalogName, - options, - )) { - yield* page; - } - } - - /** - * Generates default device groups for the product. '.default' and '.unassigned' are system defined - * values and cannot be used for product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - public listGenerateDefaultDeviceGroups( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: ProductsGenerateDefaultDeviceGroupsOptionalParams, - ): PagedAsyncIterableIterator { - const iter = this.generateDefaultDeviceGroupsPagingAll( - resourceGroupName, - catalogName, - productName, - options, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.generateDefaultDeviceGroupsPagingPage( - resourceGroupName, - catalogName, - productName, - options, - settings, - ); - }, - }; - } - - private async *generateDefaultDeviceGroupsPagingPage( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: ProductsGenerateDefaultDeviceGroupsOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: ProductsGenerateDefaultDeviceGroupsResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._generateDefaultDeviceGroups( - resourceGroupName, - catalogName, - productName, - options, - ); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._generateDefaultDeviceGroupsNext( - resourceGroupName, - catalogName, - productName, - continuationToken, - options, - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *generateDefaultDeviceGroupsPagingAll( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: ProductsGenerateDefaultDeviceGroupsOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.generateDefaultDeviceGroupsPagingPage( - resourceGroupName, - catalogName, - productName, - options, - )) { - yield* page; - } - } - - /** - * List Product resources by Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - private _listByCatalog( - resourceGroupName: string, - catalogName: string, - options?: ProductsListByCatalogOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, options }, - listByCatalogOperationSpec, - ); - } - - /** - * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product - * name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: ProductsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, productName, options }, - getOperationSpec, - ); - } - - /** - * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - * product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - resource: Product, - options?: ProductsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ProductsCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, catalogName, productName, resource, options }, - spec: createOrUpdateOperationSpec, - }); - const poller = await createHttpPoller< - ProductsCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - * product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - resource: Product, - options?: ProductsCreateOrUpdateOptionalParams, - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - catalogName, - productName, - resource, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - * product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - properties: ProductUpdate, - options?: ProductsUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ProductsUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { - resourceGroupName, - catalogName, - productName, - properties, - options, - }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - ProductsUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - * product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - properties: ProductUpdate, - options?: ProductsUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - catalogName, - productName, - properties, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for - * product name' - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: ProductsDeleteOptionalParams, - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec, - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = 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 = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, catalogName, productName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for - * product name' - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: ProductsDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - catalogName, - productName, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used - * for product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - countDevices( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: ProductsCountDevicesOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, productName, options }, - countDevicesOperationSpec, - ); - } - - /** - * Generates default device groups for the product. '.default' and '.unassigned' are system defined - * values and cannot be used for product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - private _generateDefaultDeviceGroups( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: ProductsGenerateDefaultDeviceGroupsOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, productName, options }, - generateDefaultDeviceGroupsOperationSpec, - ); - } - - /** - * ListByCatalogNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param nextLink The nextLink from the previous successful call to the ListByCatalog method. - * @param options The options parameters. - */ - private _listByCatalogNext( - resourceGroupName: string, - catalogName: string, - nextLink: string, - options?: ProductsListByCatalogNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, nextLink, options }, - listByCatalogNextOperationSpec, - ); - } - - /** - * GenerateDefaultDeviceGroupsNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param nextLink The nextLink from the previous successful call to the GenerateDefaultDeviceGroups - * method. - * @param options The options parameters. - */ - private _generateDefaultDeviceGroupsNext( - resourceGroupName: string, - catalogName: string, - productName: string, - nextLink: string, - options?: ProductsGenerateDefaultDeviceGroupsNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, catalogName, productName, nextLink, options }, - generateDefaultDeviceGroupsNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listByCatalogOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ProductListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Product, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Product, - }, - 201: { - bodyMapper: Mappers.Product, - }, - 202: { - bodyMapper: Mappers.Product, - }, - 204: { - bodyMapper: Mappers.Product, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.resource2, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.Product, - }, - 201: { - bodyMapper: Mappers.Product, - }, - 202: { - bodyMapper: Mappers.Product, - }, - 204: { - bodyMapper: Mappers.Product, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.properties1, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const countDevicesOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/countDevices", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.CountDevicesResponse, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const generateDefaultDeviceGroupsOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/generateDefaultDeviceGroups", - httpMethod: "POST", - responses: { - 200: { - bodyMapper: Mappers.DeviceGroupListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listByCatalogNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ProductListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const generateDefaultDeviceGroupsNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.DeviceGroupListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.catalogName, - Parameters.productName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/catalogs.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/catalogs.ts deleted file mode 100644 index 94d923d9f410..000000000000 --- a/sdk/sphere/arm-sphere/src/operationsInterfaces/catalogs.ts +++ /dev/null @@ -1,223 +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 { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - Catalog, - CatalogsListBySubscriptionOptionalParams, - CatalogsListByResourceGroupOptionalParams, - Deployment, - CatalogsListDeploymentsOptionalParams, - DeviceGroup, - ListDeviceGroupsRequest, - CatalogsListDeviceGroupsOptionalParams, - DeviceInsight, - CatalogsListDeviceInsightsOptionalParams, - Device, - CatalogsListDevicesOptionalParams, - CatalogsGetOptionalParams, - CatalogsGetResponse, - CatalogsCreateOrUpdateOptionalParams, - CatalogsCreateOrUpdateResponse, - CatalogUpdate, - CatalogsUpdateOptionalParams, - CatalogsUpdateResponse, - CatalogsDeleteOptionalParams, - CatalogsCountDevicesOptionalParams, - CatalogsCountDevicesResponse, - Image, - CatalogsUploadImageOptionalParams, - CatalogsUploadImageResponse, -} from "../models/index.js"; - -/// -/** Interface representing a Catalogs. */ -export interface Catalogs { - /** - * List Catalog resources by subscription ID - * @param options The options parameters. - */ - listBySubscription( - options?: CatalogsListBySubscriptionOptionalParams, - ): PagedAsyncIterableIterator; - /** - * List Catalog resources by resource group - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - listByResourceGroup( - resourceGroupName: string, - options?: CatalogsListByResourceGroupOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Lists deployments for catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - listDeployments( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDeploymentsOptionalParams, - ): PagedAsyncIterableIterator; - /** - * List the device groups for the catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param listDeviceGroupsRequest List device groups for catalog. - * @param options The options parameters. - */ - listDeviceGroups( - resourceGroupName: string, - catalogName: string, - listDeviceGroupsRequest: ListDeviceGroupsRequest, - options?: CatalogsListDeviceGroupsOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Lists device insights for catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - listDeviceInsights( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDeviceInsightsOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Lists devices for catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - listDevices( - resourceGroupName: string, - catalogName: string, - options?: CatalogsListDevicesOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - options?: CatalogsGetOptionalParams, - ): Promise; - /** - * Create a Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - catalogName: string, - resource: Catalog, - options?: CatalogsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - CatalogsCreateOrUpdateResponse - > - >; - /** - * Create a Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - catalogName: string, - resource: Catalog, - options?: CatalogsCreateOrUpdateOptionalParams, - ): Promise; - /** - * Update a Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - update( - resourceGroupName: string, - catalogName: string, - properties: CatalogUpdate, - options?: CatalogsUpdateOptionalParams, - ): Promise; - /** - * Delete a Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - catalogName: string, - options?: CatalogsDeleteOptionalParams, - ): Promise, void>>; - /** - * Delete a Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - catalogName: string, - options?: CatalogsDeleteOptionalParams, - ): Promise; - /** - * Counts devices in catalog. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - countDevices( - resourceGroupName: string, - catalogName: string, - options?: CatalogsCountDevicesOptionalParams, - ): Promise; - /** - * Creates an image. Use this action when the image ID is unknown. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param uploadImageRequest Image upload request body. - * @param options The options parameters. - */ - beginUploadImage( - resourceGroupName: string, - catalogName: string, - uploadImageRequest: Image, - options?: CatalogsUploadImageOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - CatalogsUploadImageResponse - > - >; - /** - * Creates an image. Use this action when the image ID is unknown. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param uploadImageRequest Image upload request body. - * @param options The options parameters. - */ - beginUploadImageAndWait( - resourceGroupName: string, - catalogName: string, - uploadImageRequest: Image, - options?: CatalogsUploadImageOptionalParams, - ): Promise; -} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/certificates.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/certificates.ts deleted file mode 100644 index 814050920edb..000000000000 --- a/sdk/sphere/arm-sphere/src/operationsInterfaces/certificates.ts +++ /dev/null @@ -1,80 +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 { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - Certificate, - CertificatesListByCatalogOptionalParams, - CertificatesGetOptionalParams, - CertificatesGetResponse, - CertificatesRetrieveCertChainOptionalParams, - CertificatesRetrieveCertChainResponse, - ProofOfPossessionNonceRequest, - CertificatesRetrieveProofOfPossessionNonceOptionalParams, - CertificatesRetrieveProofOfPossessionNonceResponse, -} from "../models/index.js"; - -/// -/** Interface representing a Certificates. */ -export interface Certificates { - /** - * List Certificate resources by Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - listByCatalog( - resourceGroupName: string, - catalogName: string, - options?: CertificatesListByCatalogOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a Certificate - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param serialNumber Serial number of the certificate. Use '.default' to get current active - * certificate. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - serialNumber: string, - options?: CertificatesGetOptionalParams, - ): Promise; - /** - * Retrieves cert chain. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param serialNumber Serial number of the certificate. Use '.default' to get current active - * certificate. - * @param options The options parameters. - */ - retrieveCertChain( - resourceGroupName: string, - catalogName: string, - serialNumber: string, - options?: CertificatesRetrieveCertChainOptionalParams, - ): Promise; - /** - * Gets the proof of possession nonce. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param serialNumber Serial number of the certificate. Use '.default' to get current active - * certificate. - * @param proofOfPossessionNonceRequest Proof of possession nonce request body - * @param options The options parameters. - */ - retrieveProofOfPossessionNonce( - resourceGroupName: string, - catalogName: string, - serialNumber: string, - proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, - options?: CertificatesRetrieveProofOfPossessionNonceOptionalParams, - ): Promise; -} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/deployments.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/deployments.ts deleted file mode 100644 index 1d0e07cc70a2..000000000000 --- a/sdk/sphere/arm-sphere/src/operationsInterfaces/deployments.ts +++ /dev/null @@ -1,144 +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 { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - Deployment, - DeploymentsListByDeviceGroupOptionalParams, - DeploymentsGetOptionalParams, - DeploymentsGetResponse, - DeploymentsCreateOrUpdateOptionalParams, - DeploymentsCreateOrUpdateResponse, - DeploymentsDeleteOptionalParams, -} from "../models/index.js"; - -/// -/** Interface representing a Deployments. */ -export interface Deployments { - /** - * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and - * cannot be used for product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - listByDeviceGroup( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DeploymentsListByDeviceGroupOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deploymentName Deployment name. Use .default for deployment creation and to get the current - * deployment for the associated device group. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deploymentName: string, - options?: DeploymentsGetOptionalParams, - ): Promise; - /** - * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deploymentName Deployment name. Use .default for deployment creation and to get the current - * deployment for the associated device group. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deploymentName: string, - resource: Deployment, - options?: DeploymentsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DeploymentsCreateOrUpdateResponse - > - >; - /** - * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deploymentName Deployment name. Use .default for deployment creation and to get the current - * deployment for the associated device group. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deploymentName: string, - resource: Deployment, - options?: DeploymentsCreateOrUpdateOptionalParams, - ): Promise; - /** - * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deploymentName Deployment name. Use .default for deployment creation and to get the current - * deployment for the associated device group. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deploymentName: string, - options?: DeploymentsDeleteOptionalParams, - ): Promise, void>>; - /** - * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deploymentName Deployment name. Use .default for deployment creation and to get the current - * deployment for the associated device group. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deploymentName: string, - options?: DeploymentsDeleteOptionalParams, - ): Promise; -} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/deviceGroups.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/deviceGroups.ts deleted file mode 100644 index 50b418983872..000000000000 --- a/sdk/sphere/arm-sphere/src/operationsInterfaces/deviceGroups.ts +++ /dev/null @@ -1,233 +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 { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - DeviceGroup, - DeviceGroupsListByProductOptionalParams, - DeviceGroupsGetOptionalParams, - DeviceGroupsGetResponse, - DeviceGroupsCreateOrUpdateOptionalParams, - DeviceGroupsCreateOrUpdateResponse, - DeviceGroupUpdate, - DeviceGroupsUpdateOptionalParams, - DeviceGroupsUpdateResponse, - DeviceGroupsDeleteOptionalParams, - ClaimDevicesRequest, - DeviceGroupsClaimDevicesOptionalParams, - DeviceGroupsClaimDevicesResponse, - DeviceGroupsCountDevicesOptionalParams, - DeviceGroupsCountDevicesResponse, -} from "../models/index.js"; - -/// -/** Interface representing a DeviceGroups. */ -export interface DeviceGroups { - /** - * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and - * cannot be used for product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - listByProduct( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: DeviceGroupsListByProductOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DeviceGroupsGetOptionalParams, - ): Promise; - /** - * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - resource: DeviceGroup, - options?: DeviceGroupsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DeviceGroupsCreateOrUpdateResponse - > - >; - /** - * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - resource: DeviceGroup, - options?: DeviceGroupsCreateOrUpdateOptionalParams, - ): Promise; - /** - * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - properties: DeviceGroupUpdate, - options?: DeviceGroupsUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DeviceGroupsUpdateResponse - > - >; - /** - * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - properties: DeviceGroupUpdate, - options?: DeviceGroupsUpdateOptionalParams, - ): Promise; - /** - * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DeviceGroupsDeleteOptionalParams, - ): Promise, void>>; - /** - * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for - * product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DeviceGroupsDeleteOptionalParams, - ): Promise; - /** - * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when - * bulk claiming devices to a catalog only. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param claimDevicesRequest Bulk claim devices request body. - * @param options The options parameters. - */ - beginClaimDevices( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - claimDevicesRequest: ClaimDevicesRequest, - options?: DeviceGroupsClaimDevicesOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DeviceGroupsClaimDevicesResponse - > - >; - /** - * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when - * bulk claiming devices to a catalog only. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param claimDevicesRequest Bulk claim devices request body. - * @param options The options parameters. - */ - beginClaimDevicesAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - claimDevicesRequest: ClaimDevicesRequest, - options?: DeviceGroupsClaimDevicesOptionalParams, - ): Promise; - /** - * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be - * used for product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - countDevices( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DeviceGroupsCountDevicesOptionalParams, - ): Promise; -} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/devices.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/devices.ts deleted file mode 100644 index 79271570071f..000000000000 --- a/sdk/sphere/arm-sphere/src/operationsInterfaces/devices.ts +++ /dev/null @@ -1,235 +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 { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - Device, - DevicesListByDeviceGroupOptionalParams, - DevicesGetOptionalParams, - DevicesGetResponse, - DevicesCreateOrUpdateOptionalParams, - DevicesCreateOrUpdateResponse, - DeviceUpdate, - DevicesUpdateOptionalParams, - DevicesUpdateResponse, - DevicesDeleteOptionalParams, - GenerateCapabilityImageRequest, - DevicesGenerateCapabilityImageOptionalParams, - DevicesGenerateCapabilityImageResponse, -} from "../models/index.js"; - -/// -/** Interface representing a Devices. */ -export interface Devices { - /** - * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and - * cannot be used for product or device group name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param options The options parameters. - */ - listByDeviceGroup( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - options?: DevicesListByDeviceGroupOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device - * does not belong to a device group and product. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - options?: DevicesGetOptionalParams, - ): Promise; - /** - * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a - * device to the catalog only. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - resource: Device, - options?: DevicesCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DevicesCreateOrUpdateResponse - > - >; - /** - * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a - * device to the catalog only. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - resource: Device, - options?: DevicesCreateOrUpdateOptionalParams, - ): Promise; - /** - * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a - * device to the catalog level. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - properties: DeviceUpdate, - options?: DevicesUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DevicesUpdateResponse - > - >; - /** - * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a - * device to the catalog level. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - properties: DeviceUpdate, - options?: DevicesUpdateOptionalParams, - ): Promise; - /** - * Delete a Device - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - options?: DevicesDeleteOptionalParams, - ): Promise, void>>; - /** - * Delete a Device - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - options?: DevicesDeleteOptionalParams, - ): Promise; - /** - * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group - * and product names to generate the image for a device that does not belong to a specific device group - * and product. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param generateDeviceCapabilityRequest Generate capability image request body. - * @param options The options parameters. - */ - beginGenerateCapabilityImage( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, - options?: DevicesGenerateCapabilityImageOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - DevicesGenerateCapabilityImageResponse - > - >; - /** - * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group - * and product names to generate the image for a device that does not belong to a specific device group - * and product. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param deviceGroupName Name of device group. - * @param deviceName Device name - * @param generateDeviceCapabilityRequest Generate capability image request body. - * @param options The options parameters. - */ - beginGenerateCapabilityImageAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - deviceGroupName: string, - deviceName: string, - generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, - options?: DevicesGenerateCapabilityImageOptionalParams, - ): Promise; -} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/images.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/images.ts deleted file mode 100644 index 0c2d67e65352..000000000000 --- a/sdk/sphere/arm-sphere/src/operationsInterfaces/images.ts +++ /dev/null @@ -1,109 +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 { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - Image, - ImagesListByCatalogOptionalParams, - ImagesGetOptionalParams, - ImagesGetResponse, - ImagesCreateOrUpdateOptionalParams, - ImagesCreateOrUpdateResponse, - ImagesDeleteOptionalParams, -} from "../models/index.js"; - -/// -/** Interface representing a Images. */ -export interface Images { - /** - * List Image resources by Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - listByCatalog( - resourceGroupName: string, - catalogName: string, - options?: ImagesListByCatalogOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a Image - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param imageName Image name. Use an image GUID for GA versions of the API. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - imageName: string, - options?: ImagesGetOptionalParams, - ): Promise; - /** - * Create a Image - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param imageName Image name. Use an image GUID for GA versions of the API. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - catalogName: string, - imageName: string, - resource: Image, - options?: ImagesCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ImagesCreateOrUpdateResponse - > - >; - /** - * Create a Image - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param imageName Image name. Use an image GUID for GA versions of the API. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - catalogName: string, - imageName: string, - resource: Image, - options?: ImagesCreateOrUpdateOptionalParams, - ): Promise; - /** - * Delete a Image - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param imageName Image name. Use an image GUID for GA versions of the API. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - catalogName: string, - imageName: string, - options?: ImagesDeleteOptionalParams, - ): Promise, void>>; - /** - * Delete a Image - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param imageName Image name. Use an image GUID for GA versions of the API. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - catalogName: string, - imageName: string, - options?: ImagesDeleteOptionalParams, - ): Promise; -} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/index.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/index.ts deleted file mode 100644 index af7536d3b88b..000000000000 --- a/sdk/sphere/arm-sphere/src/operationsInterfaces/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export * from "./operations.js"; -export * from "./catalogs.js"; -export * from "./certificates.js"; -export * from "./images.js"; -export * from "./products.js"; -export * from "./deviceGroups.js"; -export * from "./deployments.js"; -export * from "./devices.js"; diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/operations.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/operations.ts deleted file mode 100644 index 2c280c7eb723..000000000000 --- a/sdk/sphere/arm-sphere/src/operationsInterfaces/operations.ts +++ /dev/null @@ -1,22 +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 { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { Operation, OperationsListOptionalParams } from "../models/index.js"; - -/// -/** Interface representing a Operations. */ -export interface Operations { - /** - * List the operations for the provider - * @param options The options parameters. - */ - list( - options?: OperationsListOptionalParams, - ): PagedAsyncIterableIterator; -} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/products.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/products.ts deleted file mode 100644 index a1e01f8dfb7c..000000000000 --- a/sdk/sphere/arm-sphere/src/operationsInterfaces/products.ts +++ /dev/null @@ -1,186 +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 { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - Product, - ProductsListByCatalogOptionalParams, - DeviceGroup, - ProductsGenerateDefaultDeviceGroupsOptionalParams, - ProductsGetOptionalParams, - ProductsGetResponse, - ProductsCreateOrUpdateOptionalParams, - ProductsCreateOrUpdateResponse, - ProductUpdate, - ProductsUpdateOptionalParams, - ProductsUpdateResponse, - ProductsDeleteOptionalParams, - ProductsCountDevicesOptionalParams, - ProductsCountDevicesResponse, -} from "../models/index.js"; - -/// -/** Interface representing a Products. */ -export interface Products { - /** - * List Product resources by Catalog - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param options The options parameters. - */ - listByCatalog( - resourceGroupName: string, - catalogName: string, - options?: ProductsListByCatalogOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Generates default device groups for the product. '.default' and '.unassigned' are system defined - * values and cannot be used for product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - listGenerateDefaultDeviceGroups( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: ProductsGenerateDefaultDeviceGroupsOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product - * name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: ProductsGetOptionalParams, - ): Promise; - /** - * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - * product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - resource: Product, - options?: ProductsCreateOrUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ProductsCreateOrUpdateResponse - > - >; - /** - * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for - * product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - resource: Product, - options?: ProductsCreateOrUpdateOptionalParams, - ): Promise; - /** - * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - * product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - catalogName: string, - productName: string, - properties: ProductUpdate, - options?: ProductsUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - ProductsUpdateResponse - > - >; - /** - * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for - * product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - properties: ProductUpdate, - options?: ProductsUpdateOptionalParams, - ): Promise; - /** - * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for - * product name' - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: ProductsDeleteOptionalParams, - ): Promise, void>>; - /** - * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for - * product name' - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: ProductsDeleteOptionalParams, - ): Promise; - /** - * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used - * for product name. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param catalogName Name of catalog - * @param productName Name of product. - * @param options The options parameters. - */ - countDevices( - resourceGroupName: string, - catalogName: string, - productName: string, - options?: ProductsCountDevicesOptionalParams, - ): Promise; -} diff --git a/sdk/sphere/arm-sphere/src/pagingHelper.ts b/sdk/sphere/arm-sphere/src/pagingHelper.ts deleted file mode 100644 index 205cccc26592..000000000000 --- a/sdk/sphere/arm-sphere/src/pagingHelper.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export interface PageInfo { - continuationToken?: string; -} - -const pageMap = new WeakMap(); - -/** - * Given the last `.value` produced by the `byPage` iterator, - * returns a continuation token that can be used to begin paging from - * that point later. - * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. - * @returns The continuation token that can be passed into byPage() during future calls. - */ -export function getContinuationToken(page: unknown): string | undefined { - if (typeof page !== "object" || page === null) { - return undefined; - } - return pageMap.get(page)?.continuationToken; -} - -export function setContinuationToken( - page: unknown, - continuationToken: string | undefined, -): void { - if (typeof page !== "object" || page === null || !continuationToken) { - return; - } - const pageInfo = pageMap.get(page) ?? {}; - pageInfo.continuationToken = continuationToken; - pageMap.set(page, pageInfo); -} diff --git a/sdk/sphere/arm-sphere/src/restorePollerHelpers.ts b/sdk/sphere/arm-sphere/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..1bb373543ede --- /dev/null +++ b/sdk/sphere/arm-sphere/src/restorePollerHelpers.ts @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureSphereClient } from "./azureSphereClient.js"; +import { + _generateCapabilityImageDeserialize, + _$deleteDeserialize, + _updateDeserialize, + _createOrUpdateDeserialize, +} from "./api/devices/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeDeployments, + _createOrUpdateDeserialize as _createOrUpdateDeserializeDeployments, +} from "./api/deployments/operations.js"; +import { + _claimDevicesDeserialize, + _$deleteDeserialize as _$deleteDeserializeDeviceGroups, + _updateDeserialize as _updateDeserializeDeviceGroups, + _createOrUpdateDeserialize as _createOrUpdateDeserializeDeviceGroups, +} from "./api/deviceGroups/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeProducts, + _updateDeserialize as _updateDeserializeProducts, + _createOrUpdateDeserialize as _createOrUpdateDeserializeProducts, +} from "./api/products/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeImages, + _createOrUpdateDeserialize as _createOrUpdateDeserializeImages, +} from "./api/images/operations.js"; +import { + _uploadImageDeserialize, + _$deleteDeserialize as _$deleteDeserializeCatalogs, + _createOrUpdateDeserialize as _createOrUpdateDeserializeCatalogs, +} from "./api/catalogs/operations.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; +import { + PollerLike, + OperationState, + deserializeState, + ResourceLocationConfig, +} from "@azure/core-lro"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: AzureSphereClient, + serializedState: string, + sourceOperation: (...args: any[]) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + }, + ); +} + +interface DeserializationHelper { + deserializer: Function; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage": + { + deserializer: _generateCapabilityImageDeserialize, + expectedStatuses: ["202", "200"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}": + { + deserializer: _$deleteDeserialize, + expectedStatuses: ["200", "202", "204"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}": + { deserializer: _updateDeserialize, expectedStatuses: ["200", "202"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}": + { + deserializer: _createOrUpdateDeserialize, + expectedStatuses: ["200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}": + { + deserializer: _$deleteDeserializeDeployments, + expectedStatuses: ["200", "202", "204"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}": + { + deserializer: _createOrUpdateDeserializeDeployments, + expectedStatuses: ["200", "201"], + }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices": + { + deserializer: _claimDevicesDeserialize, + expectedStatuses: ["202", "200"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}": + { + deserializer: _$deleteDeserializeDeviceGroups, + expectedStatuses: ["200", "202", "204"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}": + { + deserializer: _updateDeserializeDeviceGroups, + expectedStatuses: ["200", "202"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}": + { + deserializer: _createOrUpdateDeserializeDeviceGroups, + expectedStatuses: ["200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}": + { + deserializer: _$deleteDeserializeProducts, + expectedStatuses: ["200", "202", "204"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}": + { + deserializer: _updateDeserializeProducts, + expectedStatuses: ["200", "202"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}": + { + deserializer: _createOrUpdateDeserializeProducts, + expectedStatuses: ["200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}": + { + deserializer: _$deleteDeserializeImages, + expectedStatuses: ["200", "202", "204"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}": + { + deserializer: _createOrUpdateDeserializeImages, + expectedStatuses: ["200", "201"], + }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/uploadImage": + { deserializer: _uploadImageDeserialize, expectedStatuses: ["202", "200"] }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}": + { + deserializer: _$deleteDeserializeCatalogs, + expectedStatuses: ["200", "202", "204"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}": + { + deserializer: _createOrUpdateDeserializeCatalogs, + expectedStatuses: ["200", "201"], + }, +}; + +function getDeserializationHelper( + urlStr: string, + method: string, +): DeserializationHelper | undefined { + const path = new URL(urlStr).pathname; + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: DeserializationHelper | undefined; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(deserializeMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/sdk/sphere/arm-sphere/src/static-helpers/pagingHelpers.ts b/sdk/sphere/arm-sphere/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..ce33af5f4178 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + const result = + pageLink === undefined + ? await getInitialResponse() + : await client.pathUnchecked(pageLink).get(); + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} diff --git a/sdk/sphere/arm-sphere/src/static-helpers/pollingHelpers.ts b/sdk/sphere/arm-sphere/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..f01c41bab69d --- /dev/null +++ b/sdk/sphere/arm-sphere/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + createHttpPoller, + OperationResponse, +} from "@azure/core-lro"; + +import { Client, PathUncheckedResponse, createRestError } from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; +} +export function getLongRunningPoller( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse } = options; + if (!restoreFrom && !getInitialResponse) { + throw new Error("Either restoreFrom or getInitialResponse must be specified"); + } + let initialResponse: TResponse | undefined = undefined; + const pollAbortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + if (!getInitialResponse) { + throw new Error("getInitialResponse is required when initializing a new poller"); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse, expectedStatuses); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + response = await client.pathUnchecked(path).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + + return getLroResponse(response as TResponse, expectedStatuses); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, + expectedStatuses: string[], +): OperationResponse { + if (!expectedStatuses.includes(response.status)) { + throw createRestError(response); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} diff --git a/sdk/sphere/arm-sphere/src/static-helpers/urlTemplate.ts b/sdk/sphere/arm-sphere/src/static-helpers/urlTemplate.ts new file mode 100644 index 000000000000..cd03319fda35 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/static-helpers/urlTemplate.ts @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +//--------------------- +// interfaces +//--------------------- +interface ValueOptions { + isFirst: boolean; // is first value in the expression + op?: string; // operator + varValue?: any; // variable value + varName?: string; // variable name + modifier?: string; // modifier e.g * + reserved?: boolean; // if true we'll keep reserved words with not encoding +} + +export interface UrlTemplateOptions { + // if set to true, reserved characters will not be encoded + allowReserved?: boolean; +} + +// --------------------- +// helpers +// --------------------- +function encodeComponent(val: string, reserved?: boolean, op?: string) { + return (reserved ?? op === "+") || op === "#" + ? encodeReservedComponent(val) + : encodeRFC3986URIComponent(val); +} + +function encodeReservedComponent(str: string) { + return str + .split(/(%[0-9A-Fa-f]{2})/g) + .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part)) + .join(""); +} + +function encodeRFC3986URIComponent(str: string) { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, + ); +} + +function isDefined(val: any) { + return val !== undefined && val !== null; +} + +function getNamedAndIfEmpty(op?: string): [boolean, string] { + return [!!op && [";", "?", "&"].includes(op), !!op && ["?", "&"].includes(op) ? "=" : ""]; +} + +function getFirstOrSep(op?: string, isFirst = false) { + if (isFirst) { + return !op || op === "+" ? "" : op; + } else if (!op || op === "+" || op === "#") { + return ","; + } else if (op === "?") { + return "&"; + } else { + return op; + } +} + +function getExpandedValue(option: ValueOptions) { + let isFirst = option.isFirst; + const { op, varName, varValue: value, reserved } = option; + const vals: string[] = []; + const [named, ifEmpty] = getNamedAndIfEmpty(op); + + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + // prepare the following parts: separator, varName, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (named && varName) { + vals.push(`${encodeURIComponent(varName)}`); + val === "" ? vals.push(ifEmpty) : vals.push("="); + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + const val = value[key]; + if (!isDefined(val)) { + continue; + } + // prepare the following parts: separator, key, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (key) { + vals.push(`${encodeURIComponent(key)}`); + named && val === "" ? vals.push(ifEmpty) : vals.push("="); + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } + return vals.join(""); +} + +function getNonExpandedValue(option: ValueOptions) { + const { op, varName, varValue: value, isFirst, reserved } = option; + const vals: string[] = []; + const first = getFirstOrSep(op, isFirst); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + if (named && varName) { + vals.push(encodeComponent(varName, reserved, op)); + if (value === "") { + if (!ifEmpty) { + vals.push(ifEmpty); + } + return !vals.join("") ? undefined : `${first}${vals.join("")}`; + } + vals.push("="); + } + + const items = []; + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + items.push(encodeComponent(val, reserved, op)); + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + if (!isDefined(value[key])) { + continue; + } + items.push(encodeRFC3986URIComponent(key)); + items.push(encodeComponent(value[key], reserved, op)); + } + } + vals.push(items.join(",")); + return !vals.join(",") ? undefined : `${first}${vals.join("")}`; +} + +function getVarValue(option: ValueOptions): string | undefined { + const { op, varName, modifier, isFirst, reserved, varValue: value } = option; + + if (!isDefined(value)) { + return undefined; + } else if (["string", "number", "boolean"].includes(typeof value)) { + let val = value.toString(); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + const vals: string[] = [getFirstOrSep(op, isFirst)]; + if (named && varName) { + // No need to encode varName considering it is already encoded + vals.push(varName); + val === "" ? vals.push(ifEmpty) : vals.push("="); + } + if (modifier && modifier !== "*") { + val = val.substring(0, parseInt(modifier, 10)); + } + vals.push(encodeComponent(val, reserved, op)); + return vals.join(""); + } else if (modifier === "*") { + return getExpandedValue(option); + } else { + return getNonExpandedValue(option); + } +} + +// --------------------------------------------------------------------------------------------------- +// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570. +// --------------------------------------------------------------------------------------------------- +export function expandUrlTemplate( + template: string, + context: Record, + option?: UrlTemplateOptions, +): string { + return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, (_, expr, text) => { + if (!expr) { + return encodeReservedComponent(text); + } + let op; + if (["+", "#", ".", "/", ";", "?", "&"].includes(expr[0])) { + (op = expr[0]), (expr = expr.slice(1)); + } + const varList = expr.split(/,/g); + const result = []; + for (const varSpec of varList) { + const varMatch = /([^:\*]*)(?::(\d+)|(\*))?/.exec(varSpec); + if (!varMatch || !varMatch[1]) { + continue; + } + const varValue = getVarValue({ + isFirst: result.length === 0, + op, + varValue: context[varMatch[1]], + varName: varMatch[1], + modifier: varMatch[2] || varMatch[3], + reserved: option?.allowReserved, + }); + if (varValue) { + result.push(varValue); + } + } + return result.join(""); + }); +} diff --git a/sdk/sphere/arm-sphere/test/public/sampleTest.spec.ts b/sdk/sphere/arm-sphere/test/public/sampleTest.spec.ts new file mode 100644 index 000000000000..e4591bbad342 --- /dev/null +++ b/sdk/sphere/arm-sphere/test/public/sampleTest.spec.ts @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { assert, beforeEach, afterEach, it, describe } from "vitest"; + +describe("My test", () => { + // let recorder: Recorder; + + beforeEach(async () => { + // recorder = await createRecorder(this); + }); + + afterEach(async () => { + // await recorder.stop(); + }); + + it("sample test", async function () { + assert.equal(1, 1); + }); +}); diff --git a/sdk/sphere/arm-sphere/test/public/utils/recordedClient.ts b/sdk/sphere/arm-sphere/test/public/utils/recordedClient.ts new file mode 100644 index 000000000000..14dcd9fa397c --- /dev/null +++ b/sdk/sphere/arm-sphere/test/public/utils/recordedClient.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Recorder, RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder"; + +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "azure_subscription_id", +}; + +const recorderEnvSetup: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables, +}; + +/** + * creates the recorder and reads the environment variables from the `.env` file. + * Should be called first in the test suite to make sure environment variables are + * read before they are being used. + */ +export async function createRecorder(context: VitestTestContext): Promise { + const recorder = new Recorder(context); + await recorder.start(recorderEnvSetup); + return recorder; +} diff --git a/sdk/sphere/arm-sphere/test/snippets.spec.ts b/sdk/sphere/arm-sphere/test/snippets.spec.ts index 88d6460a6f54..ef3f4a1e7961 100644 --- a/sdk/sphere/arm-sphere/test/snippets.spec.ts +++ b/sdk/sphere/arm-sphere/test/snippets.spec.ts @@ -1,8 +1,7 @@ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { AzureSphereManagementClient } from "../src/index.js"; +import { AzureSphereClient } from "../src/index.js"; import { DefaultAzureCredential, InteractiveBrowserCredential } from "@azure/identity"; import { setLogLevel } from "@azure/logger"; import { describe, it } from "vitest"; @@ -10,7 +9,7 @@ import { describe, it } from "vitest"; describe("snippets", () => { it("ReadmeSampleCreateClient_Node", async () => { const subscriptionId = "00000000-0000-0000-0000-000000000000"; - const client = new AzureSphereManagementClient(new DefaultAzureCredential(), subscriptionId); + const client = new AzureSphereClient(new DefaultAzureCredential(), subscriptionId); }); it("ReadmeSampleCreateClient_Browser", async () => { @@ -19,7 +18,7 @@ describe("snippets", () => { tenantId: "", clientId: "", }); - const client = new AzureSphereManagementClient(credential, subscriptionId); + const client = new AzureSphereClient(credential, subscriptionId); }); it("SetLogLevel", async () => { diff --git a/sdk/sphere/arm-sphere/test/sphere_operations_test.spec.ts b/sdk/sphere/arm-sphere/test/sphere_operations_test.spec.ts deleted file mode 100644 index a83c6375e9a9..000000000000 --- a/sdk/sphere/arm-sphere/test/sphere_operations_test.spec.ts +++ /dev/null @@ -1,100 +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 { - env, - Recorder, - RecorderStartOptions, - isPlaybackMode, -} from "@azure-tools/test-recorder"; -import { createTestCredential } from "@azure-tools/test-credential"; -import { AzureSphereManagementClient } from "../src/azureSphereManagementClient.js"; -import { describe, it, assert, beforeEach, afterEach } from "vitest"; - -const replaceableVariables: Record = { - 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" -}; - -const recorderOptions: RecorderStartOptions = { - envSetupForPlayback: replaceableVariables, - removeCentralSanitizers: [ - "AZSDK3493", // .name in the body is not a secret and is listed below in the beforeEach section - "AZSDK3430", // .id in the body is not a secret and is listed below in the beforeEach section - ], -}; - -export const testPollingOptions = { - updateIntervalInMs: isPlaybackMode() ? 0 : undefined, -}; - -describe("Sphere test", () => { - let recorder: Recorder; - let subscriptionId: string; - let client: AzureSphereManagementClient; - let resourceGroup: string; - let resourcename: string; - - beforeEach(async (ctx) => { - recorder = new Recorder(ctx); - await recorder.start(recorderOptions); - subscriptionId = env.SUBSCRIPTION_ID || ''; - // This is an example of how the environment variables are used - const credential = createTestCredential(); - client = new AzureSphereManagementClient(credential, subscriptionId, recorder.configureClientOptions({})); - resourceGroup = "myjstest"; - resourcename = "resourcetest"; - }); - - afterEach(async () => { - await recorder.stop(); - }); - - it("catalogs create test", async () => { - const res = await client.catalogs.beginCreateOrUpdateAndWait( - resourceGroup, - resourcename, - { location: "global" }, - testPollingOptions); - assert.equal(res.name, resourcename); - }); - - it("catalogs get test", async () => { - const res = await client.catalogs.get(resourceGroup, - resourcename); - assert.equal(res.name, resourcename); - }); - - it("catalogs list test", async () => { - const resArray = new Array(); - for await (let item of client.catalogs.listByResourceGroup(resourceGroup)) { - resArray.push(item); - } - assert.equal(resArray.length, 1); - }); - - it("operations list test", async () => { - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - assert.notEqual(resArray.length, 0); - }); - - it("catalogs delete test", async () => { - const resArray = new Array(); - await client.catalogs.beginDeleteAndWait(resourceGroup, - resourcename, testPollingOptions); - for await (let item of client.catalogs.listByResourceGroup(resourceGroup)) { - resArray.push(item); - } - assert.equal(resArray.length, 0); - }); -}) diff --git a/sdk/sphere/arm-sphere/tsconfig.browser.config.json b/sdk/sphere/arm-sphere/tsconfig.browser.config.json index 0c8bafa97126..75871518e3a0 100644 --- a/sdk/sphere/arm-sphere/tsconfig.browser.config.json +++ b/sdk/sphere/arm-sphere/tsconfig.browser.config.json @@ -1,6 +1,3 @@ { - "extends": [ - "./tsconfig.test.json", - "../../../tsconfig.browser.base.json" - ] + "extends": ["./tsconfig.test.json", "../../../tsconfig.browser.base.json"] } diff --git a/sdk/sphere/arm-sphere/tsconfig.samples.json b/sdk/sphere/arm-sphere/tsconfig.samples.json index 02f96245d152..126aed5c3419 100644 --- a/sdk/sphere/arm-sphere/tsconfig.samples.json +++ b/sdk/sphere/arm-sphere/tsconfig.samples.json @@ -2,9 +2,7 @@ "extends": "../../../tsconfig.samples.base.json", "compilerOptions": { "paths": { - "@azure/arm-sphere": [ - "./dist/esm" - ] + "@azure/arm-sphere": ["./dist/esm"] } } } diff --git a/sdk/sphere/arm-sphere/tsconfig.test.json b/sdk/sphere/arm-sphere/tsconfig.test.json index 3c2b783a8c1b..290ca214aebc 100644 --- a/sdk/sphere/arm-sphere/tsconfig.test.json +++ b/sdk/sphere/arm-sphere/tsconfig.test.json @@ -1,6 +1,3 @@ { - "extends": [ - "./tsconfig.src.json", - "../../../tsconfig.test.base.json" - ] + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] } diff --git a/sdk/sphere/arm-sphere/tsp-location.yaml b/sdk/sphere/arm-sphere/tsp-location.yaml new file mode 100644 index 000000000000..bd299c7688a9 --- /dev/null +++ b/sdk/sphere/arm-sphere/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/sphere/Sphere.Management +commit: b9a8c9e8eb8998a222f126a005d1ab633f1daad9 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/sphere/ci.mgmt.yml b/sdk/sphere/ci.mgmt.yml index 4a7656a65ea6..ce855d8c615c 100644 --- a/sdk/sphere/ci.mgmt.yml +++ b/sdk/sphere/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -13,7 +13,6 @@ trigger: include: - sdk/sphere/arm-sphere - sdk/sphere/ci.mgmt.yml - pr: branches: include: @@ -27,7 +26,6 @@ pr: include: - sdk/sphere/arm-sphere - sdk/sphere/ci.mgmt.yml - extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: @@ -35,4 +33,3 @@ extends: Artifacts: - name: azure-arm-sphere safeName: azurearmsphere - \ No newline at end of file