From 340cf3af23cbe5d5380b149a239fda4af10a80e0 Mon Sep 17 00:00:00 2001 From: ZiWei Chen <98569699+kazrael2119@users.noreply.github.com> Date: Thu, 19 Dec 2024 18:05:38 +0800 Subject: [PATCH] [mgmt] deviceregistry release (#32190) https://github.com/Azure/sdk-release-request/issues/5760 --- common/config/rush/pnpm-lock.yaml | 41 +- .../arm-deviceregistry/CHANGELOG.md | 195 +- .../arm-deviceregistry/README.md | 19 +- .../arm-deviceregistry/_meta.json | 8 - .../arm-deviceregistry/api-extractor.json | 6 +- .../arm-deviceregistry/assets.json | 2 +- .../arm-deviceregistry/eslint.config.mjs | 17 + .../arm-deviceregistry/package.json | 203 +- .../review/arm-deviceregistry-models.api.md | 582 +++++ .../review/arm-deviceregistry.api.md | 809 ++++-- .../arm-deviceregistry/sample.env | 5 +- ...etEndpointProfilesCreateOrReplaceSample.ts | 96 +- .../assetEndpointProfilesDeleteSample.ts | 35 +- .../assetEndpointProfilesGetSample.ts | 49 +- ...dpointProfilesListByResourceGroupSample.ts | 33 +- ...ndpointProfilesListBySubscriptionSample.ts | 27 +- .../assetEndpointProfilesUpdateSample.ts | 47 +- .../assetsCreateOrReplaceSample.ts | 424 +-- .../samples-dev/assetsDeleteSample.ts | 35 +- .../samples-dev/assetsGetSample.ts | 50 +- .../assetsListByResourceGroupSample.ts | 31 +- .../assetsListBySubscriptionSample.ts | 27 +- .../samples-dev/assetsUpdateSample.ts | 45 +- .../samples-dev/billingContainersGetSample.ts | 25 + ...llingContainersListBySubscriptionSample.ts | 29 + ...etEndpointProfilesCreateOrReplaceSample.ts | 44 + ...overedAssetEndpointProfilesDeleteSample.ts | 27 + ...iscoveredAssetEndpointProfilesGetSample.ts | 28 + ...dpointProfilesListByResourceGroupSample.ts | 31 + ...ndpointProfilesListBySubscriptionSample.ts | 29 + ...overedAssetEndpointProfilesUpdateSample.ts | 38 + .../discoveredAssetsCreateOrReplaceSample.ts | 88 + .../discoveredAssetsDeleteSample.ts | 24 + .../samples-dev/discoveredAssetsGetSample.ts | 25 + ...scoveredAssetsListByResourceGroupSample.ts | 29 + ...iscoveredAssetsListBySubscriptionSample.ts | 29 + .../discoveredAssetsUpdateSample.ts | 30 + .../samples-dev/operationStatusGetSample.ts | 33 +- .../samples-dev/operationsListSample.ts | 27 +- .../schemaRegistriesCreateOrReplaceSample.ts | 39 + .../schemaRegistriesDeleteSample.ts | 24 + .../samples-dev/schemaRegistriesGetSample.ts | 25 + ...hemaRegistriesListByResourceGroupSample.ts | 29 + ...chemaRegistriesListBySubscriptionSample.ts | 29 + .../schemaRegistriesUpdateSample.ts | 31 + .../schemaVersionsCreateOrReplaceSample.ts | 37 + .../samples-dev/schemaVersionsDeleteSample.ts | 24 + .../samples-dev/schemaVersionsGetSample.ts | 30 + .../schemaVersionsListBySchemaSample.ts | 33 + .../schemasCreateOrReplaceSample.ts | 38 + .../samples-dev/schemasDeleteSample.ts | 24 + .../samples-dev/schemasGetSample.ts | 25 + .../schemasListBySchemaRegistrySample.ts | 32 + .../samples/v1-beta/javascript/README.md | 98 +- ...etEndpointProfilesCreateOrReplaceSample.js | 87 +- .../assetEndpointProfilesDeleteSample.js | 31 +- .../assetEndpointProfilesGetSample.js | 47 +- ...dpointProfilesListByResourceGroupSample.js | 27 +- ...ndpointProfilesListBySubscriptionSample.js | 24 +- .../assetEndpointProfilesUpdateSample.js | 38 +- .../javascript/assetsCreateOrReplaceSample.js | 396 +-- .../v1-beta/javascript/assetsDeleteSample.js | 28 +- .../v1-beta/javascript/assetsGetSample.js | 44 +- .../assetsListByResourceGroupSample.js | 27 +- .../assetsListBySubscriptionSample.js | 24 +- .../v1-beta/javascript/assetsUpdateSample.js | 32 +- .../javascript/billingContainersGetSample.js | 25 + ...llingContainersListBySubscriptionSample.js | 29 + ...etEndpointProfilesCreateOrReplaceSample.js | 44 + ...overedAssetEndpointProfilesDeleteSample.js | 27 + ...iscoveredAssetEndpointProfilesGetSample.js | 28 + ...dpointProfilesListByResourceGroupSample.js | 31 + ...ndpointProfilesListBySubscriptionSample.js | 29 + ...overedAssetEndpointProfilesUpdateSample.js | 38 + .../discoveredAssetsCreateOrReplaceSample.js | 88 + .../discoveredAssetsDeleteSample.js | 24 + .../javascript/discoveredAssetsGetSample.js | 25 + ...scoveredAssetsListByResourceGroupSample.js | 29 + ...iscoveredAssetsListBySubscriptionSample.js | 29 + .../discoveredAssetsUpdateSample.js | 30 + .../javascript/operationStatusGetSample.js | 30 +- .../javascript/operationsListSample.js | 24 +- .../samples/v1-beta/javascript/package.json | 3 +- .../samples/v1-beta/javascript/sample.env | 5 +- .../schemaRegistriesCreateOrReplaceSample.js | 39 + .../schemaRegistriesDeleteSample.js | 24 + .../javascript/schemaRegistriesGetSample.js | 25 + ...hemaRegistriesListByResourceGroupSample.js | 29 + ...chemaRegistriesListBySubscriptionSample.js | 29 + .../schemaRegistriesUpdateSample.js | 31 + .../schemaVersionsCreateOrReplaceSample.js | 37 + .../javascript/schemaVersionsDeleteSample.js | 24 + .../javascript/schemaVersionsGetSample.js | 30 + .../schemaVersionsListBySchemaSample.js | 33 + .../schemasCreateOrReplaceSample.js | 38 + .../v1-beta/javascript/schemasDeleteSample.js | 24 + .../v1-beta/javascript/schemasGetSample.js | 25 + .../schemasListBySchemaRegistrySample.js | 32 + .../samples/v1-beta/typescript/README.md | 98 +- .../samples/v1-beta/typescript/package.json | 3 +- .../samples/v1-beta/typescript/sample.env | 5 +- ...etEndpointProfilesCreateOrReplaceSample.ts | 96 +- .../src/assetEndpointProfilesDeleteSample.ts | 35 +- .../src/assetEndpointProfilesGetSample.ts | 49 +- ...dpointProfilesListByResourceGroupSample.ts | 33 +- ...ndpointProfilesListBySubscriptionSample.ts | 27 +- .../src/assetEndpointProfilesUpdateSample.ts | 47 +- .../src/assetsCreateOrReplaceSample.ts | 424 +-- .../typescript/src/assetsDeleteSample.ts | 35 +- .../v1-beta/typescript/src/assetsGetSample.ts | 50 +- .../src/assetsListByResourceGroupSample.ts | 31 +- .../src/assetsListBySubscriptionSample.ts | 27 +- .../typescript/src/assetsUpdateSample.ts | 45 +- .../src/billingContainersGetSample.ts | 25 + ...llingContainersListBySubscriptionSample.ts | 29 + ...etEndpointProfilesCreateOrReplaceSample.ts | 44 + ...overedAssetEndpointProfilesDeleteSample.ts | 27 + ...iscoveredAssetEndpointProfilesGetSample.ts | 28 + ...dpointProfilesListByResourceGroupSample.ts | 31 + ...ndpointProfilesListBySubscriptionSample.ts | 29 + ...overedAssetEndpointProfilesUpdateSample.ts | 38 + .../discoveredAssetsCreateOrReplaceSample.ts | 88 + .../src/discoveredAssetsDeleteSample.ts | 24 + .../src/discoveredAssetsGetSample.ts | 25 + ...scoveredAssetsListByResourceGroupSample.ts | 29 + ...iscoveredAssetsListBySubscriptionSample.ts | 29 + .../src/discoveredAssetsUpdateSample.ts | 30 + .../src/operationStatusGetSample.ts | 33 +- .../typescript/src/operationsListSample.ts | 27 +- .../schemaRegistriesCreateOrReplaceSample.ts | 39 + .../src/schemaRegistriesDeleteSample.ts | 24 + .../src/schemaRegistriesGetSample.ts | 25 + ...hemaRegistriesListByResourceGroupSample.ts | 29 + ...chemaRegistriesListBySubscriptionSample.ts | 29 + .../src/schemaRegistriesUpdateSample.ts | 31 + .../schemaVersionsCreateOrReplaceSample.ts | 37 + .../src/schemaVersionsDeleteSample.ts | 24 + .../typescript/src/schemaVersionsGetSample.ts | 30 + .../src/schemaVersionsListBySchemaSample.ts | 33 + .../src/schemasCreateOrReplaceSample.ts | 38 + .../typescript/src/schemasDeleteSample.ts | 24 + .../typescript/src/schemasGetSample.ts | 25 + .../src/schemasListBySchemaRegistrySample.ts | 32 + .../src/api/assetEndpointProfiles/index.ts | 353 +++ .../src/api/assets/index.ts | 306 +++ .../src/api/billingContainers/index.ts | 109 + .../api/deviceRegistryManagementContext.ts | 57 + .../discoveredAssetEndpointProfiles/index.ts | 370 +++ .../src/api/discoveredAssets/index.ts | 343 +++ .../arm-deviceregistry/src/api/index.ts | 110 + .../src/api/operationStatus/index.ts | 60 + .../src/api/operations/index.ts | 56 + .../arm-deviceregistry/src/api/options.ts | 178 ++ .../src/api/schemaRegistries/index.ts | 343 +++ .../src/api/schemaVersions/index.ts | 251 ++ .../src/api/schemas/index.ts | 231 ++ .../classic/assetEndpointProfiles/index.ts | 138 + .../src/classic/assets/index.ts | 106 + .../src/classic/billingContainers/index.ts | 48 + .../discoveredAssetEndpointProfiles/index.ts | 147 ++ .../src/classic/discoveredAssets/index.ts | 131 + .../arm-deviceregistry/src/classic/index.ts | 13 + .../src/classic/operationStatus/index.ts | 36 + .../src/classic/operations/index.ts | 28 + .../src/classic/schemaRegistries/index.ts | 131 + .../src/classic/schemaVersions/index.ts | 135 + .../src/classic/schemas/index.ts | 120 + .../src/deviceRegistryManagementClient.ts | 231 +- .../src/helpers/serializerHelpers.ts | 36 + .../arm-deviceregistry/src/index.ts | 161 +- .../arm-deviceregistry/src/logger.ts | 5 + .../arm-deviceregistry/src/lroImpl.ts | 42 - .../arm-deviceregistry/src/models/index.ts | 950 +------ .../arm-deviceregistry/src/models/mappers.ts | 1387 ---------- .../arm-deviceregistry/src/models/models.ts | 2294 +++++++++++++++++ .../src/models/parameters.ts | 188 -- .../src/operations/assetEndpointProfiles.ts | 733 ------ .../src/operations/assets.ts | 722 ------ .../src/operations/index.ts | 12 - .../src/operations/operationStatus.ts | 71 - .../src/operations/operations.ts | 149 -- .../assetEndpointProfiles.ts | 145 -- .../src/operationsInterfaces/assets.ts | 139 - .../src/operationsInterfaces/index.ts | 12 - .../operationsInterfaces/operationStatus.ts | 27 - .../src/operationsInterfaces/operations.ts | 22 - .../arm-deviceregistry/src/pagingHelper.ts | 39 - .../src/restorePollerHelpers.ts | 248 ++ .../src/static-helpers/pagingHelpers.ts | 241 ++ .../src/static-helpers/pollingHelpers.ts | 126 + .../deviceregistry_operations_test.spec.ts | 70 - .../deviceregistry_operations_test.spec.ts | 46 + .../test/public/utils/recordedClient.ts | 23 + .../tsconfig.browser.config.json | 3 + .../arm-deviceregistry/tsconfig.json | 40 +- .../arm-deviceregistry/tsconfig.samples.json | 8 + .../arm-deviceregistry/tsconfig.src.json | 3 + .../arm-deviceregistry/tsconfig.test.json | 3 + .../arm-deviceregistry/tsp-location.yaml | 4 + .../vitest.browser.config.ts | 17 + .../arm-deviceregistry/vitest.config.ts | 15 + .../arm-deviceregistry/vitest.esm.config.ts | 12 + sdk/deviceregistry/ci.mgmt.yml | 5 +- 203 files changed, 12837 insertions(+), 6756 deletions(-) delete mode 100644 sdk/deviceregistry/arm-deviceregistry/_meta.json create mode 100644 sdk/deviceregistry/arm-deviceregistry/eslint.config.mjs create mode 100644 sdk/deviceregistry/arm-deviceregistry/review/arm-deviceregistry-models.api.md create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/billingContainersGetSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/billingContainersListBySubscriptionSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesCreateOrReplaceSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesDeleteSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesGetSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesListByResourceGroupSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesListBySubscriptionSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesUpdateSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsCreateOrReplaceSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsDeleteSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsGetSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsListByResourceGroupSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsListBySubscriptionSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsUpdateSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesCreateOrReplaceSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesDeleteSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesGetSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesListByResourceGroupSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesListBySubscriptionSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesUpdateSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsCreateOrReplaceSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsDeleteSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsGetSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsListBySchemaSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasCreateOrReplaceSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasDeleteSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasGetSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasListBySchemaRegistrySample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/billingContainersGetSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/billingContainersListBySubscriptionSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesCreateOrReplaceSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesDeleteSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesGetSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesListByResourceGroupSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesListBySubscriptionSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesUpdateSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsCreateOrReplaceSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsDeleteSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsGetSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsListByResourceGroupSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsListBySubscriptionSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsUpdateSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesCreateOrReplaceSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesDeleteSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesGetSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesListByResourceGroupSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesListBySubscriptionSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesUpdateSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsCreateOrReplaceSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsDeleteSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsGetSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsListBySchemaSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasCreateOrReplaceSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasDeleteSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasGetSample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasListBySchemaRegistrySample.js create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/billingContainersGetSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/billingContainersListBySubscriptionSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesCreateOrReplaceSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesDeleteSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesGetSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesListByResourceGroupSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesListBySubscriptionSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesUpdateSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsCreateOrReplaceSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsDeleteSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsGetSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsListByResourceGroupSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsListBySubscriptionSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsUpdateSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesCreateOrReplaceSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesDeleteSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesGetSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesListByResourceGroupSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesListBySubscriptionSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesUpdateSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsCreateOrReplaceSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsDeleteSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsGetSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsListBySchemaSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasCreateOrReplaceSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasDeleteSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasGetSample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasListBySchemaRegistrySample.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/api/assetEndpointProfiles/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/api/assets/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/api/billingContainers/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/api/deviceRegistryManagementContext.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/api/discoveredAssetEndpointProfiles/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/api/discoveredAssets/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/api/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/api/operationStatus/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/api/operations/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/api/options.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/api/schemaRegistries/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/api/schemaVersions/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/api/schemas/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/classic/assetEndpointProfiles/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/classic/assets/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/classic/billingContainers/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/classic/discoveredAssetEndpointProfiles/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/classic/discoveredAssets/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/classic/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/classic/operationStatus/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/classic/operations/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/classic/schemaRegistries/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/classic/schemaVersions/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/classic/schemas/index.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/helpers/serializerHelpers.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/logger.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/lroImpl.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/models/mappers.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/models/models.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/models/parameters.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/operations/assetEndpointProfiles.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/operations/assets.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/operations/index.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/operations/operationStatus.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/operations/operations.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/assetEndpointProfiles.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/assets.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/index.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/operationStatus.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/operations.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/src/pagingHelper.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/restorePollerHelpers.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/static-helpers/pagingHelpers.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/src/static-helpers/pollingHelpers.ts delete mode 100644 sdk/deviceregistry/arm-deviceregistry/test/deviceregistry_operations_test.spec.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/test/public/deviceregistry_operations_test.spec.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/test/public/utils/recordedClient.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/tsconfig.browser.config.json create mode 100644 sdk/deviceregistry/arm-deviceregistry/tsconfig.samples.json create mode 100644 sdk/deviceregistry/arm-deviceregistry/tsconfig.src.json create mode 100644 sdk/deviceregistry/arm-deviceregistry/tsconfig.test.json create mode 100644 sdk/deviceregistry/arm-deviceregistry/tsp-location.yaml create mode 100644 sdk/deviceregistry/arm-deviceregistry/vitest.browser.config.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/vitest.config.ts create mode 100644 sdk/deviceregistry/arm-deviceregistry/vitest.esm.config.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 654376987382..f52e8265a995 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -297,7 +297,7 @@ importers: version: file:projects/arm-deviceprovisioningservices.tgz '@rush-temp/arm-deviceregistry': specifier: file:./projects/arm-deviceregistry.tgz - version: file:projects/arm-deviceregistry.tgz + version: file:projects/arm-deviceregistry.tgz(msw@2.6.8(@types/node@22.7.9)(typescript@5.7.2))(vite@5.4.11(@types/node@22.7.9)) '@rush-temp/arm-deviceupdate': specifier: file:./projects/arm-deviceupdate.tgz version: file:projects/arm-deviceupdate.tgz @@ -2820,7 +2820,7 @@ packages: version: 0.0.0 '@rush-temp/arm-deviceregistry@file:projects/arm-deviceregistry.tgz': - resolution: {integrity: sha512-0bWMD74mBtOu2gcjb2Sv8ItM8hzu8pOfQHcKge9qnAoL+F/a9AVxjZLbr/jiA/o0RFMWJEtWgeDUeM6HRg4+7g==, tarball: file:projects/arm-deviceregistry.tgz} + resolution: {integrity: sha512-WsvlPu2XOJPM8ZI54Vv/iib89sHtQPriX+B/LoO5w0UkU9WyV8bjcYbCi/cCOYYMLcsi5dWvyfRU20a6BLppFA==, tarball: file:projects/arm-deviceregistry.tgz} version: 0.0.0 '@rush-temp/arm-deviceupdate@file:projects/arm-deviceupdate.tgz': @@ -11931,25 +11931,38 @@ snapshots: - '@swc/wasm' - supports-color - '@rush-temp/arm-deviceregistry@file:projects/arm-deviceregistry.tgz': + '@rush-temp/arm-deviceregistry@file:projects/arm-deviceregistry.tgz(msw@2.6.8(@types/node@22.7.9)(typescript@5.7.2))(vite@5.4.11(@types/node@22.7.9))': dependencies: - '@azure-tools/test-credential': 1.3.1 - '@azure-tools/test-recorder': 3.5.2 - '@azure/abort-controller': 1.1.0 - '@azure/core-lro': 2.7.2 - '@types/chai': 4.3.20 - '@types/mocha': 10.0.10 + '@microsoft/api-extractor': 7.48.0(@types/node@18.19.68) '@types/node': 18.19.68 - chai: 4.5.0 + '@vitest/browser': 2.1.8(@types/node@18.19.68)(playwright@1.49.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.7.9))(vitest@2.1.8) + '@vitest/coverage-istanbul': 2.1.8(vitest@2.1.8) dotenv: 16.4.7 - mocha: 11.0.2 - ts-node: 10.9.2(@types/node@18.19.68)(typescript@5.7.2) + eslint: 9.17.0 + playwright: 1.49.1 tslib: 2.8.1 typescript: 5.7.2 + vitest: 2.1.8(@types/node@18.19.68)(@vitest/browser@2.1.8)(msw@2.6.8(@types/node@22.7.9)(typescript@5.7.2)) transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' + - '@edge-runtime/vm' + - '@vitest/ui' + - bufferutil + - happy-dom + - jiti + - jsdom + - less + - lightningcss + - msw + - safaridriver + - sass + - sass-embedded + - stylus + - sugarss - supports-color + - terser + - utf-8-validate + - vite + - webdriverio '@rush-temp/arm-deviceupdate@file:projects/arm-deviceupdate.tgz': dependencies: diff --git a/sdk/deviceregistry/arm-deviceregistry/CHANGELOG.md b/sdk/deviceregistry/arm-deviceregistry/CHANGELOG.md index 451e413291cf..28f77ed8869f 100644 --- a/sdk/deviceregistry/arm-deviceregistry/CHANGELOG.md +++ b/sdk/deviceregistry/arm-deviceregistry/CHANGELOG.md @@ -1,15 +1,196 @@ # Release History - -## 1.0.0-beta.2 (Unreleased) - + +## 1.0.0-beta.2 (2024-12-12) +Compared with version 1.0.0-beta.1 + ### Features Added -### Breaking Changes + - Added operation group BillingContainersOperations + - Added operation group DiscoveredAssetEndpointProfilesOperations + - Added operation group DiscoveredAssetsOperations + - Added operation group SchemaRegistriesOperations + - Added operation group SchemasOperations + - Added operation group SchemaVersionsOperations + - Added operation AssetEndpointProfilesOperations.createOrReplace + - Added operation AssetEndpointProfilesOperations.delete + - Added operation AssetEndpointProfilesOperations.update + - Added operation AssetsOperations.createOrReplace + - Added operation AssetsOperations.delete + - Added operation AssetsOperations.update + - Added Interface AssetEndpointProfileStatus + - Added Interface AssetEndpointProfileStatusError + - Added Interface AssetStatusDataset + - Added Interface AssetStatusEvent + - Added Interface Authentication + - Added Interface BillingContainer + - Added Interface BillingContainerProperties + - Added Interface BillingContainersGetOptionalParams + - Added Interface BillingContainersListBySubscriptionOptionalParams + - Added Interface DataPointBase + - Added Interface Dataset + - Added Interface DiscoveredAsset + - Added Interface DiscoveredAssetEndpointProfile + - Added Interface DiscoveredAssetEndpointProfileProperties + - Added Interface DiscoveredAssetEndpointProfilesCreateOrReplaceOptionalParams + - Added Interface DiscoveredAssetEndpointProfilesDeleteOptionalParams + - Added Interface DiscoveredAssetEndpointProfilesGetOptionalParams + - Added Interface DiscoveredAssetEndpointProfilesListByResourceGroupOptionalParams + - Added Interface DiscoveredAssetEndpointProfilesListBySubscriptionOptionalParams + - Added Interface DiscoveredAssetEndpointProfilesUpdateOptionalParams + - Added Interface DiscoveredAssetEndpointProfileUpdate + - Added Interface DiscoveredAssetEndpointProfileUpdateProperties + - Added Interface DiscoveredAssetProperties + - Added Interface DiscoveredAssetsCreateOrReplaceOptionalParams + - Added Interface DiscoveredAssetsDeleteOptionalParams + - Added Interface DiscoveredAssetsGetOptionalParams + - Added Interface DiscoveredAssetsListByResourceGroupOptionalParams + - Added Interface DiscoveredAssetsListBySubscriptionOptionalParams + - Added Interface DiscoveredAssetsUpdateOptionalParams + - Added Interface DiscoveredAssetUpdate + - Added Interface DiscoveredAssetUpdateProperties + - Added Interface DiscoveredDataPoint + - Added Interface DiscoveredDataset + - Added Interface DiscoveredEvent + - Added Interface EventBase + - Added Interface MessageSchemaReference + - Added Interface PagedAsyncIterableIterator + - Added Interface PageSettings + - Added Interface ProxyResource + - Added Interface RestorePollerOptions + - Added Interface Schema + - Added Interface SchemaProperties + - Added Interface SchemaRegistriesCreateOrReplaceOptionalParams + - Added Interface SchemaRegistriesDeleteOptionalParams + - Added Interface SchemaRegistriesGetOptionalParams + - Added Interface SchemaRegistriesListByResourceGroupOptionalParams + - Added Interface SchemaRegistriesListBySubscriptionOptionalParams + - Added Interface SchemaRegistriesUpdateOptionalParams + - Added Interface SchemaRegistry + - Added Interface SchemaRegistryProperties + - Added Interface SchemaRegistryUpdate + - Added Interface SchemaRegistryUpdateProperties + - Added Interface SchemasCreateOrReplaceOptionalParams + - Added Interface SchemasDeleteOptionalParams + - Added Interface SchemasGetOptionalParams + - Added Interface SchemasListBySchemaRegistryOptionalParams + - Added Interface SchemaVersion + - Added Interface SchemaVersionProperties + - Added Interface SchemaVersionsCreateOrReplaceOptionalParams + - Added Interface SchemaVersionsDeleteOptionalParams + - Added Interface SchemaVersionsGetOptionalParams + - Added Interface SchemaVersionsListBySchemaOptionalParams + - Added Interface SystemAssignedServiceIdentity + - Added Interface Topic + - Added Type Alias AuthenticationMethod + - Added Type Alias ContinuablePage + - Added Type Alias DataPointObservabilityMode + - Added Type Alias EventObservabilityMode + - Added Type Alias Format + - Added Type Alias SchemaType + - Added Type Alias SystemAssignedServiceIdentityType + - Added Type Alias TopicRetainType + - Interface AssetEndpointProfileProperties has a new optional parameter authentication + - Interface AssetEndpointProfileProperties has a new optional parameter discoveredAssetEndpointProfileRef + - Interface AssetEndpointProfileProperties has a new optional parameter status + - Interface AssetEndpointProfileUpdateProperties has a new optional parameter authentication + - Interface AssetEndpointProfileUpdateProperties has a new optional parameter endpointProfileType + - Interface AssetProperties has a new optional parameter datasets + - Interface AssetProperties has a new optional parameter defaultDatasetsConfiguration + - Interface AssetProperties has a new optional parameter defaultTopic + - Interface AssetProperties has a new optional parameter discoveredAssetRefs + - Interface AssetStatus has a new optional parameter datasets + - Interface AssetStatus has a new optional parameter events + - Interface AssetUpdateProperties has a new optional parameter datasets + - Interface AssetUpdateProperties has a new optional parameter defaultDatasetsConfiguration + - Interface AssetUpdateProperties has a new optional parameter defaultTopic + - Added Enum KnownAuthenticationMethod + - Added Enum KnownDataPointObservabilityMode + - Added Enum KnownEventObservabilityMode + - Added Enum KnownFormat + - Added Enum KnownSchemaType + - Added Enum KnownSystemAssignedServiceIdentityType + - Added Enum KnownTopicRetainType + - Added Enum KnownVersions + - Enum KnownOrigin has a new value "user,system" + - Enum KnownOrigin has a new value system + - Enum KnownOrigin has a new value user + - Enum KnownProvisioningState has a new value Deleting + - Added function restorePoller -### Bugs Fixed - -### Other Changes +### Breaking Changes + - Removed operation AssetEndpointProfiles.beginCreateOrReplace + - Removed operation AssetEndpointProfiles.beginCreateOrReplaceAndWait + - Removed operation AssetEndpointProfiles.beginDelete + - Removed operation AssetEndpointProfiles.beginDeleteAndWait + - Removed operation AssetEndpointProfiles.beginUpdate + - Removed operation AssetEndpointProfiles.beginUpdateAndWait + - Removed operation Assets.beginCreateOrReplace + - Removed operation Assets.beginCreateOrReplaceAndWait + - Removed operation Assets.beginDelete + - Removed operation Assets.beginDeleteAndWait + - Removed operation Assets.beginUpdate + - Removed operation Assets.beginUpdateAndWait + - Class DeviceRegistryManagementClient has a new signature + - Interface AssetEndpointProfileProperties no longer has parameter transportAuthentication + - Interface AssetEndpointProfileProperties no longer has parameter userAuthentication + - Interface AssetEndpointProfilesCreateOrReplaceOptionalParams no longer has parameter resumeFrom + - Interface AssetEndpointProfilesDeleteOptionalParams no longer has parameter resumeFrom + - Interface AssetEndpointProfilesUpdateOptionalParams no longer has parameter resumeFrom + - Interface AssetEndpointProfileUpdateProperties no longer has parameter transportAuthentication + - Interface AssetEndpointProfileUpdateProperties no longer has parameter userAuthentication + - Interface AssetProperties no longer has parameter assetEndpointProfileUri + - Interface AssetProperties no longer has parameter assetType + - Interface AssetProperties no longer has parameter dataPoints + - Interface AssetProperties no longer has parameter defaultDataPointsConfiguration + - Interface AssetsCreateOrReplaceOptionalParams no longer has parameter resumeFrom + - Interface AssetsDeleteOptionalParams no longer has parameter resumeFrom + - Interface AssetsUpdateOptionalParams no longer has parameter resumeFrom + - Interface AssetUpdateProperties no longer has parameter assetType + - Interface AssetUpdateProperties no longer has parameter dataPoints + - Interface AssetUpdateProperties no longer has parameter defaultDataPointsConfiguration + - Interface DataPoint no longer has parameter capabilityId + - Interface DeviceRegistryManagementClientOptionalParams no longer has parameter $host + - Interface DeviceRegistryManagementClientOptionalParams no longer has parameter endpoint + - Interface Event_2 no longer has parameter capabilityId + - Interface UsernamePasswordCredentials no longer has parameter passwordReference + - Interface UsernamePasswordCredentials no longer has parameter usernameReference + - Interface X509Credentials no longer has parameter certificateReference + - Interface AssetEndpointProfileProperties has a new required parameter endpointProfileType + - Interface AssetProperties has a new required parameter assetEndpointProfileRef + - Interface UsernamePasswordCredentials has a new required parameter passwordSecretName + - Interface UsernamePasswordCredentials has a new required parameter usernameSecretName + - Interface X509Credentials has a new required parameter certificateSecretName + - Type of parameter tags of interface AssetEndpointProfileUpdate is changed from { + [propertyName: string]: string; + } to Record + - Type of parameter attributes of interface AssetProperties is changed from { + [propertyName: string]: any; + } to Record + - Type of parameter tags of interface AssetUpdate is changed from { + [propertyName: string]: string; + } to Record + - Type of parameter attributes of interface AssetUpdateProperties is changed from { + [propertyName: string]: any; + } to Record + - Type of parameter observabilityMode of interface DataPoint is changed from DataPointsObservabilityMode to DataPointObservabilityMode + - Type of parameter info of interface ErrorAdditionalInfo is changed from Record to Record + - Type of parameter observabilityMode of interface Event_2 is changed from EventsObservabilityMode to EventObservabilityMode + - Type of parameter tags of interface TrackedResource is changed from { + [propertyName: string]: string; + } to Record + - Class DeviceRegistryManagementClient no longer has parameter $host + - Class DeviceRegistryManagementClient no longer has parameter apiVersion + - Class DeviceRegistryManagementClient no longer has parameter subscriptionId + - Removed Enum KnownDataPointsObservabilityMode + - Removed Enum KnownEventsObservabilityMode + - Removed Enum KnownUserAuthenticationMode + - Enum KnownOrigin no longer has value System + - Enum KnownOrigin no longer has value User + - Enum KnownOrigin no longer has value UserSystem + - Removed function getContinuationToken + + ## 1.0.0-beta.1 (2024-04-15) The package of @azure/arm-deviceregistry 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/deviceregistry/arm-deviceregistry/README.md b/sdk/deviceregistry/arm-deviceregistry/README.md index 5fdede41e847..810113aa7ae2 100644 --- a/sdk/deviceregistry/arm-deviceregistry/README.md +++ b/sdk/deviceregistry/arm-deviceregistry/README.md @@ -4,10 +4,12 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f Microsoft.DeviceRegistry Resource Provider management API. -[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceregistry/arm-deviceregistry) | -[Package (NPM)](https://www.npmjs.com/package/@azure/arm-deviceregistry) | -[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-deviceregistry?view=azure-node-preview) | -[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/deviceregistry/arm-deviceregistry) +- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-deviceregistry) +- [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-deviceregistry?view=azure-node-preview) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceregistry/arm-deviceregistry/samples) ## Getting started @@ -43,8 +45,7 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below npm install @azure/identity ``` -You will also need to **register a new AAD application and grant access to Azure DeviceRegistryManagement** 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 Azure DeviceRegistry** 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://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). @@ -89,7 +90,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/deviceregistry/arm-deviceregistry/samples) directory for detailed examples on how to use this library. ## Contributing @@ -99,10 +100,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) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fdeviceregistry%2Farm-deviceregistry%2FREADME.png) - -[azure_cli]: https://docs.microsoft.com/cli/azure -[azure_sub]: https://azure.microsoft.com/free/ [azure_sub]: https://azure.microsoft.com/free/ [azure_portal]: https://portal.azure.com [azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity diff --git a/sdk/deviceregistry/arm-deviceregistry/_meta.json b/sdk/deviceregistry/arm-deviceregistry/_meta.json deleted file mode 100644 index 06e92ef5e81a..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/_meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "commit": "59c04c61a355af4b56dd91a4b9b5eefe76e2f0cd", - "readme": "specification/deviceregistry/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\\deviceregistry\\resource-manager\\readme.md --use=@autorest/typescript@6.0.20 --generate-sample=true", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.5", - "use": "@autorest/typescript@6.0.20" -} \ No newline at end of file diff --git a/sdk/deviceregistry/arm-deviceregistry/api-extractor.json b/sdk/deviceregistry/arm-deviceregistry/api-extractor.json index ed3e5d0b3bec..467572d0991e 100644 --- a/sdk/deviceregistry/arm-deviceregistry/api-extractor.json +++ b/sdk/deviceregistry/arm-deviceregistry/api-extractor.json @@ -1,6 +1,6 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "mainEntryPointFilePath": "dist/esm/index.d.ts", "docModel": { "enabled": true }, @@ -11,7 +11,7 @@ "dtsRollup": { "enabled": true, "untrimmedFilePath": "", - "publicTrimmedFilePath": "./types/arm-deviceregistry.d.ts" + "publicTrimmedFilePath": "dist/arm-deviceregistry.d.ts" }, "messages": { "tsdocMessageReporting": { @@ -28,4 +28,4 @@ } } } -} \ No newline at end of file +} diff --git a/sdk/deviceregistry/arm-deviceregistry/assets.json b/sdk/deviceregistry/arm-deviceregistry/assets.json index 323a06e785ca..47173e93dfa2 100644 --- a/sdk/deviceregistry/arm-deviceregistry/assets.json +++ b/sdk/deviceregistry/arm-deviceregistry/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "js", "TagPrefix": "js/deviceregistry/arm-deviceregistry", - "Tag": "js/deviceregistry/arm-deviceregistry_e400d2d01c" + "Tag": "js/deviceregistry/arm-deviceregistry_efa8d0494f" } diff --git a/sdk/deviceregistry/arm-deviceregistry/eslint.config.mjs b/sdk/deviceregistry/arm-deviceregistry/eslint.config.mjs new file mode 100644 index 000000000000..03244d34a19f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/eslint.config.mjs @@ -0,0 +1,17 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default [ + ...azsdkEslint.configs.recommended, + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-apiextractor-json-types": "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-module": "off", + "@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/deviceregistry/arm-deviceregistry/package.json b/sdk/deviceregistry/arm-deviceregistry/package.json index d043095db8f8..ac267840483c 100644 --- a/sdk/deviceregistry/arm-deviceregistry/package.json +++ b/sdk/deviceregistry/arm-deviceregistry/package.json @@ -1,113 +1,164 @@ { "name": "@azure/arm-deviceregistry", - "sdk-type": "mgmt", - "author": "Microsoft Corporation", - "description": "A generated SDK for DeviceRegistryManagementClient.", "version": "1.0.0-beta.2", + "description": "A generated SDK for DeviceRegistryClient.", "engines": { "node": ">=18.0.0" }, - "dependencies": { - "@azure/abort-controller": "^1.0.0", - "@azure/core-auth": "^1.6.0", - "@azure/core-client": "^1.7.0", - "@azure/core-lro": "^2.5.4", - "@azure/core-paging": "^1.2.0", - "@azure/core-rest-pipeline": "^1.14.0", - "tslib": "^2.2.0" + "sideEffects": false, + "autoPublish": false, + "tshy": { + "project": "./tsconfig.src.json", + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./models": "./src/models/index.ts" + }, + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], + "selfLink": false }, + "type": "module", "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/index.js", - "module": "./dist-esm/src/index.js", - "types": "./types/arm-deviceregistry.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/deviceregistry/arm-deviceregistry/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/deviceRegistryManagementContext.ts", + "prefix": "userAgentInfo" + } + ] + }, + "dependencies": { + "@azure-rest/core-client": "^2.3.1", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.6.0", + "@azure/core-lro": "^3.1.0", + "@azure/core-rest-pipeline": "^1.5.0", + "@azure/core-util": "^1.9.2", + "@azure/logger": "^1.0.0", + "tslib": "^2.6.2" + }, "devDependencies": { - "@azure-tools/test-credential": "^1.1.0", - "@azure-tools/test-recorder": "^3.0.0", + "@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.0.1", - "@types/chai": "^4.2.8", - "@types/mocha": "^10.0.0", + "@azure/eslint-plugin-azure-sdk": "^3.0.0", + "@azure/identity": "^4.2.1", + "@microsoft/api-extractor": "^7.40.3", "@types/node": "^18.0.0", - "chai": "^4.2.0", + "@vitest/browser": "^2.1.8", + "@vitest/coverage-istanbul": "^2.1.8", "dotenv": "^16.0.0", - "mocha": "^11.0.2", - "ts-node": "^10.0.0", - "typescript": "~5.7.2" + "eslint": "^9.9.0", + "playwright": "^1.49.1", + "typescript": "~5.7.2", + "vitest": "^2.1.8" }, - "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/**/*.js", - "dist/**/*.js.map", - "dist/**/*.d.ts", - "dist/**/*.d.ts.map", - "dist-esm/**/*.js", - "dist-esm/**/*.js.map", - "dist-esm/**/*.d.ts", - "dist-esm/**/*.d.ts.map", - "src/**/*.ts", - "README.md", - "LICENSE", - "tsconfig.json", - "review/*", - "CHANGELOG.md", - "types/*" - ], "scripts": { - "build": "npm run clean && tsc && dev-tool run bundle && npm run minify && dev-tool run vendored mkdirp ./review && npm run extract-api", - "build:browser": "echo skipped", - "build:node": "echo skipped", - "build:samples": "echo skipped.", - "build:test": "echo skipped", - "check-format": "echo skipped", + "build": "npm run clean && dev-tool run build-package && dev-tool run vendored mkdirp ./review && dev-tool run extract-api", + "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", + "execute:samples": "dev-tool samples run samples-dev", + "extract-api": "dev-tool run vendored rimraf review && dev-tool run vendored mkdirp ./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": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:node": "echo skipped", "lint": "echo skipped", + "lint:fix": "echo skipped", "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 integration-test", - "test:browser": "echo skipped", - "test:node": "echo skipped", + "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": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", + "test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node", "unit-test": "npm run unit-test:node && npm run unit-test:browser", - "unit-test:browser": "echo skipped", - "unit-test:node": "dev-tool run vendored cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser", + "unit-test:node": "dev-tool run test:vitest", "update-snippets": "echo skipped" }, - "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/deviceRegistryManagementClient.ts", - "prefix": "packageDetails" - } - ] - }, - "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceregistry/arm-deviceregistry", "//sampleConfiguration": { - "productName": "", + "productName": "@azure/arm-deviceregistry", "productSlugs": [ "azure" ], "disableDocsMs": true, "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-deviceregistry?view=azure-node-preview" - } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "react-native": { + "types": "./dist/react-native/index.d.ts", + "default": "./dist/react-native/index.js" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/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", + "browser": "./dist/browser/index.js", + "react-native": "./dist/react-native/index.js" } diff --git a/sdk/deviceregistry/arm-deviceregistry/review/arm-deviceregistry-models.api.md b/sdk/deviceregistry/arm-deviceregistry/review/arm-deviceregistry-models.api.md new file mode 100644 index 000000000000..29a23986e6fb --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/review/arm-deviceregistry-models.api.md @@ -0,0 +1,582 @@ +## API Report File for "@azure/arm-deviceregistry" + +> 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 interface Asset extends TrackedResource { + extendedLocation: ExtendedLocation; + properties?: AssetProperties; +} + +// @public +export interface AssetEndpointProfile extends TrackedResource { + extendedLocation: ExtendedLocation; + properties?: AssetEndpointProfileProperties; +} + +// @public +export interface AssetEndpointProfileProperties { + additionalConfiguration?: string; + authentication?: Authentication; + discoveredAssetEndpointProfileRef?: string; + endpointProfileType: string; + readonly provisioningState?: ProvisioningState; + readonly status?: AssetEndpointProfileStatus; + targetAddress: string; + readonly uuid?: string; +} + +// @public +export interface AssetEndpointProfileStatus { + readonly errors?: AssetEndpointProfileStatusError[]; +} + +// @public +export interface AssetEndpointProfileStatusError { + readonly code?: number; + readonly message?: string; +} + +// @public +export interface AssetEndpointProfileUpdate { + properties?: AssetEndpointProfileUpdateProperties; + tags?: Record; +} + +// @public +export interface AssetEndpointProfileUpdateProperties { + additionalConfiguration?: string; + authentication?: Authentication; + endpointProfileType?: string; + targetAddress?: string; +} + +// @public +export interface AssetProperties { + assetEndpointProfileRef: string; + attributes?: Record; + datasets?: Dataset[]; + defaultDatasetsConfiguration?: string; + defaultEventsConfiguration?: string; + defaultTopic?: Topic; + description?: string; + discoveredAssetRefs?: string[]; + displayName?: string; + documentationUri?: string; + enabled?: boolean; + events?: Event_2[]; + externalAssetId?: string; + hardwareRevision?: string; + manufacturer?: string; + manufacturerUri?: string; + model?: string; + productCode?: string; + readonly provisioningState?: ProvisioningState; + serialNumber?: string; + softwareRevision?: string; + readonly status?: AssetStatus; + readonly uuid?: string; + readonly version?: number; +} + +// @public +export interface AssetStatus { + readonly datasets?: AssetStatusDataset[]; + readonly errors?: AssetStatusError[]; + readonly events?: AssetStatusEvent[]; + readonly version?: number; +} + +// @public +export interface AssetStatusDataset { + readonly messageSchemaReference?: MessageSchemaReference; + readonly name: string; +} + +// @public +export interface AssetStatusError { + readonly code?: number; + readonly message?: string; +} + +// @public +export interface AssetStatusEvent { + readonly messageSchemaReference?: MessageSchemaReference; + readonly name: string; +} + +// @public +export interface AssetUpdate { + properties?: AssetUpdateProperties; + tags?: Record; +} + +// @public +export interface AssetUpdateProperties { + attributes?: Record; + datasets?: Dataset[]; + defaultDatasetsConfiguration?: string; + defaultEventsConfiguration?: string; + defaultTopic?: Topic; + description?: string; + displayName?: string; + documentationUri?: string; + enabled?: boolean; + events?: Event_2[]; + hardwareRevision?: string; + manufacturer?: string; + manufacturerUri?: string; + model?: string; + productCode?: string; + serialNumber?: string; + softwareRevision?: string; +} + +// @public +export interface Authentication { + method: AuthenticationMethod; + usernamePasswordCredentials?: UsernamePasswordCredentials; + x509Credentials?: X509Credentials; +} + +// @public +export type AuthenticationMethod = string; + +// @public +export interface BillingContainer extends ProxyResource { + readonly etag?: string; + properties?: BillingContainerProperties; +} + +// @public +export interface BillingContainerProperties { + readonly provisioningState?: ProvisioningState; +} + +// @public +export type CreatedByType = string; + +// @public +export interface DataPoint extends DataPointBase { + observabilityMode?: DataPointObservabilityMode; +} + +// @public +export interface DataPointBase { + dataPointConfiguration?: string; + dataSource: string; + name: string; +} + +// @public +export type DataPointObservabilityMode = string; + +// @public +export interface Dataset { + dataPoints?: DataPoint[]; + datasetConfiguration?: string; + name: string; + topic?: Topic; +} + +// @public +export interface DiscoveredAsset extends TrackedResource { + extendedLocation: ExtendedLocation; + properties?: DiscoveredAssetProperties; +} + +// @public +export interface DiscoveredAssetEndpointProfile extends TrackedResource { + extendedLocation: ExtendedLocation; + properties?: DiscoveredAssetEndpointProfileProperties; +} + +// @public +export interface DiscoveredAssetEndpointProfileProperties { + additionalConfiguration?: string; + discoveryId: string; + endpointProfileType: string; + readonly provisioningState?: ProvisioningState; + supportedAuthenticationMethods?: AuthenticationMethod[]; + targetAddress: string; + version: number; +} + +// @public +export interface DiscoveredAssetEndpointProfileUpdate { + properties?: DiscoveredAssetEndpointProfileUpdateProperties; + tags?: Record; +} + +// @public +export interface DiscoveredAssetEndpointProfileUpdateProperties { + additionalConfiguration?: string; + discoveryId?: string; + endpointProfileType?: string; + supportedAuthenticationMethods?: AuthenticationMethod[]; + targetAddress?: string; + version?: number; +} + +// @public +export interface DiscoveredAssetProperties { + assetEndpointProfileRef: string; + datasets?: DiscoveredDataset[]; + defaultDatasetsConfiguration?: string; + defaultEventsConfiguration?: string; + defaultTopic?: Topic; + discoveryId: string; + documentationUri?: string; + events?: DiscoveredEvent[]; + hardwareRevision?: string; + manufacturer?: string; + manufacturerUri?: string; + model?: string; + productCode?: string; + readonly provisioningState?: ProvisioningState; + serialNumber?: string; + softwareRevision?: string; + version: number; +} + +// @public +export interface DiscoveredAssetUpdate { + properties?: DiscoveredAssetUpdateProperties; + tags?: Record; +} + +// @public +export interface DiscoveredAssetUpdateProperties { + datasets?: DiscoveredDataset[]; + defaultDatasetsConfiguration?: string; + defaultEventsConfiguration?: string; + defaultTopic?: Topic; + discoveryId?: string; + documentationUri?: string; + events?: DiscoveredEvent[]; + hardwareRevision?: string; + manufacturer?: string; + manufacturerUri?: string; + model?: string; + productCode?: string; + serialNumber?: string; + softwareRevision?: string; + version?: number; +} + +// @public +export interface DiscoveredDataPoint { + dataPointConfiguration?: string; + dataSource: string; + lastUpdatedOn?: Date; + name: string; +} + +// @public +export interface DiscoveredDataset { + dataPoints?: DiscoveredDataPoint[]; + datasetConfiguration?: string; + name: string; + topic?: Topic; +} + +// @public +export interface DiscoveredEvent { + eventConfiguration?: string; + eventNotifier: string; + lastUpdatedOn?: Date; + name: string; + topic?: Topic; +} + +// @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 +interface Event_2 extends EventBase { + observabilityMode?: EventObservabilityMode; +} +export { Event_2 as Event } + +// @public +export interface EventBase { + eventConfiguration?: string; + eventNotifier: string; + name: string; + topic?: Topic; +} + +// @public +export type EventObservabilityMode = string; + +// @public +export interface ExtendedLocation { + name: string; + type: string; +} + +// @public +export type Format = string; + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownAuthenticationMethod { + Anonymous = "Anonymous", + Certificate = "Certificate", + UsernamePassword = "UsernamePassword" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownDataPointObservabilityMode { + Counter = "Counter", + Gauge = "Gauge", + Histogram = "Histogram", + Log = "Log", + None = "None" +} + +// @public +export enum KnownEventObservabilityMode { + Log = "Log", + None = "None" +} + +// @public +export enum KnownFormat { + Delta_1_0 = "Delta/1.0", + JsonSchemaDraft7 = "JsonSchema/draft-07" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownProvisioningState { + Accepted = "Accepted", + Canceled = "Canceled", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded" +} + +// @public +export enum KnownSchemaType { + MessageSchema = "MessageSchema" +} + +// @public +export enum KnownSystemAssignedServiceIdentityType { + None = "None", + SystemAssigned = "SystemAssigned" +} + +// @public +export enum KnownTopicRetainType { + Keep = "Keep", + Never = "Never" +} + +// @public +export enum KnownVersions { + V2023_11_01_Preview = "2023-11-01-preview", + V2024_09_01_Preview = "2024-09-01-preview" +} + +// @public +export interface MessageSchemaReference { + readonly schemaName: string; + readonly schemaRegistryNamespace: string; + readonly schemaVersion: string; +} + +// @public +export interface Operation { + actionType?: ActionType; + readonly 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 interface OperationStatusResult { + endTime?: Date; + error?: ErrorDetail; + id?: string; + name?: string; + operations?: OperationStatusResult[]; + percentComplete?: number; + startTime?: Date; + status: string; +} + +// @public +export type Origin = string; + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface Schema extends ProxyResource { + properties?: SchemaProperties; +} + +// @public +export interface SchemaProperties { + description?: string; + displayName?: string; + format: Format; + readonly provisioningState?: ProvisioningState; + schemaType: SchemaType; + tags?: Record; + readonly uuid?: string; +} + +// @public +export interface SchemaRegistry extends TrackedResource { + identity?: SystemAssignedServiceIdentity; + properties?: SchemaRegistryProperties; +} + +// @public +export interface SchemaRegistryProperties { + description?: string; + displayName?: string; + namespace: string; + readonly provisioningState?: ProvisioningState; + storageAccountContainerUrl: string; + readonly uuid?: string; +} + +// @public +export interface SchemaRegistryUpdate { + identity?: SystemAssignedServiceIdentity; + properties?: SchemaRegistryUpdateProperties; + tags?: Record; +} + +// @public +export interface SchemaRegistryUpdateProperties { + description?: string; + displayName?: string; +} + +// @public +export type SchemaType = string; + +// @public +export interface SchemaVersion extends ProxyResource { + properties?: SchemaVersionProperties; +} + +// @public +export interface SchemaVersionProperties { + description?: string; + readonly hash?: string; + readonly provisioningState?: ProvisioningState; + schemaContent: string; + readonly uuid?: string; +} + +// @public +export interface SystemAssignedServiceIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type: SystemAssignedServiceIdentityType; +} + +// @public +export type SystemAssignedServiceIdentityType = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface Topic { + path: string; + retain?: TopicRetainType; +} + +// @public +export type TopicRetainType = string; + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @public +export interface UsernamePasswordCredentials { + passwordSecretName: string; + usernameSecretName: string; +} + +// @public +export interface X509Credentials { + certificateSecretName: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/deviceregistry/arm-deviceregistry/review/arm-deviceregistry.api.md b/sdk/deviceregistry/arm-deviceregistry/review/arm-deviceregistry.api.md index 5d9d5b6b4e9b..8c452d271d93 100644 --- a/sdk/deviceregistry/arm-deviceregistry/review/arm-deviceregistry.api.md +++ b/sdk/deviceregistry/arm-deviceregistry/review/arm-deviceregistry.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; @@ -25,344 +28,472 @@ export interface AssetEndpointProfile extends TrackedResource { properties?: AssetEndpointProfileProperties; } -// @public -export interface AssetEndpointProfileListResult { - nextLink?: string; - value: AssetEndpointProfile[]; -} - // @public export interface AssetEndpointProfileProperties { additionalConfiguration?: string; + authentication?: Authentication; + discoveredAssetEndpointProfileRef?: string; + endpointProfileType: string; readonly provisioningState?: ProvisioningState; + readonly status?: AssetEndpointProfileStatus; targetAddress: string; - transportAuthentication?: TransportAuthentication; - userAuthentication?: UserAuthentication; readonly uuid?: string; } // @public -export interface AssetEndpointProfiles { - beginCreateOrReplace(resourceGroupName: string, assetEndpointProfileName: string, resource: AssetEndpointProfile, options?: AssetEndpointProfilesCreateOrReplaceOptionalParams): Promise, AssetEndpointProfilesCreateOrReplaceResponse>>; - beginCreateOrReplaceAndWait(resourceGroupName: string, assetEndpointProfileName: string, resource: AssetEndpointProfile, options?: AssetEndpointProfilesCreateOrReplaceOptionalParams): Promise; - beginDelete(resourceGroupName: string, assetEndpointProfileName: string, options?: AssetEndpointProfilesDeleteOptionalParams): Promise, AssetEndpointProfilesDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, assetEndpointProfileName: string, options?: AssetEndpointProfilesDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, assetEndpointProfileName: string, properties: AssetEndpointProfileUpdate, options?: AssetEndpointProfilesUpdateOptionalParams): Promise, AssetEndpointProfilesUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, assetEndpointProfileName: string, properties: AssetEndpointProfileUpdate, options?: AssetEndpointProfilesUpdateOptionalParams): Promise; - get(resourceGroupName: string, assetEndpointProfileName: string, options?: AssetEndpointProfilesGetOptionalParams): Promise; - listByResourceGroup(resourceGroupName: string, options?: AssetEndpointProfilesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; - listBySubscription(options?: AssetEndpointProfilesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; +export interface AssetEndpointProfilesCreateOrReplaceOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface AssetEndpointProfilesCreateOrReplaceHeaders { - retryAfter?: number; +export interface AssetEndpointProfilesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface AssetEndpointProfilesCreateOrReplaceOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; +export interface AssetEndpointProfilesGetOptionalParams extends OperationOptions { } // @public -export type AssetEndpointProfilesCreateOrReplaceResponse = AssetEndpointProfile; +export interface AssetEndpointProfilesListByResourceGroupOptionalParams extends OperationOptions { +} // @public -export interface AssetEndpointProfilesDeleteHeaders { - location?: string; - retryAfter?: number; +export interface AssetEndpointProfilesListBySubscriptionOptionalParams extends OperationOptions { } // @public -export interface AssetEndpointProfilesDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; +export interface AssetEndpointProfilesOperations { + createOrReplace: (resourceGroupName: string, assetEndpointProfileName: string, resource: AssetEndpointProfile, options?: AssetEndpointProfilesCreateOrReplaceOptionalParams) => PollerLike, AssetEndpointProfile>; + delete: (resourceGroupName: string, assetEndpointProfileName: string, options?: AssetEndpointProfilesDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, assetEndpointProfileName: string, options?: AssetEndpointProfilesGetOptionalParams) => Promise; + listByResourceGroup: (resourceGroupName: string, options?: AssetEndpointProfilesListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listBySubscription: (options?: AssetEndpointProfilesListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, assetEndpointProfileName: string, properties: AssetEndpointProfileUpdate, options?: AssetEndpointProfilesUpdateOptionalParams) => PollerLike, AssetEndpointProfile>; } // @public -export type AssetEndpointProfilesDeleteResponse = AssetEndpointProfilesDeleteHeaders; +export interface AssetEndpointProfileStatus { + readonly errors?: AssetEndpointProfileStatusError[]; +} // @public -export interface AssetEndpointProfilesGetOptionalParams extends coreClient.OperationOptions { +export interface AssetEndpointProfileStatusError { + readonly code?: number; + readonly message?: string; } // @public -export type AssetEndpointProfilesGetResponse = AssetEndpointProfile; +export interface AssetEndpointProfilesUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} // @public -export interface AssetEndpointProfilesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +export interface AssetEndpointProfileUpdate { + properties?: AssetEndpointProfileUpdateProperties; + tags?: Record; } // @public -export type AssetEndpointProfilesListByResourceGroupNextResponse = AssetEndpointProfileListResult; +export interface AssetEndpointProfileUpdateProperties { + additionalConfiguration?: string; + authentication?: Authentication; + endpointProfileType?: string; + targetAddress?: string; +} // @public -export interface AssetEndpointProfilesListByResourceGroupOptionalParams extends coreClient.OperationOptions { +export interface AssetProperties { + assetEndpointProfileRef: string; + attributes?: Record; + datasets?: Dataset[]; + defaultDatasetsConfiguration?: string; + defaultEventsConfiguration?: string; + defaultTopic?: Topic; + description?: string; + discoveredAssetRefs?: string[]; + displayName?: string; + documentationUri?: string; + enabled?: boolean; + events?: Event_2[]; + externalAssetId?: string; + hardwareRevision?: string; + manufacturer?: string; + manufacturerUri?: string; + model?: string; + productCode?: string; + readonly provisioningState?: ProvisioningState; + serialNumber?: string; + softwareRevision?: string; + readonly status?: AssetStatus; + readonly uuid?: string; + readonly version?: number; } // @public -export type AssetEndpointProfilesListByResourceGroupResponse = AssetEndpointProfileListResult; +export interface AssetsCreateOrReplaceOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} // @public -export interface AssetEndpointProfilesListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +export interface AssetsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export type AssetEndpointProfilesListBySubscriptionNextResponse = AssetEndpointProfileListResult; +export interface AssetsGetOptionalParams extends OperationOptions { +} // @public -export interface AssetEndpointProfilesListBySubscriptionOptionalParams extends coreClient.OperationOptions { +export interface AssetsListByResourceGroupOptionalParams extends OperationOptions { } // @public -export type AssetEndpointProfilesListBySubscriptionResponse = AssetEndpointProfileListResult; +export interface AssetsListBySubscriptionOptionalParams extends OperationOptions { +} // @public -export interface AssetEndpointProfilesUpdateHeaders { - location?: string; - retryAfter?: number; +export interface AssetsOperations { + createOrReplace: (resourceGroupName: string, assetName: string, resource: Asset, options?: AssetsCreateOrReplaceOptionalParams) => PollerLike, Asset>; + delete: (resourceGroupName: string, assetName: string, options?: AssetsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, assetName: string, options?: AssetsGetOptionalParams) => Promise; + listByResourceGroup: (resourceGroupName: string, options?: AssetsListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listBySubscription: (options?: AssetsListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, assetName: string, properties: AssetUpdate, options?: AssetsUpdateOptionalParams) => PollerLike, Asset>; } // @public -export interface AssetEndpointProfilesUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; +export interface AssetStatus { + readonly datasets?: AssetStatusDataset[]; + readonly errors?: AssetStatusError[]; + readonly events?: AssetStatusEvent[]; + readonly version?: number; } // @public -export type AssetEndpointProfilesUpdateResponse = AssetEndpointProfile; +export interface AssetStatusDataset { + readonly messageSchemaReference?: MessageSchemaReference; + readonly name: string; +} // @public -export interface AssetEndpointProfileUpdate { - properties?: AssetEndpointProfileUpdateProperties; - tags?: { - [propertyName: string]: string; - }; +export interface AssetStatusError { + readonly code?: number; + readonly message?: string; } // @public -export interface AssetEndpointProfileUpdateProperties { - additionalConfiguration?: string; - targetAddress?: string; - transportAuthentication?: TransportAuthenticationUpdate; - userAuthentication?: UserAuthenticationUpdate; +export interface AssetStatusEvent { + readonly messageSchemaReference?: MessageSchemaReference; + readonly name: string; } // @public -export interface AssetListResult { - nextLink?: string; - value: Asset[]; +export interface AssetsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface AssetProperties { - assetEndpointProfileUri: string; - assetType?: string; - attributes?: { - [propertyName: string]: any; - }; - dataPoints?: DataPoint[]; - defaultDataPointsConfiguration?: string; +export interface AssetUpdate { + properties?: AssetUpdateProperties; + tags?: Record; +} + +// @public +export interface AssetUpdateProperties { + attributes?: Record; + datasets?: Dataset[]; + defaultDatasetsConfiguration?: string; defaultEventsConfiguration?: string; + defaultTopic?: Topic; description?: string; displayName?: string; documentationUri?: string; enabled?: boolean; events?: Event_2[]; - externalAssetId?: string; hardwareRevision?: string; manufacturer?: string; manufacturerUri?: string; model?: string; productCode?: string; - readonly provisioningState?: ProvisioningState; serialNumber?: string; softwareRevision?: string; - readonly status?: AssetStatus; - readonly uuid?: string; - readonly version?: number; } // @public -export interface Assets { - beginCreateOrReplace(resourceGroupName: string, assetName: string, resource: Asset, options?: AssetsCreateOrReplaceOptionalParams): Promise, AssetsCreateOrReplaceResponse>>; - beginCreateOrReplaceAndWait(resourceGroupName: string, assetName: string, resource: Asset, options?: AssetsCreateOrReplaceOptionalParams): Promise; - beginDelete(resourceGroupName: string, assetName: string, options?: AssetsDeleteOptionalParams): Promise, AssetsDeleteResponse>>; - beginDeleteAndWait(resourceGroupName: string, assetName: string, options?: AssetsDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, assetName: string, properties: AssetUpdate, options?: AssetsUpdateOptionalParams): Promise, AssetsUpdateResponse>>; - beginUpdateAndWait(resourceGroupName: string, assetName: string, properties: AssetUpdate, options?: AssetsUpdateOptionalParams): Promise; - get(resourceGroupName: string, assetName: string, options?: AssetsGetOptionalParams): Promise; - listByResourceGroup(resourceGroupName: string, options?: AssetsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; - listBySubscription(options?: AssetsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; +export interface Authentication { + method: AuthenticationMethod; + usernamePasswordCredentials?: UsernamePasswordCredentials; + x509Credentials?: X509Credentials; } // @public -export interface AssetsCreateOrReplaceHeaders { - retryAfter?: number; +export type AuthenticationMethod = string; + +// @public +export interface BillingContainer extends ProxyResource { + readonly etag?: string; + properties?: BillingContainerProperties; } // @public -export interface AssetsCreateOrReplaceOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; +export interface BillingContainerProperties { + readonly provisioningState?: ProvisioningState; } // @public -export type AssetsCreateOrReplaceResponse = Asset; +export interface BillingContainersGetOptionalParams extends OperationOptions { +} // @public -export interface AssetsDeleteHeaders { - location?: string; - retryAfter?: number; +export interface BillingContainersListBySubscriptionOptionalParams extends OperationOptions { } // @public -export interface AssetsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; +export interface BillingContainersOperations { + get: (billingContainerName: string, options?: BillingContainersGetOptionalParams) => Promise; + listBySubscription: (options?: BillingContainersListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; } // @public -export type AssetsDeleteResponse = AssetsDeleteHeaders; +export type ContinuablePage = TPage & { + continuationToken?: string; +}; // @public -export interface AssetsGetOptionalParams extends coreClient.OperationOptions { -} +export type CreatedByType = string; // @public -export type AssetsGetResponse = Asset; +export interface DataPoint extends DataPointBase { + observabilityMode?: DataPointObservabilityMode; +} // @public -export interface AssetsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +export interface DataPointBase { + dataPointConfiguration?: string; + dataSource: string; + name: string; } // @public -export type AssetsListByResourceGroupNextResponse = AssetListResult; +export type DataPointObservabilityMode = string; // @public -export interface AssetsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +export interface Dataset { + dataPoints?: DataPoint[]; + datasetConfiguration?: string; + name: string; + topic?: Topic; +} + +// @public (undocumented) +export class DeviceRegistryManagementClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: DeviceRegistryManagementClientOptionalParams); + readonly assetEndpointProfiles: AssetEndpointProfilesOperations; + readonly assets: AssetsOperations; + readonly billingContainers: BillingContainersOperations; + readonly discoveredAssetEndpointProfiles: DiscoveredAssetEndpointProfilesOperations; + readonly discoveredAssets: DiscoveredAssetsOperations; + readonly operations: OperationsOperations; + readonly operationStatus: OperationStatusOperations; + readonly pipeline: Pipeline; + readonly schemaRegistries: SchemaRegistriesOperations; + readonly schemas: SchemasOperations; + readonly schemaVersions: SchemaVersionsOperations; +} + +// @public +export interface DeviceRegistryManagementClientOptionalParams extends ClientOptions { + apiVersion?: string; } // @public -export type AssetsListByResourceGroupResponse = AssetListResult; +export interface DiscoveredAsset extends TrackedResource { + extendedLocation: ExtendedLocation; + properties?: DiscoveredAssetProperties; +} // @public -export interface AssetsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +export interface DiscoveredAssetEndpointProfile extends TrackedResource { + extendedLocation: ExtendedLocation; + properties?: DiscoveredAssetEndpointProfileProperties; } // @public -export type AssetsListBySubscriptionNextResponse = AssetListResult; +export interface DiscoveredAssetEndpointProfileProperties { + additionalConfiguration?: string; + discoveryId: string; + endpointProfileType: string; + readonly provisioningState?: ProvisioningState; + supportedAuthenticationMethods?: AuthenticationMethod[]; + targetAddress: string; + version: number; +} // @public -export interface AssetsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +export interface DiscoveredAssetEndpointProfilesCreateOrReplaceOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export type AssetsListBySubscriptionResponse = AssetListResult; +export interface DiscoveredAssetEndpointProfilesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} // @public -export interface AssetStatus { - errors?: AssetStatusError[]; - version?: number; +export interface DiscoveredAssetEndpointProfilesGetOptionalParams extends OperationOptions { } // @public -export interface AssetStatusError { - code?: number; - message?: string; +export interface DiscoveredAssetEndpointProfilesListByResourceGroupOptionalParams extends OperationOptions { } // @public -export interface AssetsUpdateHeaders { - location?: string; - retryAfter?: number; +export interface DiscoveredAssetEndpointProfilesListBySubscriptionOptionalParams extends OperationOptions { } // @public -export interface AssetsUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; +export interface DiscoveredAssetEndpointProfilesOperations { + createOrReplace: (resourceGroupName: string, discoveredAssetEndpointProfileName: string, resource: DiscoveredAssetEndpointProfile, options?: DiscoveredAssetEndpointProfilesCreateOrReplaceOptionalParams) => PollerLike, DiscoveredAssetEndpointProfile>; + delete: (resourceGroupName: string, discoveredAssetEndpointProfileName: string, options?: DiscoveredAssetEndpointProfilesDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, discoveredAssetEndpointProfileName: string, options?: DiscoveredAssetEndpointProfilesGetOptionalParams) => Promise; + listByResourceGroup: (resourceGroupName: string, options?: DiscoveredAssetEndpointProfilesListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listBySubscription: (options?: DiscoveredAssetEndpointProfilesListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, discoveredAssetEndpointProfileName: string, properties: DiscoveredAssetEndpointProfileUpdate, options?: DiscoveredAssetEndpointProfilesUpdateOptionalParams) => PollerLike, DiscoveredAssetEndpointProfile>; +} + +// @public +export interface DiscoveredAssetEndpointProfilesUpdateOptionalParams extends OperationOptions { updateIntervalInMs?: number; } // @public -export type AssetsUpdateResponse = Asset; +export interface DiscoveredAssetEndpointProfileUpdate { + properties?: DiscoveredAssetEndpointProfileUpdateProperties; + tags?: Record; +} // @public -export interface AssetUpdate { - properties?: AssetUpdateProperties; - tags?: { - [propertyName: string]: string; - }; +export interface DiscoveredAssetEndpointProfileUpdateProperties { + additionalConfiguration?: string; + discoveryId?: string; + endpointProfileType?: string; + supportedAuthenticationMethods?: AuthenticationMethod[]; + targetAddress?: string; + version?: number; } // @public -export interface AssetUpdateProperties { - assetType?: string; - attributes?: { - [propertyName: string]: any; - }; - dataPoints?: DataPoint[]; - defaultDataPointsConfiguration?: string; +export interface DiscoveredAssetProperties { + assetEndpointProfileRef: string; + datasets?: DiscoveredDataset[]; + defaultDatasetsConfiguration?: string; defaultEventsConfiguration?: string; - description?: string; - displayName?: string; + defaultTopic?: Topic; + discoveryId: string; documentationUri?: string; - enabled?: boolean; - events?: Event_2[]; + events?: DiscoveredEvent[]; hardwareRevision?: string; manufacturer?: string; manufacturerUri?: string; model?: string; productCode?: string; + readonly provisioningState?: ProvisioningState; serialNumber?: string; softwareRevision?: string; + version: number; } // @public -export type CreatedByType = string; +export interface DiscoveredAssetsCreateOrReplaceOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} // @public -export interface DataPoint { - capabilityId?: string; +export interface DiscoveredAssetsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiscoveredAssetsGetOptionalParams extends OperationOptions { +} + +// @public +export interface DiscoveredAssetsListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface DiscoveredAssetsListBySubscriptionOptionalParams extends OperationOptions { +} + +// @public +export interface DiscoveredAssetsOperations { + createOrReplace: (resourceGroupName: string, discoveredAssetName: string, resource: DiscoveredAsset, options?: DiscoveredAssetsCreateOrReplaceOptionalParams) => PollerLike, DiscoveredAsset>; + delete: (resourceGroupName: string, discoveredAssetName: string, options?: DiscoveredAssetsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, discoveredAssetName: string, options?: DiscoveredAssetsGetOptionalParams) => Promise; + listByResourceGroup: (resourceGroupName: string, options?: DiscoveredAssetsListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listBySubscription: (options?: DiscoveredAssetsListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, discoveredAssetName: string, properties: DiscoveredAssetUpdate, options?: DiscoveredAssetsUpdateOptionalParams) => PollerLike, DiscoveredAsset>; +} + +// @public +export interface DiscoveredAssetsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiscoveredAssetUpdate { + properties?: DiscoveredAssetUpdateProperties; + tags?: Record; +} + +// @public +export interface DiscoveredAssetUpdateProperties { + datasets?: DiscoveredDataset[]; + defaultDatasetsConfiguration?: string; + defaultEventsConfiguration?: string; + defaultTopic?: Topic; + discoveryId?: string; + documentationUri?: string; + events?: DiscoveredEvent[]; + hardwareRevision?: string; + manufacturer?: string; + manufacturerUri?: string; + model?: string; + productCode?: string; + serialNumber?: string; + softwareRevision?: string; + version?: number; +} + +// @public +export interface DiscoveredDataPoint { dataPointConfiguration?: string; dataSource: string; - name?: string; - observabilityMode?: DataPointsObservabilityMode; + lastUpdatedOn?: Date; + name: string; } // @public -export type DataPointsObservabilityMode = string; +export interface DiscoveredDataset { + dataPoints?: DiscoveredDataPoint[]; + datasetConfiguration?: string; + name: string; + topic?: Topic; +} -// @public (undocumented) -export class DeviceRegistryManagementClient extends coreClient.ServiceClient { - // (undocumented) - $host: string; - constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: DeviceRegistryManagementClientOptionalParams); - // (undocumented) - apiVersion: string; - // (undocumented) - assetEndpointProfiles: AssetEndpointProfiles; - // (undocumented) - assets: Assets; - // (undocumented) - operations: Operations; - // (undocumented) - operationStatus: OperationStatus; - // (undocumented) - subscriptionId: string; -} - -// @public -export interface DeviceRegistryManagementClientOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; - apiVersion?: string; - endpoint?: string; +// @public +export interface DiscoveredEvent { + eventConfiguration?: string; + eventNotifier: string; + lastUpdatedOn?: Date; + name: string; + topic?: Topic; } // @public export interface ErrorAdditionalInfo { - readonly info?: Record; + readonly info?: Record; readonly type?: string; } @@ -376,22 +507,21 @@ export interface ErrorDetail { } // @public -export interface ErrorResponse { - error?: ErrorDetail; +interface Event_2 extends EventBase { + observabilityMode?: EventObservabilityMode; } +export { Event_2 as Event } // @public -interface Event_2 { - capabilityId?: string; +export interface EventBase { eventConfiguration?: string; eventNotifier: string; - name?: string; - observabilityMode?: EventsObservabilityMode; + name: string; + topic?: Topic; } -export { Event_2 as Event } // @public -export type EventsObservabilityMode = string; +export type EventObservabilityMode = string; // @public export interface ExtendedLocation { @@ -400,13 +530,20 @@ export interface ExtendedLocation { } // @public -export function getContinuationToken(page: unknown): string | undefined; +export type Format = string; // @public export enum KnownActionType { Internal = "Internal" } +// @public +export enum KnownAuthenticationMethod { + Anonymous = "Anonymous", + Certificate = "Certificate", + UsernamePassword = "UsernamePassword" +} + // @public export enum KnownCreatedByType { Application = "Application", @@ -416,18 +553,24 @@ export enum KnownCreatedByType { } // @public -export enum KnownDataPointsObservabilityMode { - Counter = "counter", - Gauge = "gauge", - Histogram = "histogram", - Log = "log", - None = "none" +export enum KnownDataPointObservabilityMode { + Counter = "Counter", + Gauge = "Gauge", + Histogram = "Histogram", + Log = "Log", + None = "None" +} + +// @public +export enum KnownEventObservabilityMode { + Log = "Log", + None = "None" } // @public -export enum KnownEventsObservabilityMode { - Log = "log", - None = "none" +export enum KnownFormat { + Delta_1_0 = "Delta/1.0", + JsonSchemaDraft7 = "JsonSchema/draft-07" } // @public @@ -441,70 +584,75 @@ export enum KnownOrigin { export enum KnownProvisioningState { Accepted = "Accepted", Canceled = "Canceled", + Deleting = "Deleting", Failed = "Failed", Succeeded = "Succeeded" } // @public -export enum KnownUserAuthenticationMode { - Anonymous = "Anonymous", - Certificate = "Certificate", - UsernamePassword = "UsernamePassword" +export enum KnownSchemaType { + MessageSchema = "MessageSchema" } // @public -export interface Operation { - readonly actionType?: ActionType; - display?: OperationDisplay; - readonly isDataAction?: boolean; - readonly name?: string; - readonly origin?: Origin; +export enum KnownSystemAssignedServiceIdentityType { + None = "None", + SystemAssigned = "SystemAssigned" } // @public -export interface OperationDisplay { - readonly description?: string; - readonly operation?: string; - readonly provider?: string; - readonly resource?: string; +export enum KnownTopicRetainType { + Keep = "Keep", + Never = "Never" } // @public -export interface OperationListResult { - readonly nextLink?: string; - readonly value?: Operation[]; +export enum KnownVersions { + V2023_11_01_Preview = "2023-11-01-preview", + V2024_09_01_Preview = "2024-09-01-preview" } // @public -export interface Operations { - list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +export interface MessageSchemaReference { + readonly schemaName: string; + readonly schemaRegistryNamespace: string; + readonly schemaVersion: string; } // @public -export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +export interface Operation { + actionType?: ActionType; + readonly display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; } // @public -export type OperationsListNextResponse = OperationListResult; - -// @public -export interface OperationsListOptionalParams extends coreClient.OperationOptions { +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; } // @public -export type OperationsListResponse = OperationListResult; +export interface OperationsListOptionalParams extends OperationOptions { +} // @public -export interface OperationStatus { - get(location: string, operationId: string, options?: OperationStatusGetOptionalParams): Promise; +export interface OperationsOperations { + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; } // @public -export interface OperationStatusGetOptionalParams extends coreClient.OperationOptions { +export interface OperationStatusGetOptionalParams extends OperationOptions { } // @public -export type OperationStatusGetResponse = OperationStatusResult; +export interface OperationStatusOperations { + get: (location: string, operationId: string, options?: OperationStatusGetOptionalParams) => Promise; +} // @public export interface OperationStatusResult { @@ -522,15 +670,24 @@ export interface OperationStatusResult { export type Origin = string; // @public -export interface OwnCertificate { - certPasswordReference?: string; - certSecretReference?: string; - certThumbprint?: string; +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} + +// @public +export interface PageSettings { + continuationToken?: string; } // @public export type ProvisioningState = string; +// @public +export interface ProxyResource extends Resource { +} + // @public export interface Resource { readonly id?: string; @@ -540,70 +697,206 @@ export interface Resource { } // @public -export interface SystemData { - createdAt?: Date; - createdBy?: string; - createdByType?: CreatedByType; - lastModifiedAt?: Date; - lastModifiedBy?: string; - lastModifiedByType?: CreatedByType; +export function restorePoller(client: DeviceRegistryManagementClient, 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 TrackedResource extends Resource { - location: string; - tags?: { - [propertyName: string]: string; - }; +export interface Schema extends ProxyResource { + properties?: SchemaProperties; +} + +// @public +export interface SchemaProperties { + description?: string; + displayName?: string; + format: Format; + readonly provisioningState?: ProvisioningState; + schemaType: SchemaType; + tags?: Record; + readonly uuid?: string; } // @public -export interface TransportAuthentication { - ownCertificates: OwnCertificate[]; +export interface SchemaRegistriesCreateOrReplaceOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface TransportAuthenticationUpdate { - ownCertificates?: OwnCertificate[]; +export interface SchemaRegistriesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface UserAuthentication { - mode: UserAuthenticationMode; - usernamePasswordCredentials?: UsernamePasswordCredentials; - x509Credentials?: X509Credentials; +export interface SchemaRegistriesGetOptionalParams extends OperationOptions { } // @public -export type UserAuthenticationMode = string; +export interface SchemaRegistriesListByResourceGroupOptionalParams extends OperationOptions { +} // @public -export interface UserAuthenticationUpdate { - mode?: UserAuthenticationMode; - usernamePasswordCredentials?: UsernamePasswordCredentialsUpdate; - x509Credentials?: X509CredentialsUpdate; +export interface SchemaRegistriesListBySubscriptionOptionalParams extends OperationOptions { } // @public -export interface UsernamePasswordCredentials { - passwordReference: string; - usernameReference: string; +export interface SchemaRegistriesOperations { + createOrReplace: (resourceGroupName: string, schemaRegistryName: string, resource: SchemaRegistry, options?: SchemaRegistriesCreateOrReplaceOptionalParams) => PollerLike, SchemaRegistry>; + delete: (resourceGroupName: string, schemaRegistryName: string, options?: SchemaRegistriesDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, schemaRegistryName: string, options?: SchemaRegistriesGetOptionalParams) => Promise; + listByResourceGroup: (resourceGroupName: string, options?: SchemaRegistriesListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listBySubscription: (options?: SchemaRegistriesListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, schemaRegistryName: string, properties: SchemaRegistryUpdate, options?: SchemaRegistriesUpdateOptionalParams) => PollerLike, SchemaRegistry>; } // @public -export interface UsernamePasswordCredentialsUpdate { - passwordReference?: string; - usernameReference?: string; +export interface SchemaRegistriesUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export interface X509Credentials { - certificateReference: string; +export interface SchemaRegistry extends TrackedResource { + identity?: SystemAssignedServiceIdentity; + properties?: SchemaRegistryProperties; } // @public -export interface X509CredentialsUpdate { - certificateReference?: string; +export interface SchemaRegistryProperties { + description?: string; + displayName?: string; + namespace: string; + readonly provisioningState?: ProvisioningState; + storageAccountContainerUrl: string; + readonly uuid?: string; +} + +// @public +export interface SchemaRegistryUpdate { + identity?: SystemAssignedServiceIdentity; + properties?: SchemaRegistryUpdateProperties; + tags?: Record; +} + +// @public +export interface SchemaRegistryUpdateProperties { + description?: string; + displayName?: string; +} + +// @public +export interface SchemasCreateOrReplaceOptionalParams extends OperationOptions { +} + +// @public +export interface SchemasDeleteOptionalParams extends OperationOptions { +} + +// @public +export interface SchemasGetOptionalParams extends OperationOptions { +} + +// @public +export interface SchemasListBySchemaRegistryOptionalParams extends OperationOptions { +} + +// @public +export interface SchemasOperations { + createOrReplace: (resourceGroupName: string, schemaRegistryName: string, schemaName: string, resource: Schema, options?: SchemasCreateOrReplaceOptionalParams) => Promise; + delete: (resourceGroupName: string, schemaRegistryName: string, schemaName: string, options?: SchemasDeleteOptionalParams) => Promise; + get: (resourceGroupName: string, schemaRegistryName: string, schemaName: string, options?: SchemasGetOptionalParams) => Promise; + listBySchemaRegistry: (resourceGroupName: string, schemaRegistryName: string, options?: SchemasListBySchemaRegistryOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export type SchemaType = string; + +// @public +export interface SchemaVersion extends ProxyResource { + properties?: SchemaVersionProperties; +} + +// @public +export interface SchemaVersionProperties { + description?: string; + readonly hash?: string; + readonly provisioningState?: ProvisioningState; + schemaContent: string; + readonly uuid?: string; +} + +// @public +export interface SchemaVersionsCreateOrReplaceOptionalParams extends OperationOptions { +} + +// @public +export interface SchemaVersionsDeleteOptionalParams extends OperationOptions { +} + +// @public +export interface SchemaVersionsGetOptionalParams extends OperationOptions { +} + +// @public +export interface SchemaVersionsListBySchemaOptionalParams extends OperationOptions { +} + +// @public +export interface SchemaVersionsOperations { + createOrReplace: (resourceGroupName: string, schemaRegistryName: string, schemaName: string, schemaVersionName: string, resource: SchemaVersion, options?: SchemaVersionsCreateOrReplaceOptionalParams) => Promise; + delete: (resourceGroupName: string, schemaRegistryName: string, schemaName: string, schemaVersionName: string, options?: SchemaVersionsDeleteOptionalParams) => Promise; + get: (resourceGroupName: string, schemaRegistryName: string, schemaName: string, schemaVersionName: string, options?: SchemaVersionsGetOptionalParams) => Promise; + listBySchema: (resourceGroupName: string, schemaRegistryName: string, schemaName: string, options?: SchemaVersionsListBySchemaOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export interface SystemAssignedServiceIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type: SystemAssignedServiceIdentityType; +} + +// @public +export type SystemAssignedServiceIdentityType = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface Topic { + path: string; + retain?: TopicRetainType; +} + +// @public +export type TopicRetainType = string; + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @public +export interface UsernamePasswordCredentials { + passwordSecretName: string; + usernameSecretName: string; +} + +// @public +export interface X509Credentials { + certificateSecretName: string; } // (No @packageDocumentation comment for this package) diff --git a/sdk/deviceregistry/arm-deviceregistry/sample.env b/sdk/deviceregistry/arm-deviceregistry/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/deviceregistry/arm-deviceregistry/sample.env +++ b/sdk/deviceregistry/arm-deviceregistry/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/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesCreateOrReplaceSample.ts index 1197ba9e9f47..e227fded3b47 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesCreateOrReplaceSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesCreateOrReplaceSample.ts @@ -1,59 +1,73 @@ -/* - * 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 { - AssetEndpointProfile, - DeviceRegistryManagementClient, -} from "@azure/arm-deviceregistry"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to Create a AssetEndpointProfile + * This sample demonstrates how to create a AssetEndpointProfile * - * @summary Create a AssetEndpointProfile - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_AssetEndpointProfile.json + * @summary create a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile.json */ -async function createAnAssetEndpointProfile() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetEndpointProfileName = "my-assetendpointprofile"; - const resource: AssetEndpointProfile = { - extendedLocation: { - name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", - type: "CustomLocation", - }, - location: "West Europe", - properties: { - targetAddress: "https://www.example.com/myTargetAddress", - userAuthentication: { mode: "Anonymous" }, +async function createAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assetEndpointProfiles.createOrReplace( + "myResourceGroup", + "my-assetendpointprofile", + { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + targetAddress: "https://www.example.com/myTargetAddress", + endpointProfileType: "myEndpointProfileType", + authentication: { method: "Anonymous" }, + }, }, - tags: { site: "building-1" }, - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to create a AssetEndpointProfile + * + * @summary create a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile_With_DiscoveredAepRef.json + */ +async function createAssetEndpointProfileWithDiscoveredAepRef() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assetEndpointProfiles.beginCreateOrReplaceAndWait( - resourceGroupName, - assetEndpointProfileName, - resource, + const result = await client.assetEndpointProfiles.createOrReplace( + "myResourceGroup", + "my-assetendpointprofile", + { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + targetAddress: "https://www.example.com/myTargetAddress", + endpointProfileType: "myEndpointProfileType", + discoveredAssetEndpointProfileRef: "discoveredAssetEndpointProfile1", + authentication: { method: "Anonymous" }, + }, + }, ); console.log(result); } async function main() { - createAnAssetEndpointProfile(); + createAssetEndpointProfile(); + createAssetEndpointProfileWithDiscoveredAepRef(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesDeleteSample.ts index 3f2ea9fa342a..ede7746b3e31 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesDeleteSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesDeleteSample.ts @@ -1,43 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to Delete a AssetEndpointProfile + * This sample demonstrates how to delete a AssetEndpointProfile * - * @summary Delete a AssetEndpointProfile - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_AssetEndpointProfile.json + * @summary delete a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Delete_AssetEndpointProfile.json */ -async function deleteAnAssetEndpointProfile() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetEndpointProfileName = "my-assetendpointprofile"; +async function deleteAssetEndpointProfile() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assetEndpointProfiles.beginDeleteAndWait( - resourceGroupName, - assetEndpointProfileName, - ); - console.log(result); + await client.assetEndpointProfiles.delete("myResourceGroup", "my-assetendpointprofile"); } async function main() { - deleteAnAssetEndpointProfile(); + deleteAssetEndpointProfile(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesGetSample.ts index 407685d90fab..9482215dc4c3 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesGetSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesGetSample.ts @@ -1,43 +1,46 @@ -/* - * 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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +/** + * This sample demonstrates how to get a AssetEndpointProfile + * + * @summary get a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile.json + */ +async function getAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assetEndpointProfiles.get( + "myResourceGroup", + "my-assetendpointprofile", + ); + console.log(result); +} /** - * This sample demonstrates how to Get a AssetEndpointProfile + * This sample demonstrates how to get a AssetEndpointProfile * - * @summary Get a AssetEndpointProfile - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json + * @summary get a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile_With_SyncStatus.json */ -async function getAnAssetEndpointProfile() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetEndpointProfileName = "my-assetendpointprofile"; +async function getAssetEndpointProfileWithSyncStatus() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const result = await client.assetEndpointProfiles.get( - resourceGroupName, - assetEndpointProfileName, + "myResourceGroup", + "my-assetendpointprofile", ); console.log(result); } async function main() { - getAnAssetEndpointProfile(); + getAssetEndpointProfile(); + getAssetEndpointProfileWithSyncStatus(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesListByResourceGroupSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesListByResourceGroupSample.ts index 14413102b08f..2230794efd42 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesListByResourceGroupSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesListByResourceGroupSample.ts @@ -1,44 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to List AssetEndpointProfile resources by resource group + * This sample demonstrates how to list AssetEndpointProfile resources by resource group * - * @summary List AssetEndpointProfile resources by resource group - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_ResourceGroup.json + * @summary list AssetEndpointProfile resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_ResourceGroup.json */ -async function listAssetEndpointProfilesInAResourceGroup() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; +async function listAssetEndpointProfilesResourceGroup() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.assetEndpointProfiles.listByResourceGroup( - resourceGroupName, - )) { + for await (let item of client.assetEndpointProfiles.listByResourceGroup("myResourceGroup")) { resArray.push(item); } + console.log(resArray); } async function main() { - listAssetEndpointProfilesInAResourceGroup(); + listAssetEndpointProfilesResourceGroup(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesListBySubscriptionSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesListBySubscriptionSample.ts index 83e5236f301a..00f8a5204e2d 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesListBySubscriptionSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesListBySubscriptionSample.ts @@ -1,40 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to List AssetEndpointProfile resources by subscription ID + * This sample demonstrates how to list AssetEndpointProfile resources by subscription ID * - * @summary List AssetEndpointProfile resources by subscription ID - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_Subscription.json + * @summary list AssetEndpointProfile resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_Subscription.json */ -async function listAssetEndpointProfilesInASubscription() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; +async function listAssetEndpointProfilesSubscription() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); for await (let item of client.assetEndpointProfiles.listBySubscription()) { resArray.push(item); } + console.log(resArray); } async function main() { - listAssetEndpointProfilesInASubscription(); + listAssetEndpointProfilesSubscription(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesUpdateSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesUpdateSample.ts index 409b09e06b37..eac50c7e76c5 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesUpdateSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetEndpointProfilesUpdateSample.ts @@ -1,50 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - AssetEndpointProfileUpdate, - DeviceRegistryManagementClient, -} from "@azure/arm-deviceregistry"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to Update a AssetEndpointProfile + * This sample demonstrates how to update a AssetEndpointProfile * - * @summary Update a AssetEndpointProfile - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json + * @summary update a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Update_AssetEndpointProfile.json */ -async function patchAnAssetEndpointProfile() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetEndpointProfileName = "my-assetendpointprofile"; - const properties: AssetEndpointProfileUpdate = { - properties: { targetAddress: "https://www.example.com/myTargetAddress" }, - }; +async function updateAssetEndpointProfile() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assetEndpointProfiles.beginUpdateAndWait( - resourceGroupName, - assetEndpointProfileName, - properties, + const result = await client.assetEndpointProfiles.update( + "myResourceGroup", + "my-assetendpointprofile", + { + properties: { targetAddress: "https://www.example.com/myTargetAddress" }, + }, ); console.log(result); } async function main() { - patchAnAssetEndpointProfile(); + updateAssetEndpointProfile(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsCreateOrReplaceSample.ts index 407f10ef31a8..92c1be902948 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsCreateOrReplaceSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsCreateOrReplaceSample.ts @@ -1,273 +1,317 @@ -/* - * 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 { - Asset, - DeviceRegistryManagementClient, -} from "@azure/arm-deviceregistry"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to Create a Asset + * This sample demonstrates how to create a Asset * - * @summary Create a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_With_ExternalAssetId.json + * @summary create a Asset + * x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_DisplayName.json */ -async function createAnAssetWithExternalAssetId() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; - const resource: Asset = { +async function createAssetWithoutDisplayName() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assets.createOrReplace("myResourceGroup", "my-asset", { + location: "West Europe", extendedLocation: { - name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", }, - location: "West Europe", + tags: { site: "building-1" }, properties: { + enabled: true, + externalAssetId: "8ZBA6LRHU0A458969", description: "This is a sample Asset", - assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile", - assetType: "MyAssetType", - dataPoints: [ - { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - dataPointConfiguration: - '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", - observabilityMode: "counter", - }, + assetEndpointProfileRef: "myAssetEndpointProfile", + manufacturer: "Contoso", + manufacturerUri: "https://www.contoso.com/manufacturerUri", + model: "ContosoModel", + productCode: "SA34VDG", + hardwareRevision: "1.0", + softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - dataPointConfiguration: - '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", - observabilityMode: "none", + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + observabilityMode: "Counter", + dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + observabilityMode: "None", + dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], }, ], - defaultDataPointsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - defaultEventsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - displayName: "AssetDisplayName", - documentationUri: "https://www.example.com/manual", - enabled: true, events: [ { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - eventConfiguration: - '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + name: "event1", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", - observabilityMode: "none", + observabilityMode: "None", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, }, { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - eventConfiguration: - '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + name: "event2", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", - observabilityMode: "log", + observabilityMode: "Log", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', }, ], - externalAssetId: "8ZBA6LRHU0A458969", - hardwareRevision: "1.0", - manufacturer: "Contoso", - manufacturerUri: "https://www.contoso.com/manufacturerUri", - model: "ContosoModel", - productCode: "SA34VDG", - serialNumber: "64-103816-519918-8", - softwareRevision: "2.0", }, - tags: { site: "building-1" }, - }; - const credential = new DefaultAzureCredential(); - const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginCreateOrReplaceAndWait( - resourceGroupName, - assetName, - resource, - ); + }); console.log(result); } /** - * This sample demonstrates how to Create a Asset + * This sample demonstrates how to create a Asset * - * @summary Create a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_DisplayName.json + * @summary create a Asset + * x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_ExternalAssetId.json */ -async function createAnAssetWithoutDisplayName() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; - const resource: Asset = { +async function createAssetWithoutExternalAssetId() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assets.createOrReplace("myResourceGroup", "my-asset", { + location: "West Europe", extendedLocation: { - name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", }, - location: "West Europe", + tags: { site: "building-1" }, properties: { + enabled: true, + displayName: "AssetDisplayName", description: "This is a sample Asset", - assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile", - assetType: "MyAssetType", - dataPoints: [ - { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - dataPointConfiguration: - '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", - observabilityMode: "counter", - }, + assetEndpointProfileRef: "myAssetEndpointProfile", + manufacturer: "Contoso", + manufacturerUri: "https://www.contoso.com/manufacturerUri", + model: "ContosoModel", + productCode: "SA34VDG", + hardwareRevision: "1.0", + softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - dataPointConfiguration: - '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", - observabilityMode: "none", + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + observabilityMode: "Counter", + dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + observabilityMode: "None", + dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], }, ], - defaultDataPointsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - defaultEventsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - documentationUri: "https://www.example.com/manual", - enabled: true, events: [ { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - eventConfiguration: - '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + name: "event1", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", - observabilityMode: "none", + observabilityMode: "None", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, }, { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - eventConfiguration: - '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + name: "event2", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", - observabilityMode: "log", + observabilityMode: "Log", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', }, ], + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to create a Asset + * + * @summary create a Asset + * x-ms-original-file: 2024-09-01-preview/Create_Asset_With_DiscoveredAssetRef.json + */ +async function createAssetWithDiscoveredAssetRefs() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assets.createOrReplace("myResourceGroup", "my-asset", { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + enabled: true, externalAssetId: "8ZBA6LRHU0A458969", - hardwareRevision: "1.0", + displayName: "AssetDisplayName", + description: "This is a sample Asset", + assetEndpointProfileRef: "myAssetEndpointProfile", manufacturer: "Contoso", manufacturerUri: "https://www.contoso.com/manufacturerUri", model: "ContosoModel", productCode: "SA34VDG", - serialNumber: "64-103816-519918-8", + hardwareRevision: "1.0", softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + discoveredAssetRefs: ["discoveredAsset1", "discoveredAsset2"], + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ + { + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + observabilityMode: "Counter", + dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + observabilityMode: "None", + dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], + }, + ], + events: [ + { + name: "event1", + eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", + observabilityMode: "None", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, + }, + { + name: "event2", + eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", + observabilityMode: "Log", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + }, + ], }, - tags: { site: "building-1" }, - }; - const credential = new DefaultAzureCredential(); - const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginCreateOrReplaceAndWait( - resourceGroupName, - assetName, - resource, - ); + }); console.log(result); } /** - * This sample demonstrates how to Create a Asset + * This sample demonstrates how to create a Asset * - * @summary Create a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_ExternalAssetId.json + * @summary create a Asset + * x-ms-original-file: 2024-09-01-preview/Create_Asset_With_ExternalAssetId.json */ -async function createAnAssetWithoutExternalAssetId() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; - const resource: Asset = { +async function createAssetWithExternalAssetId() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assets.createOrReplace("myResourceGroup", "my-asset", { + location: "West Europe", extendedLocation: { - name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", }, - location: "West Europe", + tags: { site: "building-1" }, properties: { + enabled: true, + externalAssetId: "8ZBA6LRHU0A458969", + displayName: "AssetDisplayName", description: "This is a sample Asset", - assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile", - assetType: "MyAssetType", - dataPoints: [ - { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - dataPointConfiguration: - '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", - observabilityMode: "counter", - }, + assetEndpointProfileRef: "myAssetEndpointProfile", + manufacturer: "Contoso", + manufacturerUri: "https://www.contoso.com/manufacturerUri", + model: "ContosoModel", + productCode: "SA34VDG", + hardwareRevision: "1.0", + softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - dataPointConfiguration: - '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", - observabilityMode: "none", + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + observabilityMode: "Counter", + dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + observabilityMode: "None", + dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], }, ], - defaultDataPointsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - defaultEventsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - displayName: "AssetDisplayName", - documentationUri: "https://www.example.com/manual", - enabled: true, events: [ { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - eventConfiguration: - '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + name: "event1", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", - observabilityMode: "none", + observabilityMode: "None", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, }, { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - eventConfiguration: - '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + name: "event2", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", - observabilityMode: "log", + observabilityMode: "Log", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', }, ], - hardwareRevision: "1.0", - manufacturer: "Contoso", - manufacturerUri: "https://www.contoso.com/manufacturerUri", - model: "ContosoModel", - productCode: "SA34VDG", - serialNumber: "64-103816-519918-8", - softwareRevision: "2.0", }, - tags: { site: "building-1" }, - }; - const credential = new DefaultAzureCredential(); - const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginCreateOrReplaceAndWait( - resourceGroupName, - assetName, - resource, - ); + }); console.log(result); } async function main() { - createAnAssetWithExternalAssetId(); - createAnAssetWithoutDisplayName(); - createAnAssetWithoutExternalAssetId(); + createAssetWithoutDisplayName(); + createAssetWithoutExternalAssetId(); + createAssetWithDiscoveredAssetRefs(); + createAssetWithExternalAssetId(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsDeleteSample.ts index 0d62e48d59bb..f302477cced6 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsDeleteSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsDeleteSample.ts @@ -1,43 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to Delete a Asset + * This sample demonstrates how to delete a Asset * - * @summary Delete a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_Asset.json + * @summary delete a Asset + * x-ms-original-file: 2024-09-01-preview/Delete_Asset.json */ -async function deleteAnAsset() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; +async function deleteAsset() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginDeleteAndWait( - resourceGroupName, - assetName, - ); - console.log(result); + await client.assets.delete("myResourceGroup", "my-asset"); } async function main() { - deleteAnAsset(); + deleteAsset(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsGetSample.ts index c341d40c0391..c685134701e6 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsGetSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsGetSample.ts @@ -1,60 +1,40 @@ -/* - * 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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to Get a Asset + * This sample demonstrates how to get a Asset * - * @summary Get a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json + * @summary get a Asset + * x-ms-original-file: 2024-09-01-preview/Get_Asset.json */ -async function getAnAsset() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; +async function getAsset() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.get(resourceGroupName, assetName); + const result = await client.assets.get("myResourceGroup", "my-asset"); console.log(result); } /** - * This sample demonstrates how to Get a Asset + * This sample demonstrates how to get a Asset * - * @summary Get a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset_With_SyncStatus.json + * @summary get a Asset + * x-ms-original-file: 2024-09-01-preview/Get_Asset_With_SyncStatus.json */ -async function getAnAssetWithSyncStatus() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; +async function getAssetWithSyncStatus() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.get(resourceGroupName, assetName); + const result = await client.assets.get("myResourceGroup", "my-asset"); console.log(result); } async function main() { - getAnAsset(); - getAnAssetWithSyncStatus(); + getAsset(); + getAssetWithSyncStatus(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsListByResourceGroupSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsListByResourceGroupSample.ts index 8d358c701a19..9d566ed9eab1 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsListByResourceGroupSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsListByResourceGroupSample.ts @@ -1,42 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to List Asset resources by resource group + * This sample demonstrates how to list Asset resources by resource group * - * @summary List Asset resources by resource group - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_ResourceGroup.json + * @summary list Asset resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_Assets_ResourceGroup.json */ -async function listAssetsInAResourceGroup() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; +async function listAssetsResourceGroup() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.assets.listByResourceGroup(resourceGroupName)) { + for await (let item of client.assets.listByResourceGroup("myResourceGroup")) { resArray.push(item); } + console.log(resArray); } async function main() { - listAssetsInAResourceGroup(); + listAssetsResourceGroup(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsListBySubscriptionSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsListBySubscriptionSample.ts index 078c4c0cbcf7..75b639ef299e 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsListBySubscriptionSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsListBySubscriptionSample.ts @@ -1,40 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to List Asset resources by subscription ID + * This sample demonstrates how to list Asset resources by subscription ID * - * @summary List Asset resources by subscription ID - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_Subscription.json + * @summary list Asset resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_Assets_Subscription.json */ -async function listAssetsInASubscription() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; +async function listAssetsSubscription() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); for await (let item of client.assets.listBySubscription()) { resArray.push(item); } + console.log(resArray); } async function main() { - listAssetsInASubscription(); + listAssetsSubscription(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsUpdateSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsUpdateSample.ts index 9a752eec406e..4ef904672419 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsUpdateSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/assetsUpdateSample.ts @@ -1,50 +1,27 @@ -/* - * 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 { - AssetUpdate, - DeviceRegistryManagementClient, -} from "@azure/arm-deviceregistry"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to Update a Asset + * This sample demonstrates how to update a Asset * - * @summary Update a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json + * @summary update a Asset + * x-ms-original-file: 2024-09-01-preview/Update_Asset.json */ -async function patchAnAsset() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; - const properties: AssetUpdate = { - properties: { displayName: "NewAssetDisplayName", enabled: false }, - }; +async function updateAsset() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginUpdateAndWait( - resourceGroupName, - assetName, - properties, - ); + const result = await client.assets.update("myResourceGroup", "my-asset", { + properties: { enabled: false, displayName: "NewAssetDisplayName" }, + }); console.log(result); } async function main() { - patchAnAsset(); + updateAsset(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/billingContainersGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/billingContainersGetSample.ts new file mode 100644 index 000000000000..efe39790bb6f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/billingContainersGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a BillingContainer + * + * @summary get a BillingContainer + * x-ms-original-file: 2024-09-01-preview/Get_BillingContainer.json + */ +async function getBillingContainer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.billingContainers.get("my-billingContainer"); + console.log(result); +} + +async function main() { + getBillingContainer(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/billingContainersListBySubscriptionSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/billingContainersListBySubscriptionSample.ts new file mode 100644 index 000000000000..1d4acb1d43d2 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/billingContainersListBySubscriptionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list BillingContainer resources by subscription ID + * + * @summary list BillingContainer resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_BillingContainers_Subscription.json + */ +async function listBillingContainersSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.billingContainers.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listBillingContainersSubscription(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesCreateOrReplaceSample.ts new file mode 100644 index 000000000000..5bbe2710dd6f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesCreateOrReplaceSample.ts @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a DiscoveredAssetEndpointProfile + * + * @summary create a DiscoveredAssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAssetEndpointProfile.json + */ +async function createDiscoveredAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssetEndpointProfiles.createOrReplace( + "myResourceGroup", + "my-discoveredassetendpointprofile", + { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + targetAddress: "https://www.example.com/myTargetAddress", + additionalConfiguration: '{"foo": "bar"}', + discoveryId: "11111111-1111-1111-1111-111111111111", + version: 73766, + endpointProfileType: "myEndpointProfileType", + supportedAuthenticationMethods: ["Anonymous", "Certificate", "UsernamePassword"], + }, + }, + ); + console.log(result); +} + +async function main() { + createDiscoveredAssetEndpointProfile(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesDeleteSample.ts new file mode 100644 index 000000000000..c10a87be60fe --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesDeleteSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a DiscoveredAssetEndpointProfile + * + * @summary delete a DiscoveredAssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAssetEndpointProfile.json + */ +async function deleteDiscoveredAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.discoveredAssetEndpointProfiles.delete( + "myResourceGroup", + "my-discoveredassetendpointprofile", + ); +} + +async function main() { + deleteDiscoveredAssetEndpointProfile(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesGetSample.ts new file mode 100644 index 000000000000..6d661f7023d4 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesGetSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a DiscoveredAssetEndpointProfile + * + * @summary get a DiscoveredAssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAssetEndpointProfile.json + */ +async function getDiscoveredAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssetEndpointProfiles.get( + "myResourceGroup", + "my-discoveredassetendpointprofile", + ); + console.log(result); +} + +async function main() { + getDiscoveredAssetEndpointProfile(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesListByResourceGroupSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesListByResourceGroupSample.ts new file mode 100644 index 000000000000..3d9ad21b61d3 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesListByResourceGroupSample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list DiscoveredAssetEndpointProfile resources by resource group + * + * @summary list DiscoveredAssetEndpointProfile resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_ResourceGroup.json + */ +async function listDiscoveredAssetEndpointProfilesResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.discoveredAssetEndpointProfiles.listByResourceGroup( + "myResourceGroup", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listDiscoveredAssetEndpointProfilesResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesListBySubscriptionSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesListBySubscriptionSample.ts new file mode 100644 index 000000000000..623bbae63b2f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesListBySubscriptionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list DiscoveredAssetEndpointProfile resources by subscription ID + * + * @summary list DiscoveredAssetEndpointProfile resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_Subscription.json + */ +async function listDiscoveredAssetEndpointProfilesSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.discoveredAssetEndpointProfiles.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listDiscoveredAssetEndpointProfilesSubscription(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesUpdateSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesUpdateSample.ts new file mode 100644 index 000000000000..2a4301998470 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetEndpointProfilesUpdateSample.ts @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a DiscoveredAssetEndpointProfile + * + * @summary update a DiscoveredAssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAssetEndpointProfile.json + */ +async function updateDiscoveredAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssetEndpointProfiles.update( + "myResourceGroup", + "my-discoveredassetendpointprofile", + { + properties: { + targetAddress: "https://www.example.com/myTargetAddress", + additionalConfiguration: '{"foo": "bar"}', + discoveryId: "11111111-1111-1111-1111-111111111111", + version: 73766, + endpointProfileType: "myEndpointProfileType", + supportedAuthenticationMethods: ["Anonymous", "Certificate"], + }, + }, + ); + console.log(result); +} + +async function main() { + updateDiscoveredAssetEndpointProfile(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsCreateOrReplaceSample.ts new file mode 100644 index 000000000000..708945264822 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsCreateOrReplaceSample.ts @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a DiscoveredAsset + * + * @summary create a DiscoveredAsset + * x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAsset.json + */ +async function createDiscoveredAsset() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssets.createOrReplace( + "myResourceGroup", + "my-discoveredasset", + { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + assetEndpointProfileRef: "myAssetEndpointProfile", + discoveryId: "11111111-1111-1111-1111-111111111111", + version: 73766, + manufacturer: "Contoso", + manufacturerUri: "https://www.contoso.com/manufacturerUri", + model: "ContosoModel", + productCode: "SA34VDG", + hardwareRevision: "1.0", + softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ + { + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + dataPointConfiguration: + '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + dataPointConfiguration: + '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], + }, + ], + events: [ + { + name: "event1", + eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, + }, + { + name: "event2", + eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + }, + ], + }, + }, + ); + console.log(result); +} + +async function main() { + createDiscoveredAsset(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsDeleteSample.ts new file mode 100644 index 000000000000..0846c4ee1563 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a DiscoveredAsset + * + * @summary delete a DiscoveredAsset + * x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAsset.json + */ +async function deleteDiscoveredAsset() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.discoveredAssets.delete("myResourceGroup", "my-discoveredasset"); +} + +async function main() { + deleteDiscoveredAsset(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsGetSample.ts new file mode 100644 index 000000000000..8d4d09baca68 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a DiscoveredAsset + * + * @summary get a DiscoveredAsset + * x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAsset.json + */ +async function getDiscoveredAsset() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssets.get("myResourceGroup", "my-discoveredasset"); + console.log(result); +} + +async function main() { + getDiscoveredAsset(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsListByResourceGroupSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsListByResourceGroupSample.ts new file mode 100644 index 000000000000..89afb36c8dbd --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list DiscoveredAsset resources by resource group + * + * @summary list DiscoveredAsset resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_ResourceGroup.json + */ +async function listDiscoveredAssetsResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.discoveredAssets.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listDiscoveredAssetsResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsListBySubscriptionSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsListBySubscriptionSample.ts new file mode 100644 index 000000000000..e0e20846efa9 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsListBySubscriptionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list DiscoveredAsset resources by subscription ID + * + * @summary list DiscoveredAsset resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_Subscription.json + */ +async function listDiscoveredAssetsSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.discoveredAssets.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listDiscoveredAssetsSubscription(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsUpdateSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsUpdateSample.ts new file mode 100644 index 000000000000..74ff2a691925 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/discoveredAssetsUpdateSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a DiscoveredAsset + * + * @summary update a DiscoveredAsset + * x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAsset.json + */ +async function updateDiscoveredAsset() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssets.update("myResourceGroup", "my-discoveredasset", { + properties: { + documentationUri: "https://www.example.com/manual-2", + defaultTopic: { path: "/path/defaultTopic", retain: "Never" }, + }, + }); + console.log(result); +} + +async function main() { + updateDiscoveredAsset(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/operationStatusGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/operationStatusGetSample.ts index c862e9c73e4c..c04f619a8821 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/operationStatusGetSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/operationStatusGetSample.ts @@ -1,39 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to Returns the current status of an async operation. + * This sample demonstrates how to returns the current status of an async operation. * - * @summary Returns the current status of an async operation. - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_OperationStatus.json + * @summary returns the current status of an async operation. + * x-ms-original-file: 2024-09-01-preview/Get_OperationStatus.json */ -async function getTheStatusOfAnAsyncOperation() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const location = "testLocation"; - const operationId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; +async function getOperationStatus() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.operationStatus.get(location, operationId); + const result = await client.operationStatus.get( + "testLocation", + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + ); console.log(result); } async function main() { - getTheStatusOfAnAsyncOperation(); + getOperationStatus(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/operationsListSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/operationsListSample.ts index 9c360acf4650..6bc18411adcb 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples-dev/operationsListSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/operationsListSample.ts @@ -1,40 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -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/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Operations.json + * @summary list the operations for the provider + * x-ms-original-file: 2024-09-01-preview/List_Operations.json */ -async function returnsListOfOperations() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; +async function listOperations() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); for await (let item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } async function main() { - returnsListOfOperations(); + listOperations(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesCreateOrReplaceSample.ts new file mode 100644 index 000000000000..3bd30a5556da --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesCreateOrReplaceSample.ts @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a SchemaRegistry + * + * @summary create a SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/Create_SchemaRegistry.json + */ +async function createSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaRegistries.createOrReplace( + "myResourceGroup", + "my-schema-registry", + { + properties: { + namespace: "sr-namespace-001", + displayName: "Schema Registry namespace 001", + description: "This is a sample Schema Registry", + storageAccountContainerUrl: "my-blob-storage.blob.core.windows.net/my-container", + }, + tags: {}, + location: "West Europe", + identity: { type: "None" }, + }, + ); + console.log(result); +} + +async function main() { + createSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesDeleteSample.ts new file mode 100644 index 000000000000..a1d15652899a --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a SchemaRegistry + * + * @summary delete a SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/Delete_SchemaRegistry.json + */ +async function deleteSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.schemaRegistries.delete("myResourceGroup", "my-schema-registry"); +} + +async function main() { + deleteSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesGetSample.ts new file mode 100644 index 000000000000..b9c5229b78f4 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a SchemaRegistry + * + * @summary get a SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/Get_SchemaRegistry.json + */ +async function getSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaRegistries.get("myResourceGroup", "my-schema-registry"); + console.log(result); +} + +async function main() { + getSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesListByResourceGroupSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesListByResourceGroupSample.ts new file mode 100644 index 000000000000..b2d9091a84f5 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list SchemaRegistry resources by resource group + * + * @summary list SchemaRegistry resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_ResourceGroup.json + */ +async function listSchemaRegistriesResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schemaRegistries.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listSchemaRegistriesResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesListBySubscriptionSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesListBySubscriptionSample.ts new file mode 100644 index 000000000000..184ad0890610 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesListBySubscriptionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list SchemaRegistry resources by subscription ID + * + * @summary list SchemaRegistry resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_Subscription.json + */ +async function listSchemaRegistriesSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schemaRegistries.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listSchemaRegistriesSubscription(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesUpdateSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesUpdateSample.ts new file mode 100644 index 000000000000..5b337962de49 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaRegistriesUpdateSample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a SchemaRegistry + * + * @summary update a SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/Update_SchemaRegistry.json + */ +async function updateSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaRegistries.update("myResourceGroup", "my-schema-registry", { + properties: { + displayName: "Schema Registry namespace 001", + description: "This is a sample Schema Registry", + }, + tags: {}, + }); + console.log(result); +} + +async function main() { + updateSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsCreateOrReplaceSample.ts new file mode 100644 index 000000000000..756eb65ac8b2 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsCreateOrReplaceSample.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a SchemaVersion + * + * @summary create a SchemaVersion + * x-ms-original-file: 2024-09-01-preview/Create_SchemaVersion.json + */ +async function createSchemaVersion() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaVersions.createOrReplace( + "myResourceGroup", + "my-schema-registry", + "my-schema", + "1", + { + properties: { + description: "Schema version 1", + schemaContent: + '{"$schema": "http://json-schema.org/draft-07/schema#","type": "object","properties": {"humidity": {"type": "string"},"temperature": {"type":"number"}}}', + }, + }, + ); + console.log(result); +} + +async function main() { + createSchemaVersion(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsDeleteSample.ts new file mode 100644 index 000000000000..7a9b8f4e750f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a SchemaVersion + * + * @summary delete a SchemaVersion + * x-ms-original-file: 2024-09-01-preview/Delete_SchemaVersion.json + */ +async function deleteSchemaVersion() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.schemaVersions.delete("myResourceGroup", "my-schema-registry", "my-schema", "1"); +} + +async function main() { + deleteSchemaVersion(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsGetSample.ts new file mode 100644 index 000000000000..e923b34c9dd9 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsGetSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a SchemaVersion + * + * @summary get a SchemaVersion + * x-ms-original-file: 2024-09-01-preview/Get_SchemaVersion.json + */ +async function getSchemaVersion() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaVersions.get( + "myResourceGroup", + "my-schema-registry", + "my-schema", + "1", + ); + console.log(result); +} + +async function main() { + getSchemaVersion(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsListBySchemaSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsListBySchemaSample.ts new file mode 100644 index 000000000000..fcf3833e595f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemaVersionsListBySchemaSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list SchemaVersion resources by Schema + * + * @summary list SchemaVersion resources by Schema + * x-ms-original-file: 2024-09-01-preview/List_SchemaVersions_Schema.json + */ +async function listSchemaVersionsSchema() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schemaVersions.listBySchema( + "myResourceGroup", + "my-schema-registry", + "my-schema", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listSchemaVersionsSchema(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasCreateOrReplaceSample.ts new file mode 100644 index 000000000000..10c843389179 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasCreateOrReplaceSample.ts @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a Schema + * + * @summary create a Schema + * x-ms-original-file: 2024-09-01-preview/Create_Schema.json + */ +async function createSchema() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemas.createOrReplace( + "myResourceGroup", + "my-schema-registry", + "my-schema", + { + properties: { + displayName: "My Schema", + description: "This is a sample Schema", + format: "JsonSchema/draft-07", + schemaType: "MessageSchema", + tags: { sampleKey: "sampleValue" }, + }, + }, + ); + console.log(result); +} + +async function main() { + createSchema(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasDeleteSample.ts new file mode 100644 index 000000000000..7f68fe71513a --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a Schema + * + * @summary delete a Schema + * x-ms-original-file: 2024-09-01-preview/Delete_Schema.json + */ +async function deleteSchema() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.schemas.delete("myResourceGroup", "my-schema-registry", "my-schema"); +} + +async function main() { + deleteSchema(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasGetSample.ts new file mode 100644 index 000000000000..1eaec80dd028 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a Schema + * + * @summary get a Schema + * x-ms-original-file: 2024-09-01-preview/Get_Schema.json + */ +async function schemasGet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemas.get("myResourceGroup", "my-schema-registry", "my-schema"); + console.log(result); +} + +async function main() { + schemasGet(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasListBySchemaRegistrySample.ts b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasListBySchemaRegistrySample.ts new file mode 100644 index 000000000000..fb60e26a5a40 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples-dev/schemasListBySchemaRegistrySample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list Schema resources by SchemaRegistry + * + * @summary list Schema resources by SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/List_Schemas_SchemaRegistry.json + */ +async function listSchemasSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schemas.listBySchemaRegistry( + "myResourceGroup", + "my-schema-registry", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listSchemasSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/README.md b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/README.md index cd70b4d9ffe8..ae9f650c52e2 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/README.md +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/README.md @@ -1,23 +1,51 @@ -# client library samples for JavaScript (Beta) - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [assetEndpointProfilesCreateOrReplaceSample.js][assetendpointprofilescreateorreplacesample] | Create a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_AssetEndpointProfile.json | -| [assetEndpointProfilesDeleteSample.js][assetendpointprofilesdeletesample] | Delete a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_AssetEndpointProfile.json | -| [assetEndpointProfilesGetSample.js][assetendpointprofilesgetsample] | Get a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json | -| [assetEndpointProfilesListByResourceGroupSample.js][assetendpointprofileslistbyresourcegroupsample] | List AssetEndpointProfile resources by resource group x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_ResourceGroup.json | -| [assetEndpointProfilesListBySubscriptionSample.js][assetendpointprofileslistbysubscriptionsample] | List AssetEndpointProfile resources by subscription ID x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_Subscription.json | -| [assetEndpointProfilesUpdateSample.js][assetendpointprofilesupdatesample] | Update a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json | -| [assetsCreateOrReplaceSample.js][assetscreateorreplacesample] | Create a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_With_ExternalAssetId.json | -| [assetsDeleteSample.js][assetsdeletesample] | Delete a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_Asset.json | -| [assetsGetSample.js][assetsgetsample] | Get a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json | -| [assetsListByResourceGroupSample.js][assetslistbyresourcegroupsample] | List Asset resources by resource group x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_ResourceGroup.json | -| [assetsListBySubscriptionSample.js][assetslistbysubscriptionsample] | List Asset resources by subscription ID x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_Subscription.json | -| [assetsUpdateSample.js][assetsupdatesample] | Update a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json | -| [operationStatusGetSample.js][operationstatusgetsample] | Returns the current status of an async operation. x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_OperationStatus.json | -| [operationsListSample.js][operationslistsample] | List the operations for the provider x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Operations.json | +# @azure/arm-deviceregistry client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for @azure/arm-deviceregistry in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [assetEndpointProfilesCreateOrReplaceSample.js][assetendpointprofilescreateorreplacesample] | create a AssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile.json | +| [assetEndpointProfilesDeleteSample.js][assetendpointprofilesdeletesample] | delete a AssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Delete_AssetEndpointProfile.json | +| [assetEndpointProfilesGetSample.js][assetendpointprofilesgetsample] | get a AssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile.json | +| [assetEndpointProfilesListByResourceGroupSample.js][assetendpointprofileslistbyresourcegroupsample] | list AssetEndpointProfile resources by resource group x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_ResourceGroup.json | +| [assetEndpointProfilesListBySubscriptionSample.js][assetendpointprofileslistbysubscriptionsample] | list AssetEndpointProfile resources by subscription ID x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_Subscription.json | +| [assetEndpointProfilesUpdateSample.js][assetendpointprofilesupdatesample] | update a AssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Update_AssetEndpointProfile.json | +| [assetsCreateOrReplaceSample.js][assetscreateorreplacesample] | create a Asset x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_DisplayName.json | +| [assetsDeleteSample.js][assetsdeletesample] | delete a Asset x-ms-original-file: 2024-09-01-preview/Delete_Asset.json | +| [assetsGetSample.js][assetsgetsample] | get a Asset x-ms-original-file: 2024-09-01-preview/Get_Asset.json | +| [assetsListByResourceGroupSample.js][assetslistbyresourcegroupsample] | list Asset resources by resource group x-ms-original-file: 2024-09-01-preview/List_Assets_ResourceGroup.json | +| [assetsListBySubscriptionSample.js][assetslistbysubscriptionsample] | list Asset resources by subscription ID x-ms-original-file: 2024-09-01-preview/List_Assets_Subscription.json | +| [assetsUpdateSample.js][assetsupdatesample] | update a Asset x-ms-original-file: 2024-09-01-preview/Update_Asset.json | +| [billingContainersGetSample.js][billingcontainersgetsample] | get a BillingContainer x-ms-original-file: 2024-09-01-preview/Get_BillingContainer.json | +| [billingContainersListBySubscriptionSample.js][billingcontainerslistbysubscriptionsample] | list BillingContainer resources by subscription ID x-ms-original-file: 2024-09-01-preview/List_BillingContainers_Subscription.json | +| [discoveredAssetEndpointProfilesCreateOrReplaceSample.js][discoveredassetendpointprofilescreateorreplacesample] | create a DiscoveredAssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAssetEndpointProfile.json | +| [discoveredAssetEndpointProfilesDeleteSample.js][discoveredassetendpointprofilesdeletesample] | delete a DiscoveredAssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAssetEndpointProfile.json | +| [discoveredAssetEndpointProfilesGetSample.js][discoveredassetendpointprofilesgetsample] | get a DiscoveredAssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAssetEndpointProfile.json | +| [discoveredAssetEndpointProfilesListByResourceGroupSample.js][discoveredassetendpointprofileslistbyresourcegroupsample] | list DiscoveredAssetEndpointProfile resources by resource group x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_ResourceGroup.json | +| [discoveredAssetEndpointProfilesListBySubscriptionSample.js][discoveredassetendpointprofileslistbysubscriptionsample] | list DiscoveredAssetEndpointProfile resources by subscription ID x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_Subscription.json | +| [discoveredAssetEndpointProfilesUpdateSample.js][discoveredassetendpointprofilesupdatesample] | update a DiscoveredAssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAssetEndpointProfile.json | +| [discoveredAssetsCreateOrReplaceSample.js][discoveredassetscreateorreplacesample] | create a DiscoveredAsset x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAsset.json | +| [discoveredAssetsDeleteSample.js][discoveredassetsdeletesample] | delete a DiscoveredAsset x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAsset.json | +| [discoveredAssetsGetSample.js][discoveredassetsgetsample] | get a DiscoveredAsset x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAsset.json | +| [discoveredAssetsListByResourceGroupSample.js][discoveredassetslistbyresourcegroupsample] | list DiscoveredAsset resources by resource group x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_ResourceGroup.json | +| [discoveredAssetsListBySubscriptionSample.js][discoveredassetslistbysubscriptionsample] | list DiscoveredAsset resources by subscription ID x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_Subscription.json | +| [discoveredAssetsUpdateSample.js][discoveredassetsupdatesample] | update a DiscoveredAsset x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAsset.json | +| [operationStatusGetSample.js][operationstatusgetsample] | returns the current status of an async operation. x-ms-original-file: 2024-09-01-preview/Get_OperationStatus.json | +| [operationsListSample.js][operationslistsample] | list the operations for the provider x-ms-original-file: 2024-09-01-preview/List_Operations.json | +| [schemaRegistriesCreateOrReplaceSample.js][schemaregistriescreateorreplacesample] | create a SchemaRegistry x-ms-original-file: 2024-09-01-preview/Create_SchemaRegistry.json | +| [schemaRegistriesDeleteSample.js][schemaregistriesdeletesample] | delete a SchemaRegistry x-ms-original-file: 2024-09-01-preview/Delete_SchemaRegistry.json | +| [schemaRegistriesGetSample.js][schemaregistriesgetsample] | get a SchemaRegistry x-ms-original-file: 2024-09-01-preview/Get_SchemaRegistry.json | +| [schemaRegistriesListByResourceGroupSample.js][schemaregistrieslistbyresourcegroupsample] | list SchemaRegistry resources by resource group x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_ResourceGroup.json | +| [schemaRegistriesListBySubscriptionSample.js][schemaregistrieslistbysubscriptionsample] | list SchemaRegistry resources by subscription ID x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_Subscription.json | +| [schemaRegistriesUpdateSample.js][schemaregistriesupdatesample] | update a SchemaRegistry x-ms-original-file: 2024-09-01-preview/Update_SchemaRegistry.json | +| [schemaVersionsCreateOrReplaceSample.js][schemaversionscreateorreplacesample] | create a SchemaVersion x-ms-original-file: 2024-09-01-preview/Create_SchemaVersion.json | +| [schemaVersionsDeleteSample.js][schemaversionsdeletesample] | delete a SchemaVersion x-ms-original-file: 2024-09-01-preview/Delete_SchemaVersion.json | +| [schemaVersionsGetSample.js][schemaversionsgetsample] | get a SchemaVersion x-ms-original-file: 2024-09-01-preview/Get_SchemaVersion.json | +| [schemaVersionsListBySchemaSample.js][schemaversionslistbyschemasample] | list SchemaVersion resources by Schema x-ms-original-file: 2024-09-01-preview/List_SchemaVersions_Schema.json | +| [schemasCreateOrReplaceSample.js][schemascreateorreplacesample] | create a Schema x-ms-original-file: 2024-09-01-preview/Create_Schema.json | +| [schemasDeleteSample.js][schemasdeletesample] | delete a Schema x-ms-original-file: 2024-09-01-preview/Delete_Schema.json | +| [schemasGetSample.js][schemasgetsample] | get a Schema x-ms-original-file: 2024-09-01-preview/Get_Schema.json | +| [schemasListBySchemaRegistrySample.js][schemaslistbyschemaregistrysample] | list Schema resources by SchemaRegistry x-ms-original-file: 2024-09-01-preview/List_Schemas_SchemaRegistry.json | ## Prerequisites @@ -50,7 +78,7 @@ node assetEndpointProfilesCreateOrReplaceSample.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 DEVICEREGISTRY_SUBSCRIPTION_ID="" DEVICEREGISTRY_RESOURCE_GROUP="" node assetEndpointProfilesCreateOrReplaceSample.js +npx dev-tool run vendored cross-env node assetEndpointProfilesCreateOrReplaceSample.js ``` ## Next Steps @@ -69,8 +97,36 @@ Take a look at our [API Documentation][apiref] for more information about the AP [assetslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsListByResourceGroupSample.js [assetslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsListBySubscriptionSample.js [assetsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsUpdateSample.js +[billingcontainersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/billingContainersGetSample.js +[billingcontainerslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/billingContainersListBySubscriptionSample.js +[discoveredassetendpointprofilescreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesCreateOrReplaceSample.js +[discoveredassetendpointprofilesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesDeleteSample.js +[discoveredassetendpointprofilesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesGetSample.js +[discoveredassetendpointprofileslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesListByResourceGroupSample.js +[discoveredassetendpointprofileslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesListBySubscriptionSample.js +[discoveredassetendpointprofilesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesUpdateSample.js +[discoveredassetscreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsCreateOrReplaceSample.js +[discoveredassetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsDeleteSample.js +[discoveredassetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsGetSample.js +[discoveredassetslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsListByResourceGroupSample.js +[discoveredassetslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsListBySubscriptionSample.js +[discoveredassetsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsUpdateSample.js [operationstatusgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/operationStatusGetSample.js [operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/operationsListSample.js +[schemaregistriescreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesCreateOrReplaceSample.js +[schemaregistriesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesDeleteSample.js +[schemaregistriesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesGetSample.js +[schemaregistrieslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesListByResourceGroupSample.js +[schemaregistrieslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesListBySubscriptionSample.js +[schemaregistriesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesUpdateSample.js +[schemaversionscreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsCreateOrReplaceSample.js +[schemaversionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsDeleteSample.js +[schemaversionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsGetSample.js +[schemaversionslistbyschemasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsListBySchemaSample.js +[schemascreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasCreateOrReplaceSample.js +[schemasdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasDeleteSample.js +[schemasgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasGetSample.js +[schemaslistbyschemaregistrysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasListBySchemaRegistrySample.js [apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-deviceregistry?view=azure-node-preview [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceregistry/arm-deviceregistry/README.md diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesCreateOrReplaceSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesCreateOrReplaceSample.js index 86f9d3073f97..49cc2d4cb45d 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesCreateOrReplaceSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesCreateOrReplaceSample.js @@ -1,52 +1,73 @@ -/* - * 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 { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Create a AssetEndpointProfile + * This sample demonstrates how to create a AssetEndpointProfile * - * @summary Create a AssetEndpointProfile - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_AssetEndpointProfile.json + * @summary create a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile.json */ -async function createAnAssetEndpointProfile() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetEndpointProfileName = "my-assetendpointprofile"; - const resource = { - extendedLocation: { - name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", - type: "CustomLocation", - }, - location: "West Europe", - properties: { - targetAddress: "https://www.example.com/myTargetAddress", - userAuthentication: { mode: "Anonymous" }, +async function createAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assetEndpointProfiles.createOrReplace( + "myResourceGroup", + "my-assetendpointprofile", + { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + targetAddress: "https://www.example.com/myTargetAddress", + endpointProfileType: "myEndpointProfileType", + authentication: { method: "Anonymous" }, + }, }, - tags: { site: "building-1" }, - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to create a AssetEndpointProfile + * + * @summary create a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile_With_DiscoveredAepRef.json + */ +async function createAssetEndpointProfileWithDiscoveredAepRef() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assetEndpointProfiles.beginCreateOrReplaceAndWait( - resourceGroupName, - assetEndpointProfileName, - resource, + const result = await client.assetEndpointProfiles.createOrReplace( + "myResourceGroup", + "my-assetendpointprofile", + { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + targetAddress: "https://www.example.com/myTargetAddress", + endpointProfileType: "myEndpointProfileType", + discoveredAssetEndpointProfileRef: "discoveredAssetEndpointProfile1", + authentication: { method: "Anonymous" }, + }, + }, ); console.log(result); } async function main() { - createAnAssetEndpointProfile(); + createAssetEndpointProfile(); + createAssetEndpointProfileWithDiscoveredAepRef(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesDeleteSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesDeleteSample.js index e300baa8d740..af9d90ab55ba 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesDeleteSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesDeleteSample.js @@ -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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Delete a AssetEndpointProfile + * This sample demonstrates how to delete a AssetEndpointProfile * - * @summary Delete a AssetEndpointProfile - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_AssetEndpointProfile.json + * @summary delete a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Delete_AssetEndpointProfile.json */ -async function deleteAnAssetEndpointProfile() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetEndpointProfileName = "my-assetendpointprofile"; +async function deleteAssetEndpointProfile() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assetEndpointProfiles.beginDeleteAndWait( - resourceGroupName, - assetEndpointProfileName, - ); - console.log(result); + await client.assetEndpointProfiles.delete("myResourceGroup", "my-assetendpointprofile"); } async function main() { - deleteAnAssetEndpointProfile(); + deleteAssetEndpointProfile(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesGetSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesGetSample.js index 27f1b063d10a..667daf23051d 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesGetSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesGetSample.js @@ -1,39 +1,46 @@ -/* - * 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 { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get a AssetEndpointProfile + * This sample demonstrates how to get a AssetEndpointProfile + * + * @summary get a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile.json + */ +async function getAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assetEndpointProfiles.get( + "myResourceGroup", + "my-assetendpointprofile", + ); + console.log(result); +} + +/** + * This sample demonstrates how to get a AssetEndpointProfile * - * @summary Get a AssetEndpointProfile - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json + * @summary get a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile_With_SyncStatus.json */ -async function getAnAssetEndpointProfile() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetEndpointProfileName = "my-assetendpointprofile"; +async function getAssetEndpointProfileWithSyncStatus() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const result = await client.assetEndpointProfiles.get( - resourceGroupName, - assetEndpointProfileName, + "myResourceGroup", + "my-assetendpointprofile", ); console.log(result); } async function main() { - getAnAssetEndpointProfile(); + getAssetEndpointProfile(); + getAssetEndpointProfileWithSyncStatus(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesListByResourceGroupSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesListByResourceGroupSample.js index 931157af7239..0d77c7942296 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesListByResourceGroupSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesListByResourceGroupSample.js @@ -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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to List AssetEndpointProfile resources by resource group + * This sample demonstrates how to list AssetEndpointProfile resources by resource group * - * @summary List AssetEndpointProfile resources by resource group - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_ResourceGroup.json + * @summary list AssetEndpointProfile resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_ResourceGroup.json */ -async function listAssetEndpointProfilesInAResourceGroup() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; +async function listAssetEndpointProfilesResourceGroup() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.assetEndpointProfiles.listByResourceGroup(resourceGroupName)) { + for await (let item of client.assetEndpointProfiles.listByResourceGroup("myResourceGroup")) { resArray.push(item); } + console.log(resArray); } async function main() { - listAssetEndpointProfilesInAResourceGroup(); + listAssetEndpointProfilesResourceGroup(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesListBySubscriptionSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesListBySubscriptionSample.js index c70e6c0fbf2e..ec9ddcd1518a 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesListBySubscriptionSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesListBySubscriptionSample.js @@ -1,37 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to List AssetEndpointProfile resources by subscription ID + * This sample demonstrates how to list AssetEndpointProfile resources by subscription ID * - * @summary List AssetEndpointProfile resources by subscription ID - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_Subscription.json + * @summary list AssetEndpointProfile resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_Subscription.json */ -async function listAssetEndpointProfilesInASubscription() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; +async function listAssetEndpointProfilesSubscription() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); for await (let item of client.assetEndpointProfiles.listBySubscription()) { resArray.push(item); } + console.log(resArray); } async function main() { - listAssetEndpointProfilesInASubscription(); + listAssetEndpointProfilesSubscription(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesUpdateSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesUpdateSample.js index a9ac59527622..402979e13375 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesUpdateSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesUpdateSample.js @@ -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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Update a AssetEndpointProfile + * This sample demonstrates how to update a AssetEndpointProfile * - * @summary Update a AssetEndpointProfile - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json + * @summary update a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Update_AssetEndpointProfile.json */ -async function patchAnAssetEndpointProfile() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetEndpointProfileName = "my-assetendpointprofile"; - const properties = { - properties: { targetAddress: "https://www.example.com/myTargetAddress" }, - }; +async function updateAssetEndpointProfile() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assetEndpointProfiles.beginUpdateAndWait( - resourceGroupName, - assetEndpointProfileName, - properties, + const result = await client.assetEndpointProfiles.update( + "myResourceGroup", + "my-assetendpointprofile", + { + properties: { targetAddress: "https://www.example.com/myTargetAddress" }, + }, ); console.log(result); } async function main() { - patchAnAssetEndpointProfile(); + updateAssetEndpointProfile(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsCreateOrReplaceSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsCreateOrReplaceSample.js index 2ce823e81f03..8aad2b73f37d 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsCreateOrReplaceSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsCreateOrReplaceSample.js @@ -1,247 +1,317 @@ -/* - * 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 { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Create a Asset + * This sample demonstrates how to create a Asset * - * @summary Create a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_With_ExternalAssetId.json + * @summary create a Asset + * x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_DisplayName.json */ -async function createAnAssetWithExternalAssetId() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; - const resource = { +async function createAssetWithoutDisplayName() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assets.createOrReplace("myResourceGroup", "my-asset", { + location: "West Europe", extendedLocation: { - name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", }, - location: "West Europe", + tags: { site: "building-1" }, properties: { + enabled: true, + externalAssetId: "8ZBA6LRHU0A458969", description: "This is a sample Asset", - assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile", - assetType: "MyAssetType", - dataPoints: [ - { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", - observabilityMode: "counter", - }, + assetEndpointProfileRef: "myAssetEndpointProfile", + manufacturer: "Contoso", + manufacturerUri: "https://www.contoso.com/manufacturerUri", + model: "ContosoModel", + productCode: "SA34VDG", + hardwareRevision: "1.0", + softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", - observabilityMode: "none", + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + observabilityMode: "Counter", + dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + observabilityMode: "None", + dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], }, ], - defaultDataPointsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - displayName: "AssetDisplayName", - documentationUri: "https://www.example.com/manual", - enabled: true, events: [ { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + name: "event1", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", - observabilityMode: "none", + observabilityMode: "None", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, }, { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + name: "event2", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", - observabilityMode: "log", + observabilityMode: "Log", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', }, ], - externalAssetId: "8ZBA6LRHU0A458969", - hardwareRevision: "1.0", - manufacturer: "Contoso", - manufacturerUri: "https://www.contoso.com/manufacturerUri", - model: "ContosoModel", - productCode: "SA34VDG", - serialNumber: "64-103816-519918-8", - softwareRevision: "2.0", }, - tags: { site: "building-1" }, - }; - const credential = new DefaultAzureCredential(); - const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginCreateOrReplaceAndWait( - resourceGroupName, - assetName, - resource, - ); + }); console.log(result); } /** - * This sample demonstrates how to Create a Asset + * This sample demonstrates how to create a Asset * - * @summary Create a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_DisplayName.json + * @summary create a Asset + * x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_ExternalAssetId.json */ -async function createAnAssetWithoutDisplayName() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; - const resource = { +async function createAssetWithoutExternalAssetId() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assets.createOrReplace("myResourceGroup", "my-asset", { + location: "West Europe", extendedLocation: { - name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", }, - location: "West Europe", + tags: { site: "building-1" }, properties: { + enabled: true, + displayName: "AssetDisplayName", description: "This is a sample Asset", - assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile", - assetType: "MyAssetType", - dataPoints: [ - { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", - observabilityMode: "counter", - }, + assetEndpointProfileRef: "myAssetEndpointProfile", + manufacturer: "Contoso", + manufacturerUri: "https://www.contoso.com/manufacturerUri", + model: "ContosoModel", + productCode: "SA34VDG", + hardwareRevision: "1.0", + softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", - observabilityMode: "none", + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + observabilityMode: "Counter", + dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + observabilityMode: "None", + dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], }, ], - defaultDataPointsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - documentationUri: "https://www.example.com/manual", - enabled: true, events: [ { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + name: "event1", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", - observabilityMode: "none", + observabilityMode: "None", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, }, { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + name: "event2", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", - observabilityMode: "log", + observabilityMode: "Log", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', }, ], + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to create a Asset + * + * @summary create a Asset + * x-ms-original-file: 2024-09-01-preview/Create_Asset_With_DiscoveredAssetRef.json + */ +async function createAssetWithDiscoveredAssetRefs() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assets.createOrReplace("myResourceGroup", "my-asset", { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + enabled: true, externalAssetId: "8ZBA6LRHU0A458969", - hardwareRevision: "1.0", + displayName: "AssetDisplayName", + description: "This is a sample Asset", + assetEndpointProfileRef: "myAssetEndpointProfile", manufacturer: "Contoso", manufacturerUri: "https://www.contoso.com/manufacturerUri", model: "ContosoModel", productCode: "SA34VDG", - serialNumber: "64-103816-519918-8", + hardwareRevision: "1.0", softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + discoveredAssetRefs: ["discoveredAsset1", "discoveredAsset2"], + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ + { + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + observabilityMode: "Counter", + dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + observabilityMode: "None", + dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], + }, + ], + events: [ + { + name: "event1", + eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", + observabilityMode: "None", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, + }, + { + name: "event2", + eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", + observabilityMode: "Log", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + }, + ], }, - tags: { site: "building-1" }, - }; - const credential = new DefaultAzureCredential(); - const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginCreateOrReplaceAndWait( - resourceGroupName, - assetName, - resource, - ); + }); console.log(result); } /** - * This sample demonstrates how to Create a Asset + * This sample demonstrates how to create a Asset * - * @summary Create a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_ExternalAssetId.json + * @summary create a Asset + * x-ms-original-file: 2024-09-01-preview/Create_Asset_With_ExternalAssetId.json */ -async function createAnAssetWithoutExternalAssetId() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; - const resource = { +async function createAssetWithExternalAssetId() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assets.createOrReplace("myResourceGroup", "my-asset", { + location: "West Europe", extendedLocation: { - name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", }, - location: "West Europe", + tags: { site: "building-1" }, properties: { + enabled: true, + externalAssetId: "8ZBA6LRHU0A458969", + displayName: "AssetDisplayName", description: "This is a sample Asset", - assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile", - assetType: "MyAssetType", - dataPoints: [ - { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", - observabilityMode: "counter", - }, + assetEndpointProfileRef: "myAssetEndpointProfile", + manufacturer: "Contoso", + manufacturerUri: "https://www.contoso.com/manufacturerUri", + model: "ContosoModel", + productCode: "SA34VDG", + hardwareRevision: "1.0", + softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", - observabilityMode: "none", + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + observabilityMode: "Counter", + dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + observabilityMode: "None", + dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], }, ], - defaultDataPointsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - displayName: "AssetDisplayName", - documentationUri: "https://www.example.com/manual", - enabled: true, events: [ { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + name: "event1", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", - observabilityMode: "none", + observabilityMode: "None", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, }, { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + name: "event2", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", - observabilityMode: "log", + observabilityMode: "Log", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', }, ], - hardwareRevision: "1.0", - manufacturer: "Contoso", - manufacturerUri: "https://www.contoso.com/manufacturerUri", - model: "ContosoModel", - productCode: "SA34VDG", - serialNumber: "64-103816-519918-8", - softwareRevision: "2.0", }, - tags: { site: "building-1" }, - }; - const credential = new DefaultAzureCredential(); - const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginCreateOrReplaceAndWait( - resourceGroupName, - assetName, - resource, - ); + }); console.log(result); } async function main() { - createAnAssetWithExternalAssetId(); - createAnAssetWithoutDisplayName(); - createAnAssetWithoutExternalAssetId(); + createAssetWithoutDisplayName(); + createAssetWithoutExternalAssetId(); + createAssetWithDiscoveredAssetRefs(); + createAssetWithExternalAssetId(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsDeleteSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsDeleteSample.js index 6772d00e3c02..2f352e52287b 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsDeleteSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsDeleteSample.js @@ -1,36 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Delete a Asset + * This sample demonstrates how to delete a Asset * - * @summary Delete a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_Asset.json + * @summary delete a Asset + * x-ms-original-file: 2024-09-01-preview/Delete_Asset.json */ -async function deleteAnAsset() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; +async function deleteAsset() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginDeleteAndWait(resourceGroupName, assetName); - console.log(result); + await client.assets.delete("myResourceGroup", "my-asset"); } async function main() { - deleteAnAsset(); + deleteAsset(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsGetSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsGetSample.js index f9b7c6691abd..cd12248da968 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsGetSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsGetSample.js @@ -1,54 +1,40 @@ -/* - * 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 { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Get a Asset + * This sample demonstrates how to get a Asset * - * @summary Get a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json + * @summary get a Asset + * x-ms-original-file: 2024-09-01-preview/Get_Asset.json */ -async function getAnAsset() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; +async function getAsset() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.get(resourceGroupName, assetName); + const result = await client.assets.get("myResourceGroup", "my-asset"); console.log(result); } /** - * This sample demonstrates how to Get a Asset + * This sample demonstrates how to get a Asset * - * @summary Get a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset_With_SyncStatus.json + * @summary get a Asset + * x-ms-original-file: 2024-09-01-preview/Get_Asset_With_SyncStatus.json */ -async function getAnAssetWithSyncStatus() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; +async function getAssetWithSyncStatus() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.get(resourceGroupName, assetName); + const result = await client.assets.get("myResourceGroup", "my-asset"); console.log(result); } async function main() { - getAnAsset(); - getAnAssetWithSyncStatus(); + getAsset(); + getAssetWithSyncStatus(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsListByResourceGroupSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsListByResourceGroupSample.js index 465c9e43679a..6dc75487a3fa 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsListByResourceGroupSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsListByResourceGroupSample.js @@ -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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to List Asset resources by resource group + * This sample demonstrates how to list Asset resources by resource group * - * @summary List Asset resources by resource group - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_ResourceGroup.json + * @summary list Asset resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_Assets_ResourceGroup.json */ -async function listAssetsInAResourceGroup() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; +async function listAssetsResourceGroup() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.assets.listByResourceGroup(resourceGroupName)) { + for await (let item of client.assets.listByResourceGroup("myResourceGroup")) { resArray.push(item); } + console.log(resArray); } async function main() { - listAssetsInAResourceGroup(); + listAssetsResourceGroup(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsListBySubscriptionSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsListBySubscriptionSample.js index 367fcc37795e..bed170f4a7f6 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsListBySubscriptionSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsListBySubscriptionSample.js @@ -1,37 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to List Asset resources by subscription ID + * This sample demonstrates how to list Asset resources by subscription ID * - * @summary List Asset resources by subscription ID - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_Subscription.json + * @summary list Asset resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_Assets_Subscription.json */ -async function listAssetsInASubscription() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; +async function listAssetsSubscription() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); for await (let item of client.assets.listBySubscription()) { resArray.push(item); } + console.log(resArray); } async function main() { - listAssetsInASubscription(); + listAssetsSubscription(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsUpdateSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsUpdateSample.js index fa3bfae65866..765b4df23fab 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsUpdateSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsUpdateSample.js @@ -1,39 +1,27 @@ -/* - * 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 { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Update a Asset + * This sample demonstrates how to update a Asset * - * @summary Update a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json + * @summary update a Asset + * x-ms-original-file: 2024-09-01-preview/Update_Asset.json */ -async function patchAnAsset() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; - const properties = { - properties: { displayName: "NewAssetDisplayName", enabled: false }, - }; +async function updateAsset() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginUpdateAndWait(resourceGroupName, assetName, properties); + const result = await client.assets.update("myResourceGroup", "my-asset", { + properties: { enabled: false, displayName: "NewAssetDisplayName" }, + }); console.log(result); } async function main() { - patchAnAsset(); + updateAsset(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/billingContainersGetSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/billingContainersGetSample.js new file mode 100644 index 000000000000..5a92ff71dfb7 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/billingContainersGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get a BillingContainer + * + * @summary get a BillingContainer + * x-ms-original-file: 2024-09-01-preview/Get_BillingContainer.json + */ +async function getBillingContainer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.billingContainers.get("my-billingContainer"); + console.log(result); +} + +async function main() { + getBillingContainer(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/billingContainersListBySubscriptionSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/billingContainersListBySubscriptionSample.js new file mode 100644 index 000000000000..0226afc800e4 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/billingContainersListBySubscriptionSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list BillingContainer resources by subscription ID + * + * @summary list BillingContainer resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_BillingContainers_Subscription.json + */ +async function listBillingContainersSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.billingContainers.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listBillingContainersSubscription(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesCreateOrReplaceSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesCreateOrReplaceSample.js new file mode 100644 index 000000000000..180be1cf4944 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesCreateOrReplaceSample.js @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to create a DiscoveredAssetEndpointProfile + * + * @summary create a DiscoveredAssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAssetEndpointProfile.json + */ +async function createDiscoveredAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssetEndpointProfiles.createOrReplace( + "myResourceGroup", + "my-discoveredassetendpointprofile", + { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + targetAddress: "https://www.example.com/myTargetAddress", + additionalConfiguration: '{"foo": "bar"}', + discoveryId: "11111111-1111-1111-1111-111111111111", + version: 73766, + endpointProfileType: "myEndpointProfileType", + supportedAuthenticationMethods: ["Anonymous", "Certificate", "UsernamePassword"], + }, + }, + ); + console.log(result); +} + +async function main() { + createDiscoveredAssetEndpointProfile(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesDeleteSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesDeleteSample.js new file mode 100644 index 000000000000..e5242879e3db --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesDeleteSample.js @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to delete a DiscoveredAssetEndpointProfile + * + * @summary delete a DiscoveredAssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAssetEndpointProfile.json + */ +async function deleteDiscoveredAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.discoveredAssetEndpointProfiles.delete( + "myResourceGroup", + "my-discoveredassetendpointprofile", + ); +} + +async function main() { + deleteDiscoveredAssetEndpointProfile(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesGetSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesGetSample.js new file mode 100644 index 000000000000..9eea8afe04cc --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesGetSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get a DiscoveredAssetEndpointProfile + * + * @summary get a DiscoveredAssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAssetEndpointProfile.json + */ +async function getDiscoveredAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssetEndpointProfiles.get( + "myResourceGroup", + "my-discoveredassetendpointprofile", + ); + console.log(result); +} + +async function main() { + getDiscoveredAssetEndpointProfile(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesListByResourceGroupSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesListByResourceGroupSample.js new file mode 100644 index 000000000000..60351227caf6 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesListByResourceGroupSample.js @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list DiscoveredAssetEndpointProfile resources by resource group + * + * @summary list DiscoveredAssetEndpointProfile resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_ResourceGroup.json + */ +async function listDiscoveredAssetEndpointProfilesResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.discoveredAssetEndpointProfiles.listByResourceGroup( + "myResourceGroup", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listDiscoveredAssetEndpointProfilesResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesListBySubscriptionSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesListBySubscriptionSample.js new file mode 100644 index 000000000000..3f3d0e6b5e6b --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesListBySubscriptionSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list DiscoveredAssetEndpointProfile resources by subscription ID + * + * @summary list DiscoveredAssetEndpointProfile resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_Subscription.json + */ +async function listDiscoveredAssetEndpointProfilesSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.discoveredAssetEndpointProfiles.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listDiscoveredAssetEndpointProfilesSubscription(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesUpdateSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesUpdateSample.js new file mode 100644 index 000000000000..b9b4cf5d9507 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetEndpointProfilesUpdateSample.js @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to update a DiscoveredAssetEndpointProfile + * + * @summary update a DiscoveredAssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAssetEndpointProfile.json + */ +async function updateDiscoveredAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssetEndpointProfiles.update( + "myResourceGroup", + "my-discoveredassetendpointprofile", + { + properties: { + targetAddress: "https://www.example.com/myTargetAddress", + additionalConfiguration: '{"foo": "bar"}', + discoveryId: "11111111-1111-1111-1111-111111111111", + version: 73766, + endpointProfileType: "myEndpointProfileType", + supportedAuthenticationMethods: ["Anonymous", "Certificate"], + }, + }, + ); + console.log(result); +} + +async function main() { + updateDiscoveredAssetEndpointProfile(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsCreateOrReplaceSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsCreateOrReplaceSample.js new file mode 100644 index 000000000000..16093d8f9bd8 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsCreateOrReplaceSample.js @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to create a DiscoveredAsset + * + * @summary create a DiscoveredAsset + * x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAsset.json + */ +async function createDiscoveredAsset() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssets.createOrReplace( + "myResourceGroup", + "my-discoveredasset", + { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + assetEndpointProfileRef: "myAssetEndpointProfile", + discoveryId: "11111111-1111-1111-1111-111111111111", + version: 73766, + manufacturer: "Contoso", + manufacturerUri: "https://www.contoso.com/manufacturerUri", + model: "ContosoModel", + productCode: "SA34VDG", + hardwareRevision: "1.0", + softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ + { + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + dataPointConfiguration: + '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + dataPointConfiguration: + '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], + }, + ], + events: [ + { + name: "event1", + eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, + }, + { + name: "event2", + eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + }, + ], + }, + }, + ); + console.log(result); +} + +async function main() { + createDiscoveredAsset(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsDeleteSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsDeleteSample.js new file mode 100644 index 000000000000..64d3144d00f9 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to delete a DiscoveredAsset + * + * @summary delete a DiscoveredAsset + * x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAsset.json + */ +async function deleteDiscoveredAsset() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.discoveredAssets.delete("myResourceGroup", "my-discoveredasset"); +} + +async function main() { + deleteDiscoveredAsset(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsGetSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsGetSample.js new file mode 100644 index 000000000000..fc36e5b5d9f5 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get a DiscoveredAsset + * + * @summary get a DiscoveredAsset + * x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAsset.json + */ +async function getDiscoveredAsset() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssets.get("myResourceGroup", "my-discoveredasset"); + console.log(result); +} + +async function main() { + getDiscoveredAsset(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsListByResourceGroupSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsListByResourceGroupSample.js new file mode 100644 index 000000000000..caaac050dbef --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsListByResourceGroupSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list DiscoveredAsset resources by resource group + * + * @summary list DiscoveredAsset resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_ResourceGroup.json + */ +async function listDiscoveredAssetsResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.discoveredAssets.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listDiscoveredAssetsResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsListBySubscriptionSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsListBySubscriptionSample.js new file mode 100644 index 000000000000..d33294eda4ef --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsListBySubscriptionSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list DiscoveredAsset resources by subscription ID + * + * @summary list DiscoveredAsset resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_Subscription.json + */ +async function listDiscoveredAssetsSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.discoveredAssets.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listDiscoveredAssetsSubscription(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsUpdateSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsUpdateSample.js new file mode 100644 index 000000000000..9cee40089185 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/discoveredAssetsUpdateSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to update a DiscoveredAsset + * + * @summary update a DiscoveredAsset + * x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAsset.json + */ +async function updateDiscoveredAsset() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssets.update("myResourceGroup", "my-discoveredasset", { + properties: { + documentationUri: "https://www.example.com/manual-2", + defaultTopic: { path: "/path/defaultTopic", retain: "Never" }, + }, + }); + console.log(result); +} + +async function main() { + updateDiscoveredAsset(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/operationStatusGetSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/operationStatusGetSample.js index cf6504429031..3a2b2b843b18 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/operationStatusGetSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/operationStatusGetSample.js @@ -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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); /** - * This sample demonstrates how to Returns the current status of an async operation. + * This sample demonstrates how to returns the current status of an async operation. * - * @summary Returns the current status of an async operation. - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_OperationStatus.json + * @summary returns the current status of an async operation. + * x-ms-original-file: 2024-09-01-preview/Get_OperationStatus.json */ -async function getTheStatusOfAnAsyncOperation() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const location = "testLocation"; - const operationId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; +async function getOperationStatus() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.operationStatus.get(location, operationId); + const result = await client.operationStatus.get( + "testLocation", + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + ); console.log(result); } async function main() { - getTheStatusOfAnAsyncOperation(); + getOperationStatus(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/operationsListSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/operationsListSample.js index 1f8dd777d263..9b3177c792af 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/operationsListSample.js +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/operationsListSample.js @@ -1,37 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); const { DefaultAzureCredential } = require("@azure/identity"); -require("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/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Operations.json + * @summary list the operations for the provider + * x-ms-original-file: 2024-09-01-preview/List_Operations.json */ -async function returnsListOfOperations() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; +async function listOperations() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); for await (let item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } async function main() { - returnsListOfOperations(); + listOperations(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/package.json b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/package.json index d863eaf7502a..e8c5480a8aa9 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/package.json +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/package.json @@ -2,7 +2,7 @@ "name": "@azure-samples/arm-deviceregistry-js-beta", "private": true, "version": "1.0.0", - "description": " client library samples for JavaScript (Beta)", + "description": "@azure/arm-deviceregistry client library samples for JavaScript (Beta)", "engines": { "node": ">=18.0.0" }, @@ -14,6 +14,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/sample.env b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/sample.env +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/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/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesCreateOrReplaceSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesCreateOrReplaceSample.js new file mode 100644 index 000000000000..c44a30117d8d --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesCreateOrReplaceSample.js @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to create a SchemaRegistry + * + * @summary create a SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/Create_SchemaRegistry.json + */ +async function createSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaRegistries.createOrReplace( + "myResourceGroup", + "my-schema-registry", + { + properties: { + namespace: "sr-namespace-001", + displayName: "Schema Registry namespace 001", + description: "This is a sample Schema Registry", + storageAccountContainerUrl: "my-blob-storage.blob.core.windows.net/my-container", + }, + tags: {}, + location: "West Europe", + identity: { type: "None" }, + }, + ); + console.log(result); +} + +async function main() { + createSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesDeleteSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesDeleteSample.js new file mode 100644 index 000000000000..13aaa83ad97f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to delete a SchemaRegistry + * + * @summary delete a SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/Delete_SchemaRegistry.json + */ +async function deleteSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.schemaRegistries.delete("myResourceGroup", "my-schema-registry"); +} + +async function main() { + deleteSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesGetSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesGetSample.js new file mode 100644 index 000000000000..5979c48eecf1 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get a SchemaRegistry + * + * @summary get a SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/Get_SchemaRegistry.json + */ +async function getSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaRegistries.get("myResourceGroup", "my-schema-registry"); + console.log(result); +} + +async function main() { + getSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesListByResourceGroupSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesListByResourceGroupSample.js new file mode 100644 index 000000000000..6e0aaf0caad9 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesListByResourceGroupSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list SchemaRegistry resources by resource group + * + * @summary list SchemaRegistry resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_ResourceGroup.json + */ +async function listSchemaRegistriesResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schemaRegistries.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listSchemaRegistriesResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesListBySubscriptionSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesListBySubscriptionSample.js new file mode 100644 index 000000000000..d03f9f223a68 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesListBySubscriptionSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list SchemaRegistry resources by subscription ID + * + * @summary list SchemaRegistry resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_Subscription.json + */ +async function listSchemaRegistriesSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schemaRegistries.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listSchemaRegistriesSubscription(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesUpdateSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesUpdateSample.js new file mode 100644 index 000000000000..db30bb882af1 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaRegistriesUpdateSample.js @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to update a SchemaRegistry + * + * @summary update a SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/Update_SchemaRegistry.json + */ +async function updateSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaRegistries.update("myResourceGroup", "my-schema-registry", { + properties: { + displayName: "Schema Registry namespace 001", + description: "This is a sample Schema Registry", + }, + tags: {}, + }); + console.log(result); +} + +async function main() { + updateSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsCreateOrReplaceSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsCreateOrReplaceSample.js new file mode 100644 index 000000000000..032d3c093e77 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsCreateOrReplaceSample.js @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to create a SchemaVersion + * + * @summary create a SchemaVersion + * x-ms-original-file: 2024-09-01-preview/Create_SchemaVersion.json + */ +async function createSchemaVersion() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaVersions.createOrReplace( + "myResourceGroup", + "my-schema-registry", + "my-schema", + "1", + { + properties: { + description: "Schema version 1", + schemaContent: + '{"$schema": "http://json-schema.org/draft-07/schema#","type": "object","properties": {"humidity": {"type": "string"},"temperature": {"type":"number"}}}', + }, + }, + ); + console.log(result); +} + +async function main() { + createSchemaVersion(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsDeleteSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsDeleteSample.js new file mode 100644 index 000000000000..e87630351b59 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to delete a SchemaVersion + * + * @summary delete a SchemaVersion + * x-ms-original-file: 2024-09-01-preview/Delete_SchemaVersion.json + */ +async function deleteSchemaVersion() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.schemaVersions.delete("myResourceGroup", "my-schema-registry", "my-schema", "1"); +} + +async function main() { + deleteSchemaVersion(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsGetSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsGetSample.js new file mode 100644 index 000000000000..91761d24c83f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsGetSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get a SchemaVersion + * + * @summary get a SchemaVersion + * x-ms-original-file: 2024-09-01-preview/Get_SchemaVersion.json + */ +async function getSchemaVersion() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaVersions.get( + "myResourceGroup", + "my-schema-registry", + "my-schema", + "1", + ); + console.log(result); +} + +async function main() { + getSchemaVersion(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsListBySchemaSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsListBySchemaSample.js new file mode 100644 index 000000000000..79767d288be2 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemaVersionsListBySchemaSample.js @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list SchemaVersion resources by Schema + * + * @summary list SchemaVersion resources by Schema + * x-ms-original-file: 2024-09-01-preview/List_SchemaVersions_Schema.json + */ +async function listSchemaVersionsSchema() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schemaVersions.listBySchema( + "myResourceGroup", + "my-schema-registry", + "my-schema", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listSchemaVersionsSchema(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasCreateOrReplaceSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasCreateOrReplaceSample.js new file mode 100644 index 000000000000..7763f32483fb --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasCreateOrReplaceSample.js @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to create a Schema + * + * @summary create a Schema + * x-ms-original-file: 2024-09-01-preview/Create_Schema.json + */ +async function createSchema() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemas.createOrReplace( + "myResourceGroup", + "my-schema-registry", + "my-schema", + { + properties: { + displayName: "My Schema", + description: "This is a sample Schema", + format: "JsonSchema/draft-07", + schemaType: "MessageSchema", + tags: { sampleKey: "sampleValue" }, + }, + }, + ); + console.log(result); +} + +async function main() { + createSchema(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasDeleteSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasDeleteSample.js new file mode 100644 index 000000000000..5daefd70f31d --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to delete a Schema + * + * @summary delete a Schema + * x-ms-original-file: 2024-09-01-preview/Delete_Schema.json + */ +async function deleteSchema() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.schemas.delete("myResourceGroup", "my-schema-registry", "my-schema"); +} + +async function main() { + deleteSchema(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasGetSample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasGetSample.js new file mode 100644 index 000000000000..e4bdf2bcc5e5 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get a Schema + * + * @summary get a Schema + * x-ms-original-file: 2024-09-01-preview/Get_Schema.json + */ +async function schemasGet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemas.get("myResourceGroup", "my-schema-registry", "my-schema"); + console.log(result); +} + +async function main() { + schemasGet(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasListBySchemaRegistrySample.js b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasListBySchemaRegistrySample.js new file mode 100644 index 000000000000..a2e435a6aa8a --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/schemasListBySchemaRegistrySample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list Schema resources by SchemaRegistry + * + * @summary list Schema resources by SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/List_Schemas_SchemaRegistry.json + */ +async function listSchemasSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schemas.listBySchemaRegistry( + "myResourceGroup", + "my-schema-registry", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listSchemasSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/README.md b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/README.md index 4b3cf2b4ea77..2ce172c2d87a 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/README.md +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/README.md @@ -1,23 +1,51 @@ -# client library samples for TypeScript (Beta) - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| --------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [assetEndpointProfilesCreateOrReplaceSample.ts][assetendpointprofilescreateorreplacesample] | Create a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_AssetEndpointProfile.json | -| [assetEndpointProfilesDeleteSample.ts][assetendpointprofilesdeletesample] | Delete a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_AssetEndpointProfile.json | -| [assetEndpointProfilesGetSample.ts][assetendpointprofilesgetsample] | Get a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json | -| [assetEndpointProfilesListByResourceGroupSample.ts][assetendpointprofileslistbyresourcegroupsample] | List AssetEndpointProfile resources by resource group x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_ResourceGroup.json | -| [assetEndpointProfilesListBySubscriptionSample.ts][assetendpointprofileslistbysubscriptionsample] | List AssetEndpointProfile resources by subscription ID x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_Subscription.json | -| [assetEndpointProfilesUpdateSample.ts][assetendpointprofilesupdatesample] | Update a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json | -| [assetsCreateOrReplaceSample.ts][assetscreateorreplacesample] | Create a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_With_ExternalAssetId.json | -| [assetsDeleteSample.ts][assetsdeletesample] | Delete a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_Asset.json | -| [assetsGetSample.ts][assetsgetsample] | Get a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json | -| [assetsListByResourceGroupSample.ts][assetslistbyresourcegroupsample] | List Asset resources by resource group x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_ResourceGroup.json | -| [assetsListBySubscriptionSample.ts][assetslistbysubscriptionsample] | List Asset resources by subscription ID x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_Subscription.json | -| [assetsUpdateSample.ts][assetsupdatesample] | Update a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json | -| [operationStatusGetSample.ts][operationstatusgetsample] | Returns the current status of an async operation. x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_OperationStatus.json | -| [operationsListSample.ts][operationslistsample] | List the operations for the provider x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Operations.json | +# @azure/arm-deviceregistry client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for @azure/arm-deviceregistry in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [assetEndpointProfilesCreateOrReplaceSample.ts][assetendpointprofilescreateorreplacesample] | create a AssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile.json | +| [assetEndpointProfilesDeleteSample.ts][assetendpointprofilesdeletesample] | delete a AssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Delete_AssetEndpointProfile.json | +| [assetEndpointProfilesGetSample.ts][assetendpointprofilesgetsample] | get a AssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile.json | +| [assetEndpointProfilesListByResourceGroupSample.ts][assetendpointprofileslistbyresourcegroupsample] | list AssetEndpointProfile resources by resource group x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_ResourceGroup.json | +| [assetEndpointProfilesListBySubscriptionSample.ts][assetendpointprofileslistbysubscriptionsample] | list AssetEndpointProfile resources by subscription ID x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_Subscription.json | +| [assetEndpointProfilesUpdateSample.ts][assetendpointprofilesupdatesample] | update a AssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Update_AssetEndpointProfile.json | +| [assetsCreateOrReplaceSample.ts][assetscreateorreplacesample] | create a Asset x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_DisplayName.json | +| [assetsDeleteSample.ts][assetsdeletesample] | delete a Asset x-ms-original-file: 2024-09-01-preview/Delete_Asset.json | +| [assetsGetSample.ts][assetsgetsample] | get a Asset x-ms-original-file: 2024-09-01-preview/Get_Asset.json | +| [assetsListByResourceGroupSample.ts][assetslistbyresourcegroupsample] | list Asset resources by resource group x-ms-original-file: 2024-09-01-preview/List_Assets_ResourceGroup.json | +| [assetsListBySubscriptionSample.ts][assetslistbysubscriptionsample] | list Asset resources by subscription ID x-ms-original-file: 2024-09-01-preview/List_Assets_Subscription.json | +| [assetsUpdateSample.ts][assetsupdatesample] | update a Asset x-ms-original-file: 2024-09-01-preview/Update_Asset.json | +| [billingContainersGetSample.ts][billingcontainersgetsample] | get a BillingContainer x-ms-original-file: 2024-09-01-preview/Get_BillingContainer.json | +| [billingContainersListBySubscriptionSample.ts][billingcontainerslistbysubscriptionsample] | list BillingContainer resources by subscription ID x-ms-original-file: 2024-09-01-preview/List_BillingContainers_Subscription.json | +| [discoveredAssetEndpointProfilesCreateOrReplaceSample.ts][discoveredassetendpointprofilescreateorreplacesample] | create a DiscoveredAssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAssetEndpointProfile.json | +| [discoveredAssetEndpointProfilesDeleteSample.ts][discoveredassetendpointprofilesdeletesample] | delete a DiscoveredAssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAssetEndpointProfile.json | +| [discoveredAssetEndpointProfilesGetSample.ts][discoveredassetendpointprofilesgetsample] | get a DiscoveredAssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAssetEndpointProfile.json | +| [discoveredAssetEndpointProfilesListByResourceGroupSample.ts][discoveredassetendpointprofileslistbyresourcegroupsample] | list DiscoveredAssetEndpointProfile resources by resource group x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_ResourceGroup.json | +| [discoveredAssetEndpointProfilesListBySubscriptionSample.ts][discoveredassetendpointprofileslistbysubscriptionsample] | list DiscoveredAssetEndpointProfile resources by subscription ID x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_Subscription.json | +| [discoveredAssetEndpointProfilesUpdateSample.ts][discoveredassetendpointprofilesupdatesample] | update a DiscoveredAssetEndpointProfile x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAssetEndpointProfile.json | +| [discoveredAssetsCreateOrReplaceSample.ts][discoveredassetscreateorreplacesample] | create a DiscoveredAsset x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAsset.json | +| [discoveredAssetsDeleteSample.ts][discoveredassetsdeletesample] | delete a DiscoveredAsset x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAsset.json | +| [discoveredAssetsGetSample.ts][discoveredassetsgetsample] | get a DiscoveredAsset x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAsset.json | +| [discoveredAssetsListByResourceGroupSample.ts][discoveredassetslistbyresourcegroupsample] | list DiscoveredAsset resources by resource group x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_ResourceGroup.json | +| [discoveredAssetsListBySubscriptionSample.ts][discoveredassetslistbysubscriptionsample] | list DiscoveredAsset resources by subscription ID x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_Subscription.json | +| [discoveredAssetsUpdateSample.ts][discoveredassetsupdatesample] | update a DiscoveredAsset x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAsset.json | +| [operationStatusGetSample.ts][operationstatusgetsample] | returns the current status of an async operation. x-ms-original-file: 2024-09-01-preview/Get_OperationStatus.json | +| [operationsListSample.ts][operationslistsample] | list the operations for the provider x-ms-original-file: 2024-09-01-preview/List_Operations.json | +| [schemaRegistriesCreateOrReplaceSample.ts][schemaregistriescreateorreplacesample] | create a SchemaRegistry x-ms-original-file: 2024-09-01-preview/Create_SchemaRegistry.json | +| [schemaRegistriesDeleteSample.ts][schemaregistriesdeletesample] | delete a SchemaRegistry x-ms-original-file: 2024-09-01-preview/Delete_SchemaRegistry.json | +| [schemaRegistriesGetSample.ts][schemaregistriesgetsample] | get a SchemaRegistry x-ms-original-file: 2024-09-01-preview/Get_SchemaRegistry.json | +| [schemaRegistriesListByResourceGroupSample.ts][schemaregistrieslistbyresourcegroupsample] | list SchemaRegistry resources by resource group x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_ResourceGroup.json | +| [schemaRegistriesListBySubscriptionSample.ts][schemaregistrieslistbysubscriptionsample] | list SchemaRegistry resources by subscription ID x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_Subscription.json | +| [schemaRegistriesUpdateSample.ts][schemaregistriesupdatesample] | update a SchemaRegistry x-ms-original-file: 2024-09-01-preview/Update_SchemaRegistry.json | +| [schemaVersionsCreateOrReplaceSample.ts][schemaversionscreateorreplacesample] | create a SchemaVersion x-ms-original-file: 2024-09-01-preview/Create_SchemaVersion.json | +| [schemaVersionsDeleteSample.ts][schemaversionsdeletesample] | delete a SchemaVersion x-ms-original-file: 2024-09-01-preview/Delete_SchemaVersion.json | +| [schemaVersionsGetSample.ts][schemaversionsgetsample] | get a SchemaVersion x-ms-original-file: 2024-09-01-preview/Get_SchemaVersion.json | +| [schemaVersionsListBySchemaSample.ts][schemaversionslistbyschemasample] | list SchemaVersion resources by Schema x-ms-original-file: 2024-09-01-preview/List_SchemaVersions_Schema.json | +| [schemasCreateOrReplaceSample.ts][schemascreateorreplacesample] | create a Schema x-ms-original-file: 2024-09-01-preview/Create_Schema.json | +| [schemasDeleteSample.ts][schemasdeletesample] | delete a Schema x-ms-original-file: 2024-09-01-preview/Delete_Schema.json | +| [schemasGetSample.ts][schemasgetsample] | get a Schema x-ms-original-file: 2024-09-01-preview/Get_Schema.json | +| [schemasListBySchemaRegistrySample.ts][schemaslistbyschemaregistrysample] | list Schema resources by SchemaRegistry x-ms-original-file: 2024-09-01-preview/List_Schemas_SchemaRegistry.json | ## Prerequisites @@ -62,7 +90,7 @@ node dist/assetEndpointProfilesCreateOrReplaceSample.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 DEVICEREGISTRY_SUBSCRIPTION_ID="" DEVICEREGISTRY_RESOURCE_GROUP="" node dist/assetEndpointProfilesCreateOrReplaceSample.js +npx dev-tool run vendored cross-env node dist/assetEndpointProfilesCreateOrReplaceSample.js ``` ## Next Steps @@ -81,8 +109,36 @@ Take a look at our [API Documentation][apiref] for more information about the AP [assetslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsListByResourceGroupSample.ts [assetslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsListBySubscriptionSample.ts [assetsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsUpdateSample.ts +[billingcontainersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/billingContainersGetSample.ts +[billingcontainerslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/billingContainersListBySubscriptionSample.ts +[discoveredassetendpointprofilescreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesCreateOrReplaceSample.ts +[discoveredassetendpointprofilesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesDeleteSample.ts +[discoveredassetendpointprofilesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesGetSample.ts +[discoveredassetendpointprofileslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesListByResourceGroupSample.ts +[discoveredassetendpointprofileslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesListBySubscriptionSample.ts +[discoveredassetendpointprofilesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesUpdateSample.ts +[discoveredassetscreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsCreateOrReplaceSample.ts +[discoveredassetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsDeleteSample.ts +[discoveredassetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsGetSample.ts +[discoveredassetslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsListByResourceGroupSample.ts +[discoveredassetslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsListBySubscriptionSample.ts +[discoveredassetsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsUpdateSample.ts [operationstatusgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/operationStatusGetSample.ts [operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/operationsListSample.ts +[schemaregistriescreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesCreateOrReplaceSample.ts +[schemaregistriesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesDeleteSample.ts +[schemaregistriesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesGetSample.ts +[schemaregistrieslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesListByResourceGroupSample.ts +[schemaregistrieslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesListBySubscriptionSample.ts +[schemaregistriesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesUpdateSample.ts +[schemaversionscreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsCreateOrReplaceSample.ts +[schemaversionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsDeleteSample.ts +[schemaversionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsGetSample.ts +[schemaversionslistbyschemasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsListBySchemaSample.ts +[schemascreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasCreateOrReplaceSample.ts +[schemasdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasDeleteSample.ts +[schemasgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasGetSample.ts +[schemaslistbyschemaregistrysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasListBySchemaRegistrySample.ts [apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-deviceregistry?view=azure-node-preview [freesub]: https://azure.microsoft.com/free/ [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceregistry/arm-deviceregistry/README.md diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/package.json b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/package.json index 5b4de3351c5a..c0f6b5eb574a 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/package.json +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/package.json @@ -2,7 +2,7 @@ "name": "@azure-samples/arm-deviceregistry-ts-beta", "private": true, "version": "1.0.0", - "description": " client library samples for TypeScript (Beta)", + "description": "@azure/arm-deviceregistry client library samples for TypeScript (Beta)", "engines": { "node": ">=18.0.0" }, @@ -18,6 +18,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/sample.env b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/sample.env +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/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/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesCreateOrReplaceSample.ts index 1197ba9e9f47..e227fded3b47 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesCreateOrReplaceSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesCreateOrReplaceSample.ts @@ -1,59 +1,73 @@ -/* - * 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 { - AssetEndpointProfile, - DeviceRegistryManagementClient, -} from "@azure/arm-deviceregistry"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to Create a AssetEndpointProfile + * This sample demonstrates how to create a AssetEndpointProfile * - * @summary Create a AssetEndpointProfile - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_AssetEndpointProfile.json + * @summary create a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile.json */ -async function createAnAssetEndpointProfile() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetEndpointProfileName = "my-assetendpointprofile"; - const resource: AssetEndpointProfile = { - extendedLocation: { - name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", - type: "CustomLocation", - }, - location: "West Europe", - properties: { - targetAddress: "https://www.example.com/myTargetAddress", - userAuthentication: { mode: "Anonymous" }, +async function createAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assetEndpointProfiles.createOrReplace( + "myResourceGroup", + "my-assetendpointprofile", + { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + targetAddress: "https://www.example.com/myTargetAddress", + endpointProfileType: "myEndpointProfileType", + authentication: { method: "Anonymous" }, + }, }, - tags: { site: "building-1" }, - }; + ); + console.log(result); +} + +/** + * This sample demonstrates how to create a AssetEndpointProfile + * + * @summary create a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile_With_DiscoveredAepRef.json + */ +async function createAssetEndpointProfileWithDiscoveredAepRef() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assetEndpointProfiles.beginCreateOrReplaceAndWait( - resourceGroupName, - assetEndpointProfileName, - resource, + const result = await client.assetEndpointProfiles.createOrReplace( + "myResourceGroup", + "my-assetendpointprofile", + { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + targetAddress: "https://www.example.com/myTargetAddress", + endpointProfileType: "myEndpointProfileType", + discoveredAssetEndpointProfileRef: "discoveredAssetEndpointProfile1", + authentication: { method: "Anonymous" }, + }, + }, ); console.log(result); } async function main() { - createAnAssetEndpointProfile(); + createAssetEndpointProfile(); + createAssetEndpointProfileWithDiscoveredAepRef(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesDeleteSample.ts index 3f2ea9fa342a..ede7746b3e31 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesDeleteSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesDeleteSample.ts @@ -1,43 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to Delete a AssetEndpointProfile + * This sample demonstrates how to delete a AssetEndpointProfile * - * @summary Delete a AssetEndpointProfile - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_AssetEndpointProfile.json + * @summary delete a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Delete_AssetEndpointProfile.json */ -async function deleteAnAssetEndpointProfile() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetEndpointProfileName = "my-assetendpointprofile"; +async function deleteAssetEndpointProfile() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assetEndpointProfiles.beginDeleteAndWait( - resourceGroupName, - assetEndpointProfileName, - ); - console.log(result); + await client.assetEndpointProfiles.delete("myResourceGroup", "my-assetendpointprofile"); } async function main() { - deleteAnAssetEndpointProfile(); + deleteAssetEndpointProfile(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesGetSample.ts index 407685d90fab..9482215dc4c3 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesGetSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesGetSample.ts @@ -1,43 +1,46 @@ -/* - * 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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +/** + * This sample demonstrates how to get a AssetEndpointProfile + * + * @summary get a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile.json + */ +async function getAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assetEndpointProfiles.get( + "myResourceGroup", + "my-assetendpointprofile", + ); + console.log(result); +} /** - * This sample demonstrates how to Get a AssetEndpointProfile + * This sample demonstrates how to get a AssetEndpointProfile * - * @summary Get a AssetEndpointProfile - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json + * @summary get a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile_With_SyncStatus.json */ -async function getAnAssetEndpointProfile() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetEndpointProfileName = "my-assetendpointprofile"; +async function getAssetEndpointProfileWithSyncStatus() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const result = await client.assetEndpointProfiles.get( - resourceGroupName, - assetEndpointProfileName, + "myResourceGroup", + "my-assetendpointprofile", ); console.log(result); } async function main() { - getAnAssetEndpointProfile(); + getAssetEndpointProfile(); + getAssetEndpointProfileWithSyncStatus(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesListByResourceGroupSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesListByResourceGroupSample.ts index 14413102b08f..2230794efd42 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesListByResourceGroupSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesListByResourceGroupSample.ts @@ -1,44 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to List AssetEndpointProfile resources by resource group + * This sample demonstrates how to list AssetEndpointProfile resources by resource group * - * @summary List AssetEndpointProfile resources by resource group - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_ResourceGroup.json + * @summary list AssetEndpointProfile resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_ResourceGroup.json */ -async function listAssetEndpointProfilesInAResourceGroup() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; +async function listAssetEndpointProfilesResourceGroup() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.assetEndpointProfiles.listByResourceGroup( - resourceGroupName, - )) { + for await (let item of client.assetEndpointProfiles.listByResourceGroup("myResourceGroup")) { resArray.push(item); } + console.log(resArray); } async function main() { - listAssetEndpointProfilesInAResourceGroup(); + listAssetEndpointProfilesResourceGroup(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesListBySubscriptionSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesListBySubscriptionSample.ts index 83e5236f301a..00f8a5204e2d 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesListBySubscriptionSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesListBySubscriptionSample.ts @@ -1,40 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to List AssetEndpointProfile resources by subscription ID + * This sample demonstrates how to list AssetEndpointProfile resources by subscription ID * - * @summary List AssetEndpointProfile resources by subscription ID - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_Subscription.json + * @summary list AssetEndpointProfile resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_Subscription.json */ -async function listAssetEndpointProfilesInASubscription() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; +async function listAssetEndpointProfilesSubscription() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); for await (let item of client.assetEndpointProfiles.listBySubscription()) { resArray.push(item); } + console.log(resArray); } async function main() { - listAssetEndpointProfilesInASubscription(); + listAssetEndpointProfilesSubscription(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesUpdateSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesUpdateSample.ts index 409b09e06b37..eac50c7e76c5 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesUpdateSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesUpdateSample.ts @@ -1,50 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - AssetEndpointProfileUpdate, - DeviceRegistryManagementClient, -} from "@azure/arm-deviceregistry"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to Update a AssetEndpointProfile + * This sample demonstrates how to update a AssetEndpointProfile * - * @summary Update a AssetEndpointProfile - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json + * @summary update a AssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Update_AssetEndpointProfile.json */ -async function patchAnAssetEndpointProfile() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetEndpointProfileName = "my-assetendpointprofile"; - const properties: AssetEndpointProfileUpdate = { - properties: { targetAddress: "https://www.example.com/myTargetAddress" }, - }; +async function updateAssetEndpointProfile() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assetEndpointProfiles.beginUpdateAndWait( - resourceGroupName, - assetEndpointProfileName, - properties, + const result = await client.assetEndpointProfiles.update( + "myResourceGroup", + "my-assetendpointprofile", + { + properties: { targetAddress: "https://www.example.com/myTargetAddress" }, + }, ); console.log(result); } async function main() { - patchAnAssetEndpointProfile(); + updateAssetEndpointProfile(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsCreateOrReplaceSample.ts index 407f10ef31a8..92c1be902948 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsCreateOrReplaceSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsCreateOrReplaceSample.ts @@ -1,273 +1,317 @@ -/* - * 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 { - Asset, - DeviceRegistryManagementClient, -} from "@azure/arm-deviceregistry"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to Create a Asset + * This sample demonstrates how to create a Asset * - * @summary Create a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_With_ExternalAssetId.json + * @summary create a Asset + * x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_DisplayName.json */ -async function createAnAssetWithExternalAssetId() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; - const resource: Asset = { +async function createAssetWithoutDisplayName() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assets.createOrReplace("myResourceGroup", "my-asset", { + location: "West Europe", extendedLocation: { - name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", }, - location: "West Europe", + tags: { site: "building-1" }, properties: { + enabled: true, + externalAssetId: "8ZBA6LRHU0A458969", description: "This is a sample Asset", - assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile", - assetType: "MyAssetType", - dataPoints: [ - { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - dataPointConfiguration: - '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", - observabilityMode: "counter", - }, + assetEndpointProfileRef: "myAssetEndpointProfile", + manufacturer: "Contoso", + manufacturerUri: "https://www.contoso.com/manufacturerUri", + model: "ContosoModel", + productCode: "SA34VDG", + hardwareRevision: "1.0", + softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - dataPointConfiguration: - '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", - observabilityMode: "none", + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + observabilityMode: "Counter", + dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + observabilityMode: "None", + dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], }, ], - defaultDataPointsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - defaultEventsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - displayName: "AssetDisplayName", - documentationUri: "https://www.example.com/manual", - enabled: true, events: [ { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - eventConfiguration: - '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + name: "event1", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", - observabilityMode: "none", + observabilityMode: "None", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, }, { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - eventConfiguration: - '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + name: "event2", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", - observabilityMode: "log", + observabilityMode: "Log", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', }, ], - externalAssetId: "8ZBA6LRHU0A458969", - hardwareRevision: "1.0", - manufacturer: "Contoso", - manufacturerUri: "https://www.contoso.com/manufacturerUri", - model: "ContosoModel", - productCode: "SA34VDG", - serialNumber: "64-103816-519918-8", - softwareRevision: "2.0", }, - tags: { site: "building-1" }, - }; - const credential = new DefaultAzureCredential(); - const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginCreateOrReplaceAndWait( - resourceGroupName, - assetName, - resource, - ); + }); console.log(result); } /** - * This sample demonstrates how to Create a Asset + * This sample demonstrates how to create a Asset * - * @summary Create a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_DisplayName.json + * @summary create a Asset + * x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_ExternalAssetId.json */ -async function createAnAssetWithoutDisplayName() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; - const resource: Asset = { +async function createAssetWithoutExternalAssetId() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assets.createOrReplace("myResourceGroup", "my-asset", { + location: "West Europe", extendedLocation: { - name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", }, - location: "West Europe", + tags: { site: "building-1" }, properties: { + enabled: true, + displayName: "AssetDisplayName", description: "This is a sample Asset", - assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile", - assetType: "MyAssetType", - dataPoints: [ - { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - dataPointConfiguration: - '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", - observabilityMode: "counter", - }, + assetEndpointProfileRef: "myAssetEndpointProfile", + manufacturer: "Contoso", + manufacturerUri: "https://www.contoso.com/manufacturerUri", + model: "ContosoModel", + productCode: "SA34VDG", + hardwareRevision: "1.0", + softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - dataPointConfiguration: - '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", - observabilityMode: "none", + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + observabilityMode: "Counter", + dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + observabilityMode: "None", + dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], }, ], - defaultDataPointsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - defaultEventsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - documentationUri: "https://www.example.com/manual", - enabled: true, events: [ { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - eventConfiguration: - '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + name: "event1", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", - observabilityMode: "none", + observabilityMode: "None", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, }, { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - eventConfiguration: - '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + name: "event2", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", - observabilityMode: "log", + observabilityMode: "Log", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', }, ], + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to create a Asset + * + * @summary create a Asset + * x-ms-original-file: 2024-09-01-preview/Create_Asset_With_DiscoveredAssetRef.json + */ +async function createAssetWithDiscoveredAssetRefs() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assets.createOrReplace("myResourceGroup", "my-asset", { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + enabled: true, externalAssetId: "8ZBA6LRHU0A458969", - hardwareRevision: "1.0", + displayName: "AssetDisplayName", + description: "This is a sample Asset", + assetEndpointProfileRef: "myAssetEndpointProfile", manufacturer: "Contoso", manufacturerUri: "https://www.contoso.com/manufacturerUri", model: "ContosoModel", productCode: "SA34VDG", - serialNumber: "64-103816-519918-8", + hardwareRevision: "1.0", softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + discoveredAssetRefs: ["discoveredAsset1", "discoveredAsset2"], + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ + { + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + observabilityMode: "Counter", + dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + observabilityMode: "None", + dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], + }, + ], + events: [ + { + name: "event1", + eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", + observabilityMode: "None", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, + }, + { + name: "event2", + eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", + observabilityMode: "Log", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + }, + ], }, - tags: { site: "building-1" }, - }; - const credential = new DefaultAzureCredential(); - const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginCreateOrReplaceAndWait( - resourceGroupName, - assetName, - resource, - ); + }); console.log(result); } /** - * This sample demonstrates how to Create a Asset + * This sample demonstrates how to create a Asset * - * @summary Create a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_ExternalAssetId.json + * @summary create a Asset + * x-ms-original-file: 2024-09-01-preview/Create_Asset_With_ExternalAssetId.json */ -async function createAnAssetWithoutExternalAssetId() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; - const resource: Asset = { +async function createAssetWithExternalAssetId() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.assets.createOrReplace("myResourceGroup", "my-asset", { + location: "West Europe", extendedLocation: { - name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", }, - location: "West Europe", + tags: { site: "building-1" }, properties: { + enabled: true, + externalAssetId: "8ZBA6LRHU0A458969", + displayName: "AssetDisplayName", description: "This is a sample Asset", - assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile", - assetType: "MyAssetType", - dataPoints: [ - { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - dataPointConfiguration: - '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", - observabilityMode: "counter", - }, + assetEndpointProfileRef: "myAssetEndpointProfile", + manufacturer: "Contoso", + manufacturerUri: "https://www.contoso.com/manufacturerUri", + model: "ContosoModel", + productCode: "SA34VDG", + hardwareRevision: "1.0", + softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - dataPointConfiguration: - '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', - dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", - observabilityMode: "none", + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + observabilityMode: "Counter", + dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + observabilityMode: "None", + dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], }, ], - defaultDataPointsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - defaultEventsConfiguration: - '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', - displayName: "AssetDisplayName", - documentationUri: "https://www.example.com/manual", - enabled: true, events: [ { - capabilityId: "dtmi:com:example:Thermostat:__temperature;1", - eventConfiguration: - '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + name: "event1", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", - observabilityMode: "none", + observabilityMode: "None", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, }, { - capabilityId: "dtmi:com:example:Thermostat:__pressure;1", - eventConfiguration: - '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + name: "event2", eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", - observabilityMode: "log", + observabilityMode: "Log", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', }, ], - hardwareRevision: "1.0", - manufacturer: "Contoso", - manufacturerUri: "https://www.contoso.com/manufacturerUri", - model: "ContosoModel", - productCode: "SA34VDG", - serialNumber: "64-103816-519918-8", - softwareRevision: "2.0", }, - tags: { site: "building-1" }, - }; - const credential = new DefaultAzureCredential(); - const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginCreateOrReplaceAndWait( - resourceGroupName, - assetName, - resource, - ); + }); console.log(result); } async function main() { - createAnAssetWithExternalAssetId(); - createAnAssetWithoutDisplayName(); - createAnAssetWithoutExternalAssetId(); + createAssetWithoutDisplayName(); + createAssetWithoutExternalAssetId(); + createAssetWithDiscoveredAssetRefs(); + createAssetWithExternalAssetId(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsDeleteSample.ts index 0d62e48d59bb..f302477cced6 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsDeleteSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsDeleteSample.ts @@ -1,43 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to Delete a Asset + * This sample demonstrates how to delete a Asset * - * @summary Delete a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_Asset.json + * @summary delete a Asset + * x-ms-original-file: 2024-09-01-preview/Delete_Asset.json */ -async function deleteAnAsset() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; +async function deleteAsset() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginDeleteAndWait( - resourceGroupName, - assetName, - ); - console.log(result); + await client.assets.delete("myResourceGroup", "my-asset"); } async function main() { - deleteAnAsset(); + deleteAsset(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsGetSample.ts index c341d40c0391..c685134701e6 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsGetSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsGetSample.ts @@ -1,60 +1,40 @@ -/* - * 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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to Get a Asset + * This sample demonstrates how to get a Asset * - * @summary Get a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json + * @summary get a Asset + * x-ms-original-file: 2024-09-01-preview/Get_Asset.json */ -async function getAnAsset() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; +async function getAsset() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.get(resourceGroupName, assetName); + const result = await client.assets.get("myResourceGroup", "my-asset"); console.log(result); } /** - * This sample demonstrates how to Get a Asset + * This sample demonstrates how to get a Asset * - * @summary Get a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset_With_SyncStatus.json + * @summary get a Asset + * x-ms-original-file: 2024-09-01-preview/Get_Asset_With_SyncStatus.json */ -async function getAnAssetWithSyncStatus() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; +async function getAssetWithSyncStatus() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.get(resourceGroupName, assetName); + const result = await client.assets.get("myResourceGroup", "my-asset"); console.log(result); } async function main() { - getAnAsset(); - getAnAssetWithSyncStatus(); + getAsset(); + getAssetWithSyncStatus(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsListByResourceGroupSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsListByResourceGroupSample.ts index 8d358c701a19..9d566ed9eab1 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsListByResourceGroupSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsListByResourceGroupSample.ts @@ -1,42 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to List Asset resources by resource group + * This sample demonstrates how to list Asset resources by resource group * - * @summary List Asset resources by resource group - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_ResourceGroup.json + * @summary list Asset resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_Assets_ResourceGroup.json */ -async function listAssetsInAResourceGroup() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; +async function listAssetsResourceGroup() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.assets.listByResourceGroup(resourceGroupName)) { + for await (let item of client.assets.listByResourceGroup("myResourceGroup")) { resArray.push(item); } + console.log(resArray); } async function main() { - listAssetsInAResourceGroup(); + listAssetsResourceGroup(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsListBySubscriptionSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsListBySubscriptionSample.ts index 078c4c0cbcf7..75b639ef299e 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsListBySubscriptionSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsListBySubscriptionSample.ts @@ -1,40 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to List Asset resources by subscription ID + * This sample demonstrates how to list Asset resources by subscription ID * - * @summary List Asset resources by subscription ID - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_Subscription.json + * @summary list Asset resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_Assets_Subscription.json */ -async function listAssetsInASubscription() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; +async function listAssetsSubscription() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); for await (let item of client.assets.listBySubscription()) { resArray.push(item); } + console.log(resArray); } async function main() { - listAssetsInASubscription(); + listAssetsSubscription(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsUpdateSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsUpdateSample.ts index 9a752eec406e..4ef904672419 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsUpdateSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsUpdateSample.ts @@ -1,50 +1,27 @@ -/* - * 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 { - AssetUpdate, - DeviceRegistryManagementClient, -} from "@azure/arm-deviceregistry"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to Update a Asset + * This sample demonstrates how to update a Asset * - * @summary Update a Asset - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json + * @summary update a Asset + * x-ms-original-file: 2024-09-01-preview/Update_Asset.json */ -async function patchAnAsset() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup"; - const assetName = "my-asset"; - const properties: AssetUpdate = { - properties: { displayName: "NewAssetDisplayName", enabled: false }, - }; +async function updateAsset() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.assets.beginUpdateAndWait( - resourceGroupName, - assetName, - properties, - ); + const result = await client.assets.update("myResourceGroup", "my-asset", { + properties: { enabled: false, displayName: "NewAssetDisplayName" }, + }); console.log(result); } async function main() { - patchAnAsset(); + updateAsset(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/billingContainersGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/billingContainersGetSample.ts new file mode 100644 index 000000000000..efe39790bb6f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/billingContainersGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a BillingContainer + * + * @summary get a BillingContainer + * x-ms-original-file: 2024-09-01-preview/Get_BillingContainer.json + */ +async function getBillingContainer() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.billingContainers.get("my-billingContainer"); + console.log(result); +} + +async function main() { + getBillingContainer(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/billingContainersListBySubscriptionSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/billingContainersListBySubscriptionSample.ts new file mode 100644 index 000000000000..1d4acb1d43d2 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/billingContainersListBySubscriptionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list BillingContainer resources by subscription ID + * + * @summary list BillingContainer resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_BillingContainers_Subscription.json + */ +async function listBillingContainersSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.billingContainers.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listBillingContainersSubscription(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesCreateOrReplaceSample.ts new file mode 100644 index 000000000000..5bbe2710dd6f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesCreateOrReplaceSample.ts @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a DiscoveredAssetEndpointProfile + * + * @summary create a DiscoveredAssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAssetEndpointProfile.json + */ +async function createDiscoveredAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssetEndpointProfiles.createOrReplace( + "myResourceGroup", + "my-discoveredassetendpointprofile", + { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + targetAddress: "https://www.example.com/myTargetAddress", + additionalConfiguration: '{"foo": "bar"}', + discoveryId: "11111111-1111-1111-1111-111111111111", + version: 73766, + endpointProfileType: "myEndpointProfileType", + supportedAuthenticationMethods: ["Anonymous", "Certificate", "UsernamePassword"], + }, + }, + ); + console.log(result); +} + +async function main() { + createDiscoveredAssetEndpointProfile(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesDeleteSample.ts new file mode 100644 index 000000000000..c10a87be60fe --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesDeleteSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a DiscoveredAssetEndpointProfile + * + * @summary delete a DiscoveredAssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAssetEndpointProfile.json + */ +async function deleteDiscoveredAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.discoveredAssetEndpointProfiles.delete( + "myResourceGroup", + "my-discoveredassetendpointprofile", + ); +} + +async function main() { + deleteDiscoveredAssetEndpointProfile(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesGetSample.ts new file mode 100644 index 000000000000..6d661f7023d4 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesGetSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a DiscoveredAssetEndpointProfile + * + * @summary get a DiscoveredAssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAssetEndpointProfile.json + */ +async function getDiscoveredAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssetEndpointProfiles.get( + "myResourceGroup", + "my-discoveredassetendpointprofile", + ); + console.log(result); +} + +async function main() { + getDiscoveredAssetEndpointProfile(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesListByResourceGroupSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesListByResourceGroupSample.ts new file mode 100644 index 000000000000..3d9ad21b61d3 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesListByResourceGroupSample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list DiscoveredAssetEndpointProfile resources by resource group + * + * @summary list DiscoveredAssetEndpointProfile resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_ResourceGroup.json + */ +async function listDiscoveredAssetEndpointProfilesResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.discoveredAssetEndpointProfiles.listByResourceGroup( + "myResourceGroup", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listDiscoveredAssetEndpointProfilesResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesListBySubscriptionSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesListBySubscriptionSample.ts new file mode 100644 index 000000000000..623bbae63b2f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesListBySubscriptionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list DiscoveredAssetEndpointProfile resources by subscription ID + * + * @summary list DiscoveredAssetEndpointProfile resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_Subscription.json + */ +async function listDiscoveredAssetEndpointProfilesSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.discoveredAssetEndpointProfiles.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listDiscoveredAssetEndpointProfilesSubscription(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesUpdateSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesUpdateSample.ts new file mode 100644 index 000000000000..2a4301998470 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetEndpointProfilesUpdateSample.ts @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a DiscoveredAssetEndpointProfile + * + * @summary update a DiscoveredAssetEndpointProfile + * x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAssetEndpointProfile.json + */ +async function updateDiscoveredAssetEndpointProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssetEndpointProfiles.update( + "myResourceGroup", + "my-discoveredassetendpointprofile", + { + properties: { + targetAddress: "https://www.example.com/myTargetAddress", + additionalConfiguration: '{"foo": "bar"}', + discoveryId: "11111111-1111-1111-1111-111111111111", + version: 73766, + endpointProfileType: "myEndpointProfileType", + supportedAuthenticationMethods: ["Anonymous", "Certificate"], + }, + }, + ); + console.log(result); +} + +async function main() { + updateDiscoveredAssetEndpointProfile(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsCreateOrReplaceSample.ts new file mode 100644 index 000000000000..708945264822 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsCreateOrReplaceSample.ts @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a DiscoveredAsset + * + * @summary create a DiscoveredAsset + * x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAsset.json + */ +async function createDiscoveredAsset() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssets.createOrReplace( + "myResourceGroup", + "my-discoveredasset", + { + location: "West Europe", + extendedLocation: { + type: "CustomLocation", + name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1", + }, + tags: { site: "building-1" }, + properties: { + assetEndpointProfileRef: "myAssetEndpointProfile", + discoveryId: "11111111-1111-1111-1111-111111111111", + version: 73766, + manufacturer: "Contoso", + manufacturerUri: "https://www.contoso.com/manufacturerUri", + model: "ContosoModel", + productCode: "SA34VDG", + hardwareRevision: "1.0", + softwareRevision: "2.0", + documentationUri: "https://www.example.com/manual", + serialNumber: "64-103816-519918-8", + defaultDatasetsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultEventsConfiguration: + '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + defaultTopic: { path: "/path/defaultTopic", retain: "Keep" }, + datasets: [ + { + name: "dataset1", + datasetConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}', + topic: { path: "/path/dataset1", retain: "Keep" }, + dataPoints: [ + { + name: "dataPoint1", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1", + dataPointConfiguration: + '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}', + }, + { + name: "dataPoint2", + dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2", + dataPointConfiguration: + '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}', + }, + ], + }, + ], + events: [ + { + name: "event1", + eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}', + topic: { path: "/path/event1", retain: "Keep" }, + }, + { + name: "event2", + eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4", + eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}', + }, + ], + }, + }, + ); + console.log(result); +} + +async function main() { + createDiscoveredAsset(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsDeleteSample.ts new file mode 100644 index 000000000000..0846c4ee1563 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a DiscoveredAsset + * + * @summary delete a DiscoveredAsset + * x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAsset.json + */ +async function deleteDiscoveredAsset() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.discoveredAssets.delete("myResourceGroup", "my-discoveredasset"); +} + +async function main() { + deleteDiscoveredAsset(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsGetSample.ts new file mode 100644 index 000000000000..8d4d09baca68 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a DiscoveredAsset + * + * @summary get a DiscoveredAsset + * x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAsset.json + */ +async function getDiscoveredAsset() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssets.get("myResourceGroup", "my-discoveredasset"); + console.log(result); +} + +async function main() { + getDiscoveredAsset(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsListByResourceGroupSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsListByResourceGroupSample.ts new file mode 100644 index 000000000000..89afb36c8dbd --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list DiscoveredAsset resources by resource group + * + * @summary list DiscoveredAsset resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_ResourceGroup.json + */ +async function listDiscoveredAssetsResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.discoveredAssets.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listDiscoveredAssetsResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsListBySubscriptionSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsListBySubscriptionSample.ts new file mode 100644 index 000000000000..e0e20846efa9 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsListBySubscriptionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list DiscoveredAsset resources by subscription ID + * + * @summary list DiscoveredAsset resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_Subscription.json + */ +async function listDiscoveredAssetsSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.discoveredAssets.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listDiscoveredAssetsSubscription(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsUpdateSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsUpdateSample.ts new file mode 100644 index 000000000000..74ff2a691925 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/discoveredAssetsUpdateSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a DiscoveredAsset + * + * @summary update a DiscoveredAsset + * x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAsset.json + */ +async function updateDiscoveredAsset() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.discoveredAssets.update("myResourceGroup", "my-discoveredasset", { + properties: { + documentationUri: "https://www.example.com/manual-2", + defaultTopic: { path: "/path/defaultTopic", retain: "Never" }, + }, + }); + console.log(result); +} + +async function main() { + updateDiscoveredAsset(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/operationStatusGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/operationStatusGetSample.ts index c862e9c73e4c..c04f619a8821 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/operationStatusGetSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/operationStatusGetSample.ts @@ -1,39 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); /** - * This sample demonstrates how to Returns the current status of an async operation. + * This sample demonstrates how to returns the current status of an async operation. * - * @summary Returns the current status of an async operation. - * x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_OperationStatus.json + * @summary returns the current status of an async operation. + * x-ms-original-file: 2024-09-01-preview/Get_OperationStatus.json */ -async function getTheStatusOfAnAsyncOperation() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const location = "testLocation"; - const operationId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; +async function getOperationStatus() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); - const result = await client.operationStatus.get(location, operationId); + const result = await client.operationStatus.get( + "testLocation", + "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + ); console.log(result); } async function main() { - getTheStatusOfAnAsyncOperation(); + getOperationStatus(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/operationsListSample.ts index 9c360acf4650..6bc18411adcb 100644 --- a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/operationsListSample.ts +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/operationsListSample.ts @@ -1,40 +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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. + import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -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/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Operations.json + * @summary list the operations for the provider + * x-ms-original-file: 2024-09-01-preview/List_Operations.json */ -async function returnsListOfOperations() { - const subscriptionId = - process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; +async function listOperations() { const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; const client = new DeviceRegistryManagementClient(credential, subscriptionId); const resArray = new Array(); for await (let item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } async function main() { - returnsListOfOperations(); + listOperations(); } main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesCreateOrReplaceSample.ts new file mode 100644 index 000000000000..3bd30a5556da --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesCreateOrReplaceSample.ts @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a SchemaRegistry + * + * @summary create a SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/Create_SchemaRegistry.json + */ +async function createSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaRegistries.createOrReplace( + "myResourceGroup", + "my-schema-registry", + { + properties: { + namespace: "sr-namespace-001", + displayName: "Schema Registry namespace 001", + description: "This is a sample Schema Registry", + storageAccountContainerUrl: "my-blob-storage.blob.core.windows.net/my-container", + }, + tags: {}, + location: "West Europe", + identity: { type: "None" }, + }, + ); + console.log(result); +} + +async function main() { + createSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesDeleteSample.ts new file mode 100644 index 000000000000..a1d15652899a --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a SchemaRegistry + * + * @summary delete a SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/Delete_SchemaRegistry.json + */ +async function deleteSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.schemaRegistries.delete("myResourceGroup", "my-schema-registry"); +} + +async function main() { + deleteSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesGetSample.ts new file mode 100644 index 000000000000..b9c5229b78f4 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a SchemaRegistry + * + * @summary get a SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/Get_SchemaRegistry.json + */ +async function getSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaRegistries.get("myResourceGroup", "my-schema-registry"); + console.log(result); +} + +async function main() { + getSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesListByResourceGroupSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesListByResourceGroupSample.ts new file mode 100644 index 000000000000..b2d9091a84f5 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list SchemaRegistry resources by resource group + * + * @summary list SchemaRegistry resources by resource group + * x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_ResourceGroup.json + */ +async function listSchemaRegistriesResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schemaRegistries.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listSchemaRegistriesResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesListBySubscriptionSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesListBySubscriptionSample.ts new file mode 100644 index 000000000000..184ad0890610 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesListBySubscriptionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list SchemaRegistry resources by subscription ID + * + * @summary list SchemaRegistry resources by subscription ID + * x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_Subscription.json + */ +async function listSchemaRegistriesSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schemaRegistries.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listSchemaRegistriesSubscription(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesUpdateSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesUpdateSample.ts new file mode 100644 index 000000000000..5b337962de49 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaRegistriesUpdateSample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a SchemaRegistry + * + * @summary update a SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/Update_SchemaRegistry.json + */ +async function updateSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaRegistries.update("myResourceGroup", "my-schema-registry", { + properties: { + displayName: "Schema Registry namespace 001", + description: "This is a sample Schema Registry", + }, + tags: {}, + }); + console.log(result); +} + +async function main() { + updateSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsCreateOrReplaceSample.ts new file mode 100644 index 000000000000..756eb65ac8b2 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsCreateOrReplaceSample.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a SchemaVersion + * + * @summary create a SchemaVersion + * x-ms-original-file: 2024-09-01-preview/Create_SchemaVersion.json + */ +async function createSchemaVersion() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaVersions.createOrReplace( + "myResourceGroup", + "my-schema-registry", + "my-schema", + "1", + { + properties: { + description: "Schema version 1", + schemaContent: + '{"$schema": "http://json-schema.org/draft-07/schema#","type": "object","properties": {"humidity": {"type": "string"},"temperature": {"type":"number"}}}', + }, + }, + ); + console.log(result); +} + +async function main() { + createSchemaVersion(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsDeleteSample.ts new file mode 100644 index 000000000000..7a9b8f4e750f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a SchemaVersion + * + * @summary delete a SchemaVersion + * x-ms-original-file: 2024-09-01-preview/Delete_SchemaVersion.json + */ +async function deleteSchemaVersion() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.schemaVersions.delete("myResourceGroup", "my-schema-registry", "my-schema", "1"); +} + +async function main() { + deleteSchemaVersion(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsGetSample.ts new file mode 100644 index 000000000000..e923b34c9dd9 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsGetSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a SchemaVersion + * + * @summary get a SchemaVersion + * x-ms-original-file: 2024-09-01-preview/Get_SchemaVersion.json + */ +async function getSchemaVersion() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemaVersions.get( + "myResourceGroup", + "my-schema-registry", + "my-schema", + "1", + ); + console.log(result); +} + +async function main() { + getSchemaVersion(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsListBySchemaSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsListBySchemaSample.ts new file mode 100644 index 000000000000..fcf3833e595f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemaVersionsListBySchemaSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list SchemaVersion resources by Schema + * + * @summary list SchemaVersion resources by Schema + * x-ms-original-file: 2024-09-01-preview/List_SchemaVersions_Schema.json + */ +async function listSchemaVersionsSchema() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schemaVersions.listBySchema( + "myResourceGroup", + "my-schema-registry", + "my-schema", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listSchemaVersionsSchema(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasCreateOrReplaceSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasCreateOrReplaceSample.ts new file mode 100644 index 000000000000..10c843389179 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasCreateOrReplaceSample.ts @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a Schema + * + * @summary create a Schema + * x-ms-original-file: 2024-09-01-preview/Create_Schema.json + */ +async function createSchema() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemas.createOrReplace( + "myResourceGroup", + "my-schema-registry", + "my-schema", + { + properties: { + displayName: "My Schema", + description: "This is a sample Schema", + format: "JsonSchema/draft-07", + schemaType: "MessageSchema", + tags: { sampleKey: "sampleValue" }, + }, + }, + ); + console.log(result); +} + +async function main() { + createSchema(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasDeleteSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasDeleteSample.ts new file mode 100644 index 000000000000..7f68fe71513a --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a Schema + * + * @summary delete a Schema + * x-ms-original-file: 2024-09-01-preview/Delete_Schema.json + */ +async function deleteSchema() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + await client.schemas.delete("myResourceGroup", "my-schema-registry", "my-schema"); +} + +async function main() { + deleteSchema(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasGetSample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasGetSample.ts new file mode 100644 index 000000000000..1eaec80dd028 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a Schema + * + * @summary get a Schema + * x-ms-original-file: 2024-09-01-preview/Get_Schema.json + */ +async function schemasGet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const result = await client.schemas.get("myResourceGroup", "my-schema-registry", "my-schema"); + console.log(result); +} + +async function main() { + schemasGet(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasListBySchemaRegistrySample.ts b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasListBySchemaRegistrySample.ts new file mode 100644 index 000000000000..fb60e26a5a40 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/schemasListBySchemaRegistrySample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list Schema resources by SchemaRegistry + * + * @summary list Schema resources by SchemaRegistry + * x-ms-original-file: 2024-09-01-preview/List_Schemas_SchemaRegistry.json + */ +async function listSchemasSchemaRegistry() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new DeviceRegistryManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.schemas.listBySchemaRegistry( + "myResourceGroup", + "my-schema-registry", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + listSchemasSchemaRegistry(); +} + +main().catch(console.error); diff --git a/sdk/deviceregistry/arm-deviceregistry/src/api/assetEndpointProfiles/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/api/assetEndpointProfiles/index.ts new file mode 100644 index 000000000000..d1b0d72e63b6 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/api/assetEndpointProfiles/index.ts @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + AssetEndpointProfilesCreateOrReplaceOptionalParams, + AssetEndpointProfilesDeleteOptionalParams, + AssetEndpointProfilesGetOptionalParams, + AssetEndpointProfilesListByResourceGroupOptionalParams, + AssetEndpointProfilesListBySubscriptionOptionalParams, + AssetEndpointProfilesUpdateOptionalParams, + DeviceRegistryManagementContext as Client, +} from "../index.js"; +import { + AssetEndpointProfile, + assetEndpointProfileSerializer, + assetEndpointProfileDeserializer, + AssetEndpointProfileUpdate, + assetEndpointProfileUpdateSerializer, + _AssetEndpointProfileListResult, + _assetEndpointProfileListResultDeserializer, +} from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _assetEndpointProfilesGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetEndpointProfileName: string, + options: AssetEndpointProfilesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}", + subscriptionId, + resourceGroupName, + assetEndpointProfileName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _assetEndpointProfilesGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return assetEndpointProfileDeserializer(result.body); +} + +/** Get a AssetEndpointProfile */ +export async function assetEndpointProfilesGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetEndpointProfileName: string, + options: AssetEndpointProfilesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _assetEndpointProfilesGetSend( + context, + subscriptionId, + resourceGroupName, + assetEndpointProfileName, + options, + ); + return _assetEndpointProfilesGetDeserialize(result); +} + +export function _assetEndpointProfilesCreateOrReplaceSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetEndpointProfileName: string, + resource: AssetEndpointProfile, + options: AssetEndpointProfilesCreateOrReplaceOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}", + subscriptionId, + resourceGroupName, + assetEndpointProfileName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: assetEndpointProfileSerializer(resource), + }); +} + +export async function _assetEndpointProfilesCreateOrReplaceDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return assetEndpointProfileDeserializer(result.body); +} + +/** Create a AssetEndpointProfile */ +export function assetEndpointProfilesCreateOrReplace( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetEndpointProfileName: string, + resource: AssetEndpointProfile, + options: AssetEndpointProfilesCreateOrReplaceOptionalParams = { + requestOptions: {}, + }, +): PollerLike, AssetEndpointProfile> { + return getLongRunningPoller( + context, + _assetEndpointProfilesCreateOrReplaceDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _assetEndpointProfilesCreateOrReplaceSend( + context, + subscriptionId, + resourceGroupName, + assetEndpointProfileName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }, + ) as PollerLike, AssetEndpointProfile>; +} + +export function _assetEndpointProfilesUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetEndpointProfileName: string, + properties: AssetEndpointProfileUpdate, + options: AssetEndpointProfilesUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}", + subscriptionId, + resourceGroupName, + assetEndpointProfileName, + ) + .patch({ + ...operationOptionsToRequestParameters(options), + body: assetEndpointProfileUpdateSerializer(properties), + }); +} + +export async function _assetEndpointProfilesUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return assetEndpointProfileDeserializer(result.body); +} + +/** Update a AssetEndpointProfile */ +export function assetEndpointProfilesUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetEndpointProfileName: string, + properties: AssetEndpointProfileUpdate, + options: AssetEndpointProfilesUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, AssetEndpointProfile> { + return getLongRunningPoller(context, _assetEndpointProfilesUpdateDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _assetEndpointProfilesUpdateSend( + context, + subscriptionId, + resourceGroupName, + assetEndpointProfileName, + properties, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, AssetEndpointProfile>; +} + +export function _assetEndpointProfilesDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetEndpointProfileName: string, + options: AssetEndpointProfilesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}", + subscriptionId, + resourceGroupName, + assetEndpointProfileName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _assetEndpointProfilesDeleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Delete a AssetEndpointProfile */ +export function assetEndpointProfilesDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetEndpointProfileName: string, + options: AssetEndpointProfilesDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _assetEndpointProfilesDeleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _assetEndpointProfilesDeleteSend( + context, + subscriptionId, + resourceGroupName, + assetEndpointProfileName, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _assetEndpointProfilesListByResourceGroupSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: AssetEndpointProfilesListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles", + subscriptionId, + resourceGroupName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _assetEndpointProfilesListByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_AssetEndpointProfileListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _assetEndpointProfileListResultDeserializer(result.body); +} + +/** List AssetEndpointProfile resources by resource group */ +export function assetEndpointProfilesListByResourceGroup( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: AssetEndpointProfilesListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _assetEndpointProfilesListByResourceGroupSend( + context, + subscriptionId, + resourceGroupName, + options, + ), + _assetEndpointProfilesListByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _assetEndpointProfilesListBySubscriptionSend( + context: Client, + subscriptionId: string, + options: AssetEndpointProfilesListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles", + subscriptionId, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _assetEndpointProfilesListBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_AssetEndpointProfileListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _assetEndpointProfileListResultDeserializer(result.body); +} + +/** List AssetEndpointProfile resources by subscription ID */ +export function assetEndpointProfilesListBySubscription( + context: Client, + subscriptionId: string, + options: AssetEndpointProfilesListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _assetEndpointProfilesListBySubscriptionSend(context, subscriptionId, options), + _assetEndpointProfilesListBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/api/assets/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/api/assets/index.ts new file mode 100644 index 000000000000..1b4505957ea4 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/api/assets/index.ts @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + AssetsCreateOrReplaceOptionalParams, + AssetsDeleteOptionalParams, + AssetsGetOptionalParams, + AssetsListByResourceGroupOptionalParams, + AssetsListBySubscriptionOptionalParams, + AssetsUpdateOptionalParams, + DeviceRegistryManagementContext as Client, +} from "../index.js"; +import { + Asset, + assetSerializer, + assetDeserializer, + AssetUpdate, + assetUpdateSerializer, + _AssetListResult, + _assetListResultDeserializer, +} from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _assetsGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetName: string, + options: AssetsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}", + subscriptionId, + resourceGroupName, + assetName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _assetsGetDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return assetDeserializer(result.body); +} + +/** Get a Asset */ +export async function assetsGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetName: string, + options: AssetsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _assetsGetSend( + context, + subscriptionId, + resourceGroupName, + assetName, + options, + ); + return _assetsGetDeserialize(result); +} + +export function _assetsCreateOrReplaceSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetName: string, + resource: Asset, + options: AssetsCreateOrReplaceOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}", + subscriptionId, + resourceGroupName, + assetName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: assetSerializer(resource), + }); +} + +export async function _assetsCreateOrReplaceDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return assetDeserializer(result.body); +} + +/** Create a Asset */ +export function assetsCreateOrReplace( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetName: string, + resource: Asset, + options: AssetsCreateOrReplaceOptionalParams = { requestOptions: {} }, +): PollerLike, Asset> { + return getLongRunningPoller(context, _assetsCreateOrReplaceDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _assetsCreateOrReplaceSend( + context, + subscriptionId, + resourceGroupName, + assetName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, Asset>; +} + +export function _assetsUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetName: string, + properties: AssetUpdate, + options: AssetsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}", + subscriptionId, + resourceGroupName, + assetName, + ) + .patch({ + ...operationOptionsToRequestParameters(options), + body: assetUpdateSerializer(properties), + }); +} + +export async function _assetsUpdateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return assetDeserializer(result.body); +} + +/** Update a Asset */ +export function assetsUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetName: string, + properties: AssetUpdate, + options: AssetsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Asset> { + return getLongRunningPoller(context, _assetsUpdateDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _assetsUpdateSend(context, subscriptionId, resourceGroupName, assetName, properties, options), + resourceLocationConfig: "location", + }) as PollerLike, Asset>; +} + +export function _assetsDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetName: string, + options: AssetsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}", + subscriptionId, + resourceGroupName, + assetName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _assetsDeleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Delete a Asset */ +export function assetsDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + assetName: string, + options: AssetsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _assetsDeleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _assetsDeleteSend(context, subscriptionId, resourceGroupName, assetName, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _assetsListByResourceGroupSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: AssetsListByResourceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets", + subscriptionId, + resourceGroupName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _assetsListByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_AssetListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _assetListResultDeserializer(result.body); +} + +/** List Asset resources by resource group */ +export function assetsListByResourceGroup( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: AssetsListByResourceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _assetsListByResourceGroupSend(context, subscriptionId, resourceGroupName, options), + _assetsListByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _assetsListBySubscriptionSend( + context: Client, + subscriptionId: string, + options: AssetsListBySubscriptionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assets", + subscriptionId, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _assetsListBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_AssetListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _assetListResultDeserializer(result.body); +} + +/** List Asset resources by subscription ID */ +export function assetsListBySubscription( + context: Client, + subscriptionId: string, + options: AssetsListBySubscriptionOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _assetsListBySubscriptionSend(context, subscriptionId, options), + _assetsListBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/api/billingContainers/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/api/billingContainers/index.ts new file mode 100644 index 000000000000..3dac52cb152e --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/api/billingContainers/index.ts @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + BillingContainersGetOptionalParams, + BillingContainersListBySubscriptionOptionalParams, + DeviceRegistryManagementContext as Client, +} from "../index.js"; +import { + BillingContainer, + billingContainerDeserializer, + _BillingContainerListResult, + _billingContainerListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _billingContainersGetSend( + context: Client, + subscriptionId: string, + billingContainerName: string, + options: BillingContainersGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers/{billingContainerName}", + subscriptionId, + billingContainerName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _billingContainersGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return billingContainerDeserializer(result.body); +} + +/** Get a BillingContainer */ +export async function billingContainersGet( + context: Client, + subscriptionId: string, + billingContainerName: string, + options: BillingContainersGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _billingContainersGetSend( + context, + subscriptionId, + billingContainerName, + options, + ); + return _billingContainersGetDeserialize(result); +} + +export function _billingContainersListBySubscriptionSend( + context: Client, + subscriptionId: string, + options: BillingContainersListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers", + subscriptionId, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _billingContainersListBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_BillingContainerListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _billingContainerListResultDeserializer(result.body); +} + +/** List BillingContainer resources by subscription ID */ +export function billingContainersListBySubscription( + context: Client, + subscriptionId: string, + options: BillingContainersListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _billingContainersListBySubscriptionSend(context, subscriptionId, options), + _billingContainersListBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/api/deviceRegistryManagementContext.ts b/sdk/deviceregistry/arm-deviceregistry/src/api/deviceRegistryManagementContext.ts new file mode 100644 index 000000000000..efa73f921ea3 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/api/deviceRegistryManagementContext.ts @@ -0,0 +1,57 @@ +// 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"; + +/** Microsoft.DeviceRegistry Resource Provider management API. */ +export interface DeviceRegistryManagementContext extends Client {} + +/** Optional parameters for the client. */ +export interface DeviceRegistryManagementClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +/** Microsoft.DeviceRegistry Resource Provider management API. */ +export function createDeviceRegistryManagement( + credential: TokenCredential, + options: DeviceRegistryManagementClientOptionalParams = {}, +): DeviceRegistryManagementContext { + const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-deviceregistry/1.0.0-beta.2`; + 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-09-01-preview"; + 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; +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/api/discoveredAssetEndpointProfiles/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/api/discoveredAssetEndpointProfiles/index.ts new file mode 100644 index 000000000000..137fe71bcc36 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/api/discoveredAssetEndpointProfiles/index.ts @@ -0,0 +1,370 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + DeviceRegistryManagementContext as Client, + DiscoveredAssetEndpointProfilesCreateOrReplaceOptionalParams, + DiscoveredAssetEndpointProfilesDeleteOptionalParams, + DiscoveredAssetEndpointProfilesGetOptionalParams, + DiscoveredAssetEndpointProfilesListByResourceGroupOptionalParams, + DiscoveredAssetEndpointProfilesListBySubscriptionOptionalParams, + DiscoveredAssetEndpointProfilesUpdateOptionalParams, +} from "../index.js"; +import { + DiscoveredAssetEndpointProfile, + discoveredAssetEndpointProfileSerializer, + discoveredAssetEndpointProfileDeserializer, + DiscoveredAssetEndpointProfileUpdate, + discoveredAssetEndpointProfileUpdateSerializer, + _DiscoveredAssetEndpointProfileListResult, + _discoveredAssetEndpointProfileListResultDeserializer, +} from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _discoveredAssetEndpointProfilesGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + options: DiscoveredAssetEndpointProfilesGetOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}", + subscriptionId, + resourceGroupName, + discoveredAssetEndpointProfileName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _discoveredAssetEndpointProfilesGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return discoveredAssetEndpointProfileDeserializer(result.body); +} + +/** Get a DiscoveredAssetEndpointProfile */ +export async function discoveredAssetEndpointProfilesGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + options: DiscoveredAssetEndpointProfilesGetOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _discoveredAssetEndpointProfilesGetSend( + context, + subscriptionId, + resourceGroupName, + discoveredAssetEndpointProfileName, + options, + ); + return _discoveredAssetEndpointProfilesGetDeserialize(result); +} + +export function _discoveredAssetEndpointProfilesCreateOrReplaceSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + resource: DiscoveredAssetEndpointProfile, + options: DiscoveredAssetEndpointProfilesCreateOrReplaceOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}", + subscriptionId, + resourceGroupName, + discoveredAssetEndpointProfileName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: discoveredAssetEndpointProfileSerializer(resource), + }); +} + +export async function _discoveredAssetEndpointProfilesCreateOrReplaceDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return discoveredAssetEndpointProfileDeserializer(result.body); +} + +/** Create a DiscoveredAssetEndpointProfile */ +export function discoveredAssetEndpointProfilesCreateOrReplace( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + resource: DiscoveredAssetEndpointProfile, + options: DiscoveredAssetEndpointProfilesCreateOrReplaceOptionalParams = { + requestOptions: {}, + }, +): PollerLike, DiscoveredAssetEndpointProfile> { + return getLongRunningPoller( + context, + _discoveredAssetEndpointProfilesCreateOrReplaceDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _discoveredAssetEndpointProfilesCreateOrReplaceSend( + context, + subscriptionId, + resourceGroupName, + discoveredAssetEndpointProfileName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }, + ) as PollerLike, DiscoveredAssetEndpointProfile>; +} + +export function _discoveredAssetEndpointProfilesUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + properties: DiscoveredAssetEndpointProfileUpdate, + options: DiscoveredAssetEndpointProfilesUpdateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}", + subscriptionId, + resourceGroupName, + discoveredAssetEndpointProfileName, + ) + .patch({ + ...operationOptionsToRequestParameters(options), + body: discoveredAssetEndpointProfileUpdateSerializer(properties), + }); +} + +export async function _discoveredAssetEndpointProfilesUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return discoveredAssetEndpointProfileDeserializer(result.body); +} + +/** Update a DiscoveredAssetEndpointProfile */ +export function discoveredAssetEndpointProfilesUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + properties: DiscoveredAssetEndpointProfileUpdate, + options: DiscoveredAssetEndpointProfilesUpdateOptionalParams = { + requestOptions: {}, + }, +): PollerLike, DiscoveredAssetEndpointProfile> { + return getLongRunningPoller( + context, + _discoveredAssetEndpointProfilesUpdateDeserialize, + ["200", "202"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _discoveredAssetEndpointProfilesUpdateSend( + context, + subscriptionId, + resourceGroupName, + discoveredAssetEndpointProfileName, + properties, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, DiscoveredAssetEndpointProfile>; +} + +export function _discoveredAssetEndpointProfilesDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + options: DiscoveredAssetEndpointProfilesDeleteOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}", + subscriptionId, + resourceGroupName, + discoveredAssetEndpointProfileName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _discoveredAssetEndpointProfilesDeleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Delete a DiscoveredAssetEndpointProfile */ +export function discoveredAssetEndpointProfilesDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + options: DiscoveredAssetEndpointProfilesDeleteOptionalParams = { + requestOptions: {}, + }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _discoveredAssetEndpointProfilesDeleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _discoveredAssetEndpointProfilesDeleteSend( + context, + subscriptionId, + resourceGroupName, + discoveredAssetEndpointProfileName, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _discoveredAssetEndpointProfilesListByResourceGroupSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: DiscoveredAssetEndpointProfilesListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles", + subscriptionId, + resourceGroupName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _discoveredAssetEndpointProfilesListByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_DiscoveredAssetEndpointProfileListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _discoveredAssetEndpointProfileListResultDeserializer(result.body); +} + +/** List DiscoveredAssetEndpointProfile resources by resource group */ +export function discoveredAssetEndpointProfilesListByResourceGroup( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: DiscoveredAssetEndpointProfilesListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _discoveredAssetEndpointProfilesListByResourceGroupSend( + context, + subscriptionId, + resourceGroupName, + options, + ), + _discoveredAssetEndpointProfilesListByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _discoveredAssetEndpointProfilesListBySubscriptionSend( + context: Client, + subscriptionId: string, + options: DiscoveredAssetEndpointProfilesListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles", + subscriptionId, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _discoveredAssetEndpointProfilesListBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_DiscoveredAssetEndpointProfileListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _discoveredAssetEndpointProfileListResultDeserializer(result.body); +} + +/** List DiscoveredAssetEndpointProfile resources by subscription ID */ +export function discoveredAssetEndpointProfilesListBySubscription( + context: Client, + subscriptionId: string, + options: DiscoveredAssetEndpointProfilesListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _discoveredAssetEndpointProfilesListBySubscriptionSend(context, subscriptionId, options), + _discoveredAssetEndpointProfilesListBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/api/discoveredAssets/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/api/discoveredAssets/index.ts new file mode 100644 index 000000000000..5e22b1d5e5ef --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/api/discoveredAssets/index.ts @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + DeviceRegistryManagementContext as Client, + DiscoveredAssetsCreateOrReplaceOptionalParams, + DiscoveredAssetsDeleteOptionalParams, + DiscoveredAssetsGetOptionalParams, + DiscoveredAssetsListByResourceGroupOptionalParams, + DiscoveredAssetsListBySubscriptionOptionalParams, + DiscoveredAssetsUpdateOptionalParams, +} from "../index.js"; +import { + DiscoveredAsset, + discoveredAssetSerializer, + discoveredAssetDeserializer, + DiscoveredAssetUpdate, + discoveredAssetUpdateSerializer, + _DiscoveredAssetListResult, + _discoveredAssetListResultDeserializer, +} from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _discoveredAssetsGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetName: string, + options: DiscoveredAssetsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}", + subscriptionId, + resourceGroupName, + discoveredAssetName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _discoveredAssetsGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return discoveredAssetDeserializer(result.body); +} + +/** Get a DiscoveredAsset */ +export async function discoveredAssetsGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetName: string, + options: DiscoveredAssetsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _discoveredAssetsGetSend( + context, + subscriptionId, + resourceGroupName, + discoveredAssetName, + options, + ); + return _discoveredAssetsGetDeserialize(result); +} + +export function _discoveredAssetsCreateOrReplaceSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetName: string, + resource: DiscoveredAsset, + options: DiscoveredAssetsCreateOrReplaceOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}", + subscriptionId, + resourceGroupName, + discoveredAssetName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: discoveredAssetSerializer(resource), + }); +} + +export async function _discoveredAssetsCreateOrReplaceDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return discoveredAssetDeserializer(result.body); +} + +/** Create a DiscoveredAsset */ +export function discoveredAssetsCreateOrReplace( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetName: string, + resource: DiscoveredAsset, + options: DiscoveredAssetsCreateOrReplaceOptionalParams = { + requestOptions: {}, + }, +): PollerLike, DiscoveredAsset> { + return getLongRunningPoller( + context, + _discoveredAssetsCreateOrReplaceDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _discoveredAssetsCreateOrReplaceSend( + context, + subscriptionId, + resourceGroupName, + discoveredAssetName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }, + ) as PollerLike, DiscoveredAsset>; +} + +export function _discoveredAssetsUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetName: string, + properties: DiscoveredAssetUpdate, + options: DiscoveredAssetsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}", + subscriptionId, + resourceGroupName, + discoveredAssetName, + ) + .patch({ + ...operationOptionsToRequestParameters(options), + body: discoveredAssetUpdateSerializer(properties), + }); +} + +export async function _discoveredAssetsUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return discoveredAssetDeserializer(result.body); +} + +/** Update a DiscoveredAsset */ +export function discoveredAssetsUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetName: string, + properties: DiscoveredAssetUpdate, + options: DiscoveredAssetsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, DiscoveredAsset> { + return getLongRunningPoller(context, _discoveredAssetsUpdateDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _discoveredAssetsUpdateSend( + context, + subscriptionId, + resourceGroupName, + discoveredAssetName, + properties, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, DiscoveredAsset>; +} + +export function _discoveredAssetsDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetName: string, + options: DiscoveredAssetsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}", + subscriptionId, + resourceGroupName, + discoveredAssetName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _discoveredAssetsDeleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Delete a DiscoveredAsset */ +export function discoveredAssetsDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + discoveredAssetName: string, + options: DiscoveredAssetsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _discoveredAssetsDeleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _discoveredAssetsDeleteSend( + context, + subscriptionId, + resourceGroupName, + discoveredAssetName, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _discoveredAssetsListByResourceGroupSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: DiscoveredAssetsListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets", + subscriptionId, + resourceGroupName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _discoveredAssetsListByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_DiscoveredAssetListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _discoveredAssetListResultDeserializer(result.body); +} + +/** List DiscoveredAsset resources by resource group */ +export function discoveredAssetsListByResourceGroup( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: DiscoveredAssetsListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _discoveredAssetsListByResourceGroupSend(context, subscriptionId, resourceGroupName, options), + _discoveredAssetsListByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _discoveredAssetsListBySubscriptionSend( + context: Client, + subscriptionId: string, + options: DiscoveredAssetsListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/discoveredAssets", + subscriptionId, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _discoveredAssetsListBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_DiscoveredAssetListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _discoveredAssetListResultDeserializer(result.body); +} + +/** List DiscoveredAsset resources by subscription ID */ +export function discoveredAssetsListBySubscription( + context: Client, + subscriptionId: string, + options: DiscoveredAssetsListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _discoveredAssetsListBySubscriptionSend(context, subscriptionId, options), + _discoveredAssetsListBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/api/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/api/index.ts new file mode 100644 index 000000000000..48753155e02b --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/api/index.ts @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + createDeviceRegistryManagement, + DeviceRegistryManagementContext, + DeviceRegistryManagementClientOptionalParams, +} from "./deviceRegistryManagementContext.js"; +export { + OperationsListOptionalParams, + OperationStatusGetOptionalParams, + AssetsGetOptionalParams, + AssetsCreateOrReplaceOptionalParams, + AssetsUpdateOptionalParams, + AssetsDeleteOptionalParams, + AssetsListByResourceGroupOptionalParams, + AssetsListBySubscriptionOptionalParams, + AssetEndpointProfilesGetOptionalParams, + AssetEndpointProfilesCreateOrReplaceOptionalParams, + AssetEndpointProfilesUpdateOptionalParams, + AssetEndpointProfilesDeleteOptionalParams, + AssetEndpointProfilesListByResourceGroupOptionalParams, + AssetEndpointProfilesListBySubscriptionOptionalParams, + BillingContainersGetOptionalParams, + BillingContainersListBySubscriptionOptionalParams, + DiscoveredAssetsGetOptionalParams, + DiscoveredAssetsCreateOrReplaceOptionalParams, + DiscoveredAssetsUpdateOptionalParams, + DiscoveredAssetsDeleteOptionalParams, + DiscoveredAssetsListByResourceGroupOptionalParams, + DiscoveredAssetsListBySubscriptionOptionalParams, + DiscoveredAssetEndpointProfilesGetOptionalParams, + DiscoveredAssetEndpointProfilesCreateOrReplaceOptionalParams, + DiscoveredAssetEndpointProfilesUpdateOptionalParams, + DiscoveredAssetEndpointProfilesDeleteOptionalParams, + DiscoveredAssetEndpointProfilesListByResourceGroupOptionalParams, + DiscoveredAssetEndpointProfilesListBySubscriptionOptionalParams, + SchemaRegistriesGetOptionalParams, + SchemaRegistriesCreateOrReplaceOptionalParams, + SchemaRegistriesUpdateOptionalParams, + SchemaRegistriesDeleteOptionalParams, + SchemaRegistriesListByResourceGroupOptionalParams, + SchemaRegistriesListBySubscriptionOptionalParams, + SchemasGetOptionalParams, + SchemasCreateOrReplaceOptionalParams, + SchemasDeleteOptionalParams, + SchemasListBySchemaRegistryOptionalParams, + SchemaVersionsGetOptionalParams, + SchemaVersionsCreateOrReplaceOptionalParams, + SchemaVersionsDeleteOptionalParams, + SchemaVersionsListBySchemaOptionalParams, +} from "./options.js"; +export { + assetEndpointProfilesGet, + assetEndpointProfilesCreateOrReplace, + assetEndpointProfilesUpdate, + assetEndpointProfilesDelete, + assetEndpointProfilesListByResourceGroup, + assetEndpointProfilesListBySubscription, +} from "./assetEndpointProfiles/index.js"; +export { + assetsGet, + assetsCreateOrReplace, + assetsUpdate, + assetsDelete, + assetsListByResourceGroup, + assetsListBySubscription, +} from "./assets/index.js"; +export { + billingContainersGet, + billingContainersListBySubscription, +} from "./billingContainers/index.js"; +export { + discoveredAssetEndpointProfilesGet, + discoveredAssetEndpointProfilesCreateOrReplace, + discoveredAssetEndpointProfilesUpdate, + discoveredAssetEndpointProfilesDelete, + discoveredAssetEndpointProfilesListByResourceGroup, + discoveredAssetEndpointProfilesListBySubscription, +} from "./discoveredAssetEndpointProfiles/index.js"; +export { + discoveredAssetsGet, + discoveredAssetsCreateOrReplace, + discoveredAssetsUpdate, + discoveredAssetsDelete, + discoveredAssetsListByResourceGroup, + discoveredAssetsListBySubscription, +} from "./discoveredAssets/index.js"; +export { operationsList } from "./operations/index.js"; +export { operationStatusGet } from "./operationStatus/index.js"; +export { + schemaRegistriesGet, + schemaRegistriesCreateOrReplace, + schemaRegistriesUpdate, + schemaRegistriesDelete, + schemaRegistriesListByResourceGroup, + schemaRegistriesListBySubscription, +} from "./schemaRegistries/index.js"; +export { + schemasGet, + schemasCreateOrReplace, + schemasDelete, + schemasListBySchemaRegistry, +} from "./schemas/index.js"; +export { + schemaVersionsGet, + schemaVersionsCreateOrReplace, + schemaVersionsDelete, + schemaVersionsListBySchema, +} from "./schemaVersions/index.js"; diff --git a/sdk/deviceregistry/arm-deviceregistry/src/api/operationStatus/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/api/operationStatus/index.ts new file mode 100644 index 000000000000..900bdc397216 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/api/operationStatus/index.ts @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + DeviceRegistryManagementContext as Client, + OperationStatusGetOptionalParams, +} from "../index.js"; +import { OperationStatusResult, operationStatusResultDeserializer } from "../../models/models.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _operationStatusGetSend( + context: Client, + subscriptionId: string, + location: string, + operationId: string, + options: OperationStatusGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/locations/{location}/operationStatuses/{operationId}", + subscriptionId, + location, + operationId, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationStatusGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return operationStatusResultDeserializer(result.body); +} + +/** Returns the current status of an async operation. */ +export async function operationStatusGet( + context: Client, + subscriptionId: string, + location: string, + operationId: string, + options: OperationStatusGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _operationStatusGetSend( + context, + subscriptionId, + location, + operationId, + options, + ); + return _operationStatusGetDeserialize(result); +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/api/operations/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/api/operations/index.ts new file mode 100644 index 000000000000..417ac844c11a --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/api/operations/index.ts @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + DeviceRegistryManagementContext as Client, + OperationsListOptionalParams, +} from "../index.js"; +import { + _OperationListResult, + _operationListResultDeserializer, + Operation, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _operationsListSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/providers/Microsoft.DeviceRegistry/operations") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsListDeserialize( + result: PathUncheckedResponse, +): Promise<_OperationListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _operationListResultDeserializer(result.body); +} + +/** List the operations for the provider */ +export function operationsList( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _operationsListSend(context, options), + _operationsListDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/api/options.ts b/sdk/deviceregistry/arm-deviceregistry/src/api/options.ts new file mode 100644 index 000000000000..66c2f00f80cb --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/api/options.ts @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface OperationStatusGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AssetsGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AssetsCreateOrReplaceOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AssetsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AssetsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AssetsListByResourceGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AssetsListBySubscriptionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AssetEndpointProfilesGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AssetEndpointProfilesCreateOrReplaceOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AssetEndpointProfilesUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AssetEndpointProfilesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AssetEndpointProfilesListByResourceGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AssetEndpointProfilesListBySubscriptionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface BillingContainersGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface BillingContainersListBySubscriptionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DiscoveredAssetsGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DiscoveredAssetsCreateOrReplaceOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiscoveredAssetsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiscoveredAssetsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiscoveredAssetsListByResourceGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DiscoveredAssetsListBySubscriptionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DiscoveredAssetEndpointProfilesGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DiscoveredAssetEndpointProfilesCreateOrReplaceOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiscoveredAssetEndpointProfilesUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiscoveredAssetEndpointProfilesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiscoveredAssetEndpointProfilesListByResourceGroupOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DiscoveredAssetEndpointProfilesListBySubscriptionOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface SchemaRegistriesGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SchemaRegistriesCreateOrReplaceOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface SchemaRegistriesUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface SchemaRegistriesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface SchemaRegistriesListByResourceGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SchemaRegistriesListBySubscriptionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SchemasGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SchemasCreateOrReplaceOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SchemasDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SchemasListBySchemaRegistryOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SchemaVersionsGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SchemaVersionsCreateOrReplaceOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SchemaVersionsDeleteOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SchemaVersionsListBySchemaOptionalParams extends OperationOptions {} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/api/schemaRegistries/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/api/schemaRegistries/index.ts new file mode 100644 index 000000000000..e8a38a57f31c --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/api/schemaRegistries/index.ts @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + DeviceRegistryManagementContext as Client, + SchemaRegistriesCreateOrReplaceOptionalParams, + SchemaRegistriesDeleteOptionalParams, + SchemaRegistriesGetOptionalParams, + SchemaRegistriesListByResourceGroupOptionalParams, + SchemaRegistriesListBySubscriptionOptionalParams, + SchemaRegistriesUpdateOptionalParams, +} from "../index.js"; +import { + SchemaRegistry, + schemaRegistrySerializer, + schemaRegistryDeserializer, + SchemaRegistryUpdate, + schemaRegistryUpdateSerializer, + _SchemaRegistryListResult, + _schemaRegistryListResultDeserializer, +} from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _schemaRegistriesGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + options: SchemaRegistriesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}", + subscriptionId, + resourceGroupName, + schemaRegistryName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _schemaRegistriesGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return schemaRegistryDeserializer(result.body); +} + +/** Get a SchemaRegistry */ +export async function schemaRegistriesGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + options: SchemaRegistriesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _schemaRegistriesGetSend( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + options, + ); + return _schemaRegistriesGetDeserialize(result); +} + +export function _schemaRegistriesCreateOrReplaceSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + resource: SchemaRegistry, + options: SchemaRegistriesCreateOrReplaceOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}", + subscriptionId, + resourceGroupName, + schemaRegistryName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: schemaRegistrySerializer(resource), + }); +} + +export async function _schemaRegistriesCreateOrReplaceDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return schemaRegistryDeserializer(result.body); +} + +/** Create a SchemaRegistry */ +export function schemaRegistriesCreateOrReplace( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + resource: SchemaRegistry, + options: SchemaRegistriesCreateOrReplaceOptionalParams = { + requestOptions: {}, + }, +): PollerLike, SchemaRegistry> { + return getLongRunningPoller( + context, + _schemaRegistriesCreateOrReplaceDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _schemaRegistriesCreateOrReplaceSend( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }, + ) as PollerLike, SchemaRegistry>; +} + +export function _schemaRegistriesUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + properties: SchemaRegistryUpdate, + options: SchemaRegistriesUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}", + subscriptionId, + resourceGroupName, + schemaRegistryName, + ) + .patch({ + ...operationOptionsToRequestParameters(options), + body: schemaRegistryUpdateSerializer(properties), + }); +} + +export async function _schemaRegistriesUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return schemaRegistryDeserializer(result.body); +} + +/** Update a SchemaRegistry */ +export function schemaRegistriesUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + properties: SchemaRegistryUpdate, + options: SchemaRegistriesUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, SchemaRegistry> { + return getLongRunningPoller(context, _schemaRegistriesUpdateDeserialize, ["200", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _schemaRegistriesUpdateSend( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + properties, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, SchemaRegistry>; +} + +export function _schemaRegistriesDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + options: SchemaRegistriesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}", + subscriptionId, + resourceGroupName, + schemaRegistryName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _schemaRegistriesDeleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Delete a SchemaRegistry */ +export function schemaRegistriesDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + options: SchemaRegistriesDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _schemaRegistriesDeleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _schemaRegistriesDeleteSend( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + options, + ), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _schemaRegistriesListByResourceGroupSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: SchemaRegistriesListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries", + subscriptionId, + resourceGroupName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _schemaRegistriesListByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_SchemaRegistryListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _schemaRegistryListResultDeserializer(result.body); +} + +/** List SchemaRegistry resources by resource group */ +export function schemaRegistriesListByResourceGroup( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: SchemaRegistriesListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _schemaRegistriesListByResourceGroupSend(context, subscriptionId, resourceGroupName, options), + _schemaRegistriesListByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _schemaRegistriesListBySubscriptionSend( + context: Client, + subscriptionId: string, + options: SchemaRegistriesListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/schemaRegistries", + subscriptionId, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _schemaRegistriesListBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_SchemaRegistryListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _schemaRegistryListResultDeserializer(result.body); +} + +/** List SchemaRegistry resources by subscription ID */ +export function schemaRegistriesListBySubscription( + context: Client, + subscriptionId: string, + options: SchemaRegistriesListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _schemaRegistriesListBySubscriptionSend(context, subscriptionId, options), + _schemaRegistriesListBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/api/schemaVersions/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/api/schemaVersions/index.ts new file mode 100644 index 000000000000..441580b2629f --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/api/schemaVersions/index.ts @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + DeviceRegistryManagementContext as Client, + SchemaVersionsCreateOrReplaceOptionalParams, + SchemaVersionsDeleteOptionalParams, + SchemaVersionsGetOptionalParams, + SchemaVersionsListBySchemaOptionalParams, +} from "../index.js"; +import { + SchemaVersion, + schemaVersionSerializer, + schemaVersionDeserializer, + _SchemaVersionListResult, + _schemaVersionListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _schemaVersionsGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + schemaVersionName: string, + options: SchemaVersionsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName}", + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + schemaVersionName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _schemaVersionsGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return schemaVersionDeserializer(result.body); +} + +/** Get a SchemaVersion */ +export async function schemaVersionsGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + schemaVersionName: string, + options: SchemaVersionsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _schemaVersionsGetSend( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + schemaVersionName, + options, + ); + return _schemaVersionsGetDeserialize(result); +} + +export function _schemaVersionsCreateOrReplaceSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + schemaVersionName: string, + resource: SchemaVersion, + options: SchemaVersionsCreateOrReplaceOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName}", + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + schemaVersionName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: schemaVersionSerializer(resource), + }); +} + +export async function _schemaVersionsCreateOrReplaceDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return schemaVersionDeserializer(result.body); +} + +/** Create a SchemaVersion */ +export async function schemaVersionsCreateOrReplace( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + schemaVersionName: string, + resource: SchemaVersion, + options: SchemaVersionsCreateOrReplaceOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _schemaVersionsCreateOrReplaceSend( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + schemaVersionName, + resource, + options, + ); + return _schemaVersionsCreateOrReplaceDeserialize(result); +} + +export function _schemaVersionsDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + schemaVersionName: string, + options: SchemaVersionsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName}", + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + schemaVersionName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _schemaVersionsDeleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Delete a SchemaVersion */ +export async function schemaVersionsDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + schemaVersionName: string, + options: SchemaVersionsDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _schemaVersionsDeleteSend( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + schemaVersionName, + options, + ); + return _schemaVersionsDeleteDeserialize(result); +} + +export function _schemaVersionsListBySchemaSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + options: SchemaVersionsListBySchemaOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions", + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _schemaVersionsListBySchemaDeserialize( + result: PathUncheckedResponse, +): Promise<_SchemaVersionListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _schemaVersionListResultDeserializer(result.body); +} + +/** List SchemaVersion resources by Schema */ +export function schemaVersionsListBySchema( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + options: SchemaVersionsListBySchemaOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _schemaVersionsListBySchemaSend( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + options, + ), + _schemaVersionsListBySchemaDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/api/schemas/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/api/schemas/index.ts new file mode 100644 index 000000000000..02e6987dea30 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/api/schemas/index.ts @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + DeviceRegistryManagementContext as Client, + SchemasCreateOrReplaceOptionalParams, + SchemasDeleteOptionalParams, + SchemasGetOptionalParams, + SchemasListBySchemaRegistryOptionalParams, +} from "../index.js"; +import { + Schema, + schemaSerializer, + schemaDeserializer, + _SchemaListResult, + _schemaListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _schemasGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + options: SchemasGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}", + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _schemasGetDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return schemaDeserializer(result.body); +} + +/** Get a Schema */ +export async function schemasGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + options: SchemasGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _schemasGetSend( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + options, + ); + return _schemasGetDeserialize(result); +} + +export function _schemasCreateOrReplaceSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + resource: Schema, + options: SchemasCreateOrReplaceOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}", + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: schemaSerializer(resource), + }); +} + +export async function _schemasCreateOrReplaceDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return schemaDeserializer(result.body); +} + +/** Create a Schema */ +export async function schemasCreateOrReplace( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + resource: Schema, + options: SchemasCreateOrReplaceOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _schemasCreateOrReplaceSend( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + resource, + options, + ); + return _schemasCreateOrReplaceDeserialize(result); +} + +export function _schemasDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + options: SchemasDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}", + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _schemasDeleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200", "204"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Delete a Schema */ +export async function schemasDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + options: SchemasDeleteOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _schemasDeleteSend( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + options, + ); + return _schemasDeleteDeserialize(result); +} + +export function _schemasListBySchemaRegistrySend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + options: SchemasListBySchemaRegistryOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas", + subscriptionId, + resourceGroupName, + schemaRegistryName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _schemasListBySchemaRegistryDeserialize( + result: PathUncheckedResponse, +): Promise<_SchemaListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _schemaListResultDeserializer(result.body); +} + +/** List Schema resources by SchemaRegistry */ +export function schemasListBySchemaRegistry( + context: Client, + subscriptionId: string, + resourceGroupName: string, + schemaRegistryName: string, + options: SchemasListBySchemaRegistryOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _schemasListBySchemaRegistrySend( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + options, + ), + _schemasListBySchemaRegistryDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/classic/assetEndpointProfiles/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/classic/assetEndpointProfiles/index.ts new file mode 100644 index 000000000000..d95f640203b7 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/classic/assetEndpointProfiles/index.ts @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementContext } from "../../api/deviceRegistryManagementContext.js"; +import { + assetEndpointProfilesGet, + assetEndpointProfilesCreateOrReplace, + assetEndpointProfilesUpdate, + assetEndpointProfilesDelete, + assetEndpointProfilesListByResourceGroup, + assetEndpointProfilesListBySubscription, +} from "../../api/assetEndpointProfiles/index.js"; +import { AssetEndpointProfile, AssetEndpointProfileUpdate } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; +import { + AssetEndpointProfilesGetOptionalParams, + AssetEndpointProfilesCreateOrReplaceOptionalParams, + AssetEndpointProfilesUpdateOptionalParams, + AssetEndpointProfilesDeleteOptionalParams, + AssetEndpointProfilesListByResourceGroupOptionalParams, + AssetEndpointProfilesListBySubscriptionOptionalParams, +} from "../../api/options.js"; + +/** Interface representing a AssetEndpointProfiles operations. */ +export interface AssetEndpointProfilesOperations { + /** Get a AssetEndpointProfile */ + get: ( + resourceGroupName: string, + assetEndpointProfileName: string, + options?: AssetEndpointProfilesGetOptionalParams, + ) => Promise; + /** Create a AssetEndpointProfile */ + createOrReplace: ( + resourceGroupName: string, + assetEndpointProfileName: string, + resource: AssetEndpointProfile, + options?: AssetEndpointProfilesCreateOrReplaceOptionalParams, + ) => PollerLike, AssetEndpointProfile>; + /** Update a AssetEndpointProfile */ + update: ( + resourceGroupName: string, + assetEndpointProfileName: string, + properties: AssetEndpointProfileUpdate, + options?: AssetEndpointProfilesUpdateOptionalParams, + ) => PollerLike, AssetEndpointProfile>; + /** Delete a AssetEndpointProfile */ + delete: ( + resourceGroupName: string, + assetEndpointProfileName: string, + options?: AssetEndpointProfilesDeleteOptionalParams, + ) => PollerLike, void>; + /** List AssetEndpointProfile resources by resource group */ + listByResourceGroup: ( + resourceGroupName: string, + options?: AssetEndpointProfilesListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** List AssetEndpointProfile resources by subscription ID */ + listBySubscription: ( + options?: AssetEndpointProfilesListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getAssetEndpointProfiles( + context: DeviceRegistryManagementContext, + subscriptionId: string, +) { + return { + get: ( + resourceGroupName: string, + assetEndpointProfileName: string, + options?: AssetEndpointProfilesGetOptionalParams, + ) => + assetEndpointProfilesGet( + context, + subscriptionId, + resourceGroupName, + assetEndpointProfileName, + options, + ), + createOrReplace: ( + resourceGroupName: string, + assetEndpointProfileName: string, + resource: AssetEndpointProfile, + options?: AssetEndpointProfilesCreateOrReplaceOptionalParams, + ) => + assetEndpointProfilesCreateOrReplace( + context, + subscriptionId, + resourceGroupName, + assetEndpointProfileName, + resource, + options, + ), + update: ( + resourceGroupName: string, + assetEndpointProfileName: string, + properties: AssetEndpointProfileUpdate, + options?: AssetEndpointProfilesUpdateOptionalParams, + ) => + assetEndpointProfilesUpdate( + context, + subscriptionId, + resourceGroupName, + assetEndpointProfileName, + properties, + options, + ), + delete: ( + resourceGroupName: string, + assetEndpointProfileName: string, + options?: AssetEndpointProfilesDeleteOptionalParams, + ) => + assetEndpointProfilesDelete( + context, + subscriptionId, + resourceGroupName, + assetEndpointProfileName, + options, + ), + listByResourceGroup: ( + resourceGroupName: string, + options?: AssetEndpointProfilesListByResourceGroupOptionalParams, + ) => + assetEndpointProfilesListByResourceGroup(context, subscriptionId, resourceGroupName, options), + listBySubscription: (options?: AssetEndpointProfilesListBySubscriptionOptionalParams) => + assetEndpointProfilesListBySubscription(context, subscriptionId, options), + }; +} + +export function getAssetEndpointProfilesOperations( + context: DeviceRegistryManagementContext, + subscriptionId: string, +): AssetEndpointProfilesOperations { + return { + ...getAssetEndpointProfiles(context, subscriptionId), + }; +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/classic/assets/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/classic/assets/index.ts new file mode 100644 index 000000000000..895744a22854 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/classic/assets/index.ts @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementContext } from "../../api/deviceRegistryManagementContext.js"; +import { + assetsGet, + assetsCreateOrReplace, + assetsUpdate, + assetsDelete, + assetsListByResourceGroup, + assetsListBySubscription, +} from "../../api/assets/index.js"; +import { Asset, AssetUpdate } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; +import { + AssetsGetOptionalParams, + AssetsCreateOrReplaceOptionalParams, + AssetsUpdateOptionalParams, + AssetsDeleteOptionalParams, + AssetsListByResourceGroupOptionalParams, + AssetsListBySubscriptionOptionalParams, +} from "../../api/options.js"; + +/** Interface representing a Assets operations. */ +export interface AssetsOperations { + /** Get a Asset */ + get: ( + resourceGroupName: string, + assetName: string, + options?: AssetsGetOptionalParams, + ) => Promise; + /** Create a Asset */ + createOrReplace: ( + resourceGroupName: string, + assetName: string, + resource: Asset, + options?: AssetsCreateOrReplaceOptionalParams, + ) => PollerLike, Asset>; + /** Update a Asset */ + update: ( + resourceGroupName: string, + assetName: string, + properties: AssetUpdate, + options?: AssetsUpdateOptionalParams, + ) => PollerLike, Asset>; + /** Delete a Asset */ + delete: ( + resourceGroupName: string, + assetName: string, + options?: AssetsDeleteOptionalParams, + ) => PollerLike, void>; + /** List Asset resources by resource group */ + listByResourceGroup: ( + resourceGroupName: string, + options?: AssetsListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** List Asset resources by subscription ID */ + listBySubscription: ( + options?: AssetsListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getAssets(context: DeviceRegistryManagementContext, subscriptionId: string) { + return { + get: (resourceGroupName: string, assetName: string, options?: AssetsGetOptionalParams) => + assetsGet(context, subscriptionId, resourceGroupName, assetName, options), + createOrReplace: ( + resourceGroupName: string, + assetName: string, + resource: Asset, + options?: AssetsCreateOrReplaceOptionalParams, + ) => + assetsCreateOrReplace( + context, + subscriptionId, + resourceGroupName, + assetName, + resource, + options, + ), + update: ( + resourceGroupName: string, + assetName: string, + properties: AssetUpdate, + options?: AssetsUpdateOptionalParams, + ) => assetsUpdate(context, subscriptionId, resourceGroupName, assetName, properties, options), + delete: (resourceGroupName: string, assetName: string, options?: AssetsDeleteOptionalParams) => + assetsDelete(context, subscriptionId, resourceGroupName, assetName, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: AssetsListByResourceGroupOptionalParams, + ) => assetsListByResourceGroup(context, subscriptionId, resourceGroupName, options), + listBySubscription: (options?: AssetsListBySubscriptionOptionalParams) => + assetsListBySubscription(context, subscriptionId, options), + }; +} + +export function getAssetsOperations( + context: DeviceRegistryManagementContext, + subscriptionId: string, +): AssetsOperations { + return { + ...getAssets(context, subscriptionId), + }; +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/classic/billingContainers/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/classic/billingContainers/index.ts new file mode 100644 index 000000000000..c93104da6feb --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/classic/billingContainers/index.ts @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementContext } from "../../api/deviceRegistryManagementContext.js"; +import { + billingContainersGet, + billingContainersListBySubscription, +} from "../../api/billingContainers/index.js"; +import { BillingContainer } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { + BillingContainersGetOptionalParams, + BillingContainersListBySubscriptionOptionalParams, +} from "../../api/options.js"; + +/** Interface representing a BillingContainers operations. */ +export interface BillingContainersOperations { + /** Get a BillingContainer */ + get: ( + billingContainerName: string, + options?: BillingContainersGetOptionalParams, + ) => Promise; + /** List BillingContainer resources by subscription ID */ + listBySubscription: ( + options?: BillingContainersListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getBillingContainers( + context: DeviceRegistryManagementContext, + subscriptionId: string, +) { + return { + get: (billingContainerName: string, options?: BillingContainersGetOptionalParams) => + billingContainersGet(context, subscriptionId, billingContainerName, options), + listBySubscription: (options?: BillingContainersListBySubscriptionOptionalParams) => + billingContainersListBySubscription(context, subscriptionId, options), + }; +} + +export function getBillingContainersOperations( + context: DeviceRegistryManagementContext, + subscriptionId: string, +): BillingContainersOperations { + return { + ...getBillingContainers(context, subscriptionId), + }; +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/classic/discoveredAssetEndpointProfiles/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/classic/discoveredAssetEndpointProfiles/index.ts new file mode 100644 index 000000000000..2eff295abc90 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/classic/discoveredAssetEndpointProfiles/index.ts @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementContext } from "../../api/deviceRegistryManagementContext.js"; +import { + discoveredAssetEndpointProfilesGet, + discoveredAssetEndpointProfilesCreateOrReplace, + discoveredAssetEndpointProfilesUpdate, + discoveredAssetEndpointProfilesDelete, + discoveredAssetEndpointProfilesListByResourceGroup, + discoveredAssetEndpointProfilesListBySubscription, +} from "../../api/discoveredAssetEndpointProfiles/index.js"; +import { + DiscoveredAssetEndpointProfilesGetOptionalParams, + DiscoveredAssetEndpointProfilesCreateOrReplaceOptionalParams, + DiscoveredAssetEndpointProfilesUpdateOptionalParams, + DiscoveredAssetEndpointProfilesDeleteOptionalParams, + DiscoveredAssetEndpointProfilesListByResourceGroupOptionalParams, + DiscoveredAssetEndpointProfilesListBySubscriptionOptionalParams, +} from "../../api/options.js"; +import { + DiscoveredAssetEndpointProfile, + DiscoveredAssetEndpointProfileUpdate, +} from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a DiscoveredAssetEndpointProfiles operations. */ +export interface DiscoveredAssetEndpointProfilesOperations { + /** Get a DiscoveredAssetEndpointProfile */ + get: ( + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + options?: DiscoveredAssetEndpointProfilesGetOptionalParams, + ) => Promise; + /** Create a DiscoveredAssetEndpointProfile */ + createOrReplace: ( + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + resource: DiscoveredAssetEndpointProfile, + options?: DiscoveredAssetEndpointProfilesCreateOrReplaceOptionalParams, + ) => PollerLike, DiscoveredAssetEndpointProfile>; + /** Update a DiscoveredAssetEndpointProfile */ + update: ( + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + properties: DiscoveredAssetEndpointProfileUpdate, + options?: DiscoveredAssetEndpointProfilesUpdateOptionalParams, + ) => PollerLike, DiscoveredAssetEndpointProfile>; + /** Delete a DiscoveredAssetEndpointProfile */ + delete: ( + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + options?: DiscoveredAssetEndpointProfilesDeleteOptionalParams, + ) => PollerLike, void>; + /** List DiscoveredAssetEndpointProfile resources by resource group */ + listByResourceGroup: ( + resourceGroupName: string, + options?: DiscoveredAssetEndpointProfilesListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** List DiscoveredAssetEndpointProfile resources by subscription ID */ + listBySubscription: ( + options?: DiscoveredAssetEndpointProfilesListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getDiscoveredAssetEndpointProfiles( + context: DeviceRegistryManagementContext, + subscriptionId: string, +) { + return { + get: ( + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + options?: DiscoveredAssetEndpointProfilesGetOptionalParams, + ) => + discoveredAssetEndpointProfilesGet( + context, + subscriptionId, + resourceGroupName, + discoveredAssetEndpointProfileName, + options, + ), + createOrReplace: ( + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + resource: DiscoveredAssetEndpointProfile, + options?: DiscoveredAssetEndpointProfilesCreateOrReplaceOptionalParams, + ) => + discoveredAssetEndpointProfilesCreateOrReplace( + context, + subscriptionId, + resourceGroupName, + discoveredAssetEndpointProfileName, + resource, + options, + ), + update: ( + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + properties: DiscoveredAssetEndpointProfileUpdate, + options?: DiscoveredAssetEndpointProfilesUpdateOptionalParams, + ) => + discoveredAssetEndpointProfilesUpdate( + context, + subscriptionId, + resourceGroupName, + discoveredAssetEndpointProfileName, + properties, + options, + ), + delete: ( + resourceGroupName: string, + discoveredAssetEndpointProfileName: string, + options?: DiscoveredAssetEndpointProfilesDeleteOptionalParams, + ) => + discoveredAssetEndpointProfilesDelete( + context, + subscriptionId, + resourceGroupName, + discoveredAssetEndpointProfileName, + options, + ), + listByResourceGroup: ( + resourceGroupName: string, + options?: DiscoveredAssetEndpointProfilesListByResourceGroupOptionalParams, + ) => + discoveredAssetEndpointProfilesListByResourceGroup( + context, + subscriptionId, + resourceGroupName, + options, + ), + listBySubscription: ( + options?: DiscoveredAssetEndpointProfilesListBySubscriptionOptionalParams, + ) => discoveredAssetEndpointProfilesListBySubscription(context, subscriptionId, options), + }; +} + +export function getDiscoveredAssetEndpointProfilesOperations( + context: DeviceRegistryManagementContext, + subscriptionId: string, +): DiscoveredAssetEndpointProfilesOperations { + return { + ...getDiscoveredAssetEndpointProfiles(context, subscriptionId), + }; +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/classic/discoveredAssets/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/classic/discoveredAssets/index.ts new file mode 100644 index 000000000000..1f9e8ee33534 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/classic/discoveredAssets/index.ts @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementContext } from "../../api/deviceRegistryManagementContext.js"; +import { + discoveredAssetsGet, + discoveredAssetsCreateOrReplace, + discoveredAssetsUpdate, + discoveredAssetsDelete, + discoveredAssetsListByResourceGroup, + discoveredAssetsListBySubscription, +} from "../../api/discoveredAssets/index.js"; +import { + DiscoveredAssetsGetOptionalParams, + DiscoveredAssetsCreateOrReplaceOptionalParams, + DiscoveredAssetsUpdateOptionalParams, + DiscoveredAssetsDeleteOptionalParams, + DiscoveredAssetsListByResourceGroupOptionalParams, + DiscoveredAssetsListBySubscriptionOptionalParams, +} from "../../api/options.js"; +import { DiscoveredAsset, DiscoveredAssetUpdate } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a DiscoveredAssets operations. */ +export interface DiscoveredAssetsOperations { + /** Get a DiscoveredAsset */ + get: ( + resourceGroupName: string, + discoveredAssetName: string, + options?: DiscoveredAssetsGetOptionalParams, + ) => Promise; + /** Create a DiscoveredAsset */ + createOrReplace: ( + resourceGroupName: string, + discoveredAssetName: string, + resource: DiscoveredAsset, + options?: DiscoveredAssetsCreateOrReplaceOptionalParams, + ) => PollerLike, DiscoveredAsset>; + /** Update a DiscoveredAsset */ + update: ( + resourceGroupName: string, + discoveredAssetName: string, + properties: DiscoveredAssetUpdate, + options?: DiscoveredAssetsUpdateOptionalParams, + ) => PollerLike, DiscoveredAsset>; + /** Delete a DiscoveredAsset */ + delete: ( + resourceGroupName: string, + discoveredAssetName: string, + options?: DiscoveredAssetsDeleteOptionalParams, + ) => PollerLike, void>; + /** List DiscoveredAsset resources by resource group */ + listByResourceGroup: ( + resourceGroupName: string, + options?: DiscoveredAssetsListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** List DiscoveredAsset resources by subscription ID */ + listBySubscription: ( + options?: DiscoveredAssetsListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getDiscoveredAssets( + context: DeviceRegistryManagementContext, + subscriptionId: string, +) { + return { + get: ( + resourceGroupName: string, + discoveredAssetName: string, + options?: DiscoveredAssetsGetOptionalParams, + ) => + discoveredAssetsGet(context, subscriptionId, resourceGroupName, discoveredAssetName, options), + createOrReplace: ( + resourceGroupName: string, + discoveredAssetName: string, + resource: DiscoveredAsset, + options?: DiscoveredAssetsCreateOrReplaceOptionalParams, + ) => + discoveredAssetsCreateOrReplace( + context, + subscriptionId, + resourceGroupName, + discoveredAssetName, + resource, + options, + ), + update: ( + resourceGroupName: string, + discoveredAssetName: string, + properties: DiscoveredAssetUpdate, + options?: DiscoveredAssetsUpdateOptionalParams, + ) => + discoveredAssetsUpdate( + context, + subscriptionId, + resourceGroupName, + discoveredAssetName, + properties, + options, + ), + delete: ( + resourceGroupName: string, + discoveredAssetName: string, + options?: DiscoveredAssetsDeleteOptionalParams, + ) => + discoveredAssetsDelete( + context, + subscriptionId, + resourceGroupName, + discoveredAssetName, + options, + ), + listByResourceGroup: ( + resourceGroupName: string, + options?: DiscoveredAssetsListByResourceGroupOptionalParams, + ) => discoveredAssetsListByResourceGroup(context, subscriptionId, resourceGroupName, options), + listBySubscription: (options?: DiscoveredAssetsListBySubscriptionOptionalParams) => + discoveredAssetsListBySubscription(context, subscriptionId, options), + }; +} + +export function getDiscoveredAssetsOperations( + context: DeviceRegistryManagementContext, + subscriptionId: string, +): DiscoveredAssetsOperations { + return { + ...getDiscoveredAssets(context, subscriptionId), + }; +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/classic/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/classic/index.ts new file mode 100644 index 000000000000..26cef27446ea --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/classic/index.ts @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { AssetEndpointProfilesOperations } from "./assetEndpointProfiles/index.js"; +export { AssetsOperations } from "./assets/index.js"; +export { BillingContainersOperations } from "./billingContainers/index.js"; +export { DiscoveredAssetEndpointProfilesOperations } from "./discoveredAssetEndpointProfiles/index.js"; +export { DiscoveredAssetsOperations } from "./discoveredAssets/index.js"; +export { OperationsOperations } from "./operations/index.js"; +export { OperationStatusOperations } from "./operationStatus/index.js"; +export { SchemaRegistriesOperations } from "./schemaRegistries/index.js"; +export { SchemasOperations } from "./schemas/index.js"; +export { SchemaVersionsOperations } from "./schemaVersions/index.js"; diff --git a/sdk/deviceregistry/arm-deviceregistry/src/classic/operationStatus/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/classic/operationStatus/index.ts new file mode 100644 index 000000000000..a64b63c9899d --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/classic/operationStatus/index.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementContext } from "../../api/deviceRegistryManagementContext.js"; +import { operationStatusGet } from "../../api/operationStatus/index.js"; +import { OperationStatusGetOptionalParams } from "../../api/options.js"; +import { OperationStatusResult } from "../../models/models.js"; + +/** Interface representing a OperationStatus operations. */ +export interface OperationStatusOperations { + /** Returns the current status of an async operation. */ + get: ( + location: string, + operationId: string, + options?: OperationStatusGetOptionalParams, + ) => Promise; +} + +export function getOperationStatus( + context: DeviceRegistryManagementContext, + subscriptionId: string, +) { + return { + get: (location: string, operationId: string, options?: OperationStatusGetOptionalParams) => + operationStatusGet(context, subscriptionId, location, operationId, options), + }; +} + +export function getOperationStatusOperations( + context: DeviceRegistryManagementContext, + subscriptionId: string, +): OperationStatusOperations { + return { + ...getOperationStatus(context, subscriptionId), + }; +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/classic/operations/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/classic/operations/index.ts new file mode 100644 index 000000000000..173fa4f5feaa --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/classic/operations/index.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementContext } from "../../api/deviceRegistryManagementContext.js"; +import { operationsList } from "../../api/operations/index.js"; +import { OperationsListOptionalParams } from "../../api/options.js"; +import { Operation } from "../../models/models.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; +} + +export function getOperations(context: DeviceRegistryManagementContext) { + return { + list: (options?: OperationsListOptionalParams) => operationsList(context, options), + }; +} + +export function getOperationsOperations( + context: DeviceRegistryManagementContext, +): OperationsOperations { + return { + ...getOperations(context), + }; +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/classic/schemaRegistries/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/classic/schemaRegistries/index.ts new file mode 100644 index 000000000000..36b541503ed4 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/classic/schemaRegistries/index.ts @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementContext } from "../../api/deviceRegistryManagementContext.js"; +import { + SchemaRegistriesGetOptionalParams, + SchemaRegistriesCreateOrReplaceOptionalParams, + SchemaRegistriesUpdateOptionalParams, + SchemaRegistriesDeleteOptionalParams, + SchemaRegistriesListByResourceGroupOptionalParams, + SchemaRegistriesListBySubscriptionOptionalParams, +} from "../../api/options.js"; +import { + schemaRegistriesGet, + schemaRegistriesCreateOrReplace, + schemaRegistriesUpdate, + schemaRegistriesDelete, + schemaRegistriesListByResourceGroup, + schemaRegistriesListBySubscription, +} from "../../api/schemaRegistries/index.js"; +import { SchemaRegistry, SchemaRegistryUpdate } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a SchemaRegistries operations. */ +export interface SchemaRegistriesOperations { + /** Get a SchemaRegistry */ + get: ( + resourceGroupName: string, + schemaRegistryName: string, + options?: SchemaRegistriesGetOptionalParams, + ) => Promise; + /** Create a SchemaRegistry */ + createOrReplace: ( + resourceGroupName: string, + schemaRegistryName: string, + resource: SchemaRegistry, + options?: SchemaRegistriesCreateOrReplaceOptionalParams, + ) => PollerLike, SchemaRegistry>; + /** Update a SchemaRegistry */ + update: ( + resourceGroupName: string, + schemaRegistryName: string, + properties: SchemaRegistryUpdate, + options?: SchemaRegistriesUpdateOptionalParams, + ) => PollerLike, SchemaRegistry>; + /** Delete a SchemaRegistry */ + delete: ( + resourceGroupName: string, + schemaRegistryName: string, + options?: SchemaRegistriesDeleteOptionalParams, + ) => PollerLike, void>; + /** List SchemaRegistry resources by resource group */ + listByResourceGroup: ( + resourceGroupName: string, + options?: SchemaRegistriesListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** List SchemaRegistry resources by subscription ID */ + listBySubscription: ( + options?: SchemaRegistriesListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getSchemaRegistries( + context: DeviceRegistryManagementContext, + subscriptionId: string, +) { + return { + get: ( + resourceGroupName: string, + schemaRegistryName: string, + options?: SchemaRegistriesGetOptionalParams, + ) => + schemaRegistriesGet(context, subscriptionId, resourceGroupName, schemaRegistryName, options), + createOrReplace: ( + resourceGroupName: string, + schemaRegistryName: string, + resource: SchemaRegistry, + options?: SchemaRegistriesCreateOrReplaceOptionalParams, + ) => + schemaRegistriesCreateOrReplace( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + resource, + options, + ), + update: ( + resourceGroupName: string, + schemaRegistryName: string, + properties: SchemaRegistryUpdate, + options?: SchemaRegistriesUpdateOptionalParams, + ) => + schemaRegistriesUpdate( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + properties, + options, + ), + delete: ( + resourceGroupName: string, + schemaRegistryName: string, + options?: SchemaRegistriesDeleteOptionalParams, + ) => + schemaRegistriesDelete( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + options, + ), + listByResourceGroup: ( + resourceGroupName: string, + options?: SchemaRegistriesListByResourceGroupOptionalParams, + ) => schemaRegistriesListByResourceGroup(context, subscriptionId, resourceGroupName, options), + listBySubscription: (options?: SchemaRegistriesListBySubscriptionOptionalParams) => + schemaRegistriesListBySubscription(context, subscriptionId, options), + }; +} + +export function getSchemaRegistriesOperations( + context: DeviceRegistryManagementContext, + subscriptionId: string, +): SchemaRegistriesOperations { + return { + ...getSchemaRegistries(context, subscriptionId), + }; +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/classic/schemaVersions/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/classic/schemaVersions/index.ts new file mode 100644 index 000000000000..5a6b9ac3275e --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/classic/schemaVersions/index.ts @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementContext } from "../../api/deviceRegistryManagementContext.js"; +import { + SchemaVersionsGetOptionalParams, + SchemaVersionsCreateOrReplaceOptionalParams, + SchemaVersionsDeleteOptionalParams, + SchemaVersionsListBySchemaOptionalParams, +} from "../../api/options.js"; +import { + schemaVersionsGet, + schemaVersionsCreateOrReplace, + schemaVersionsDelete, + schemaVersionsListBySchema, +} from "../../api/schemaVersions/index.js"; +import { SchemaVersion } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a SchemaVersions operations. */ +export interface SchemaVersionsOperations { + /** Get a SchemaVersion */ + get: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + schemaVersionName: string, + options?: SchemaVersionsGetOptionalParams, + ) => Promise; + /** Create a SchemaVersion */ + createOrReplace: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + schemaVersionName: string, + resource: SchemaVersion, + options?: SchemaVersionsCreateOrReplaceOptionalParams, + ) => Promise; + /** Delete a SchemaVersion */ + delete: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + schemaVersionName: string, + options?: SchemaVersionsDeleteOptionalParams, + ) => Promise; + /** List SchemaVersion resources by Schema */ + listBySchema: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + options?: SchemaVersionsListBySchemaOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getSchemaVersions( + context: DeviceRegistryManagementContext, + subscriptionId: string, +) { + return { + get: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + schemaVersionName: string, + options?: SchemaVersionsGetOptionalParams, + ) => + schemaVersionsGet( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + schemaVersionName, + options, + ), + createOrReplace: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + schemaVersionName: string, + resource: SchemaVersion, + options?: SchemaVersionsCreateOrReplaceOptionalParams, + ) => + schemaVersionsCreateOrReplace( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + schemaVersionName, + resource, + options, + ), + delete: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + schemaVersionName: string, + options?: SchemaVersionsDeleteOptionalParams, + ) => + schemaVersionsDelete( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + schemaVersionName, + options, + ), + listBySchema: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + options?: SchemaVersionsListBySchemaOptionalParams, + ) => + schemaVersionsListBySchema( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + options, + ), + }; +} + +export function getSchemaVersionsOperations( + context: DeviceRegistryManagementContext, + subscriptionId: string, +): SchemaVersionsOperations { + return { + ...getSchemaVersions(context, subscriptionId), + }; +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/classic/schemas/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/classic/schemas/index.ts new file mode 100644 index 000000000000..d727e71ce43a --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/classic/schemas/index.ts @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementContext } from "../../api/deviceRegistryManagementContext.js"; +import { + SchemasGetOptionalParams, + SchemasCreateOrReplaceOptionalParams, + SchemasDeleteOptionalParams, + SchemasListBySchemaRegistryOptionalParams, +} from "../../api/options.js"; +import { + schemasGet, + schemasCreateOrReplace, + schemasDelete, + schemasListBySchemaRegistry, +} from "../../api/schemas/index.js"; +import { Schema } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Schemas operations. */ +export interface SchemasOperations { + /** Get a Schema */ + get: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + options?: SchemasGetOptionalParams, + ) => Promise; + /** Create a Schema */ + createOrReplace: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + resource: Schema, + options?: SchemasCreateOrReplaceOptionalParams, + ) => Promise; + /** Delete a Schema */ + delete: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + options?: SchemasDeleteOptionalParams, + ) => Promise; + /** List Schema resources by SchemaRegistry */ + listBySchemaRegistry: ( + resourceGroupName: string, + schemaRegistryName: string, + options?: SchemasListBySchemaRegistryOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getSchemas(context: DeviceRegistryManagementContext, subscriptionId: string) { + return { + get: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + options?: SchemasGetOptionalParams, + ) => + schemasGet( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + options, + ), + createOrReplace: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + resource: Schema, + options?: SchemasCreateOrReplaceOptionalParams, + ) => + schemasCreateOrReplace( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + resource, + options, + ), + delete: ( + resourceGroupName: string, + schemaRegistryName: string, + schemaName: string, + options?: SchemasDeleteOptionalParams, + ) => + schemasDelete( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + schemaName, + options, + ), + listBySchemaRegistry: ( + resourceGroupName: string, + schemaRegistryName: string, + options?: SchemasListBySchemaRegistryOptionalParams, + ) => + schemasListBySchemaRegistry( + context, + subscriptionId, + resourceGroupName, + schemaRegistryName, + options, + ), + }; +} + +export function getSchemasOperations( + context: DeviceRegistryManagementContext, + subscriptionId: string, +): SchemasOperations { + return { + ...getSchemas(context, subscriptionId), + }; +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/deviceRegistryManagementClient.ts b/sdk/deviceregistry/arm-deviceregistry/src/deviceRegistryManagementClient.ts index 75bf41a030a9..1bb328d05126 100644 --- a/sdk/deviceregistry/arm-deviceregistry/src/deviceRegistryManagementClient.ts +++ b/sdk/deviceregistry/arm-deviceregistry/src/deviceRegistryManagementClient.ts @@ -1,157 +1,100 @@ -/* - * 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 * as coreClient from "@azure/core-client"; -import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { getOperationsOperations, OperationsOperations } from "./classic/operations/index.js"; import { - PipelineRequest, - PipelineResponse, - SendRequest, -} from "@azure/core-rest-pipeline"; -import * as coreAuth from "@azure/core-auth"; + getOperationStatusOperations, + OperationStatusOperations, +} from "./classic/operationStatus/index.js"; +import { getAssetsOperations, AssetsOperations } from "./classic/assets/index.js"; import { - OperationsImpl, - AssetEndpointProfilesImpl, - AssetsImpl, - OperationStatusImpl, -} from "./operations"; + getAssetEndpointProfilesOperations, + AssetEndpointProfilesOperations, +} from "./classic/assetEndpointProfiles/index.js"; import { - Operations, - AssetEndpointProfiles, - Assets, - OperationStatus, -} from "./operationsInterfaces"; -import { DeviceRegistryManagementClientOptionalParams } from "./models"; + getBillingContainersOperations, + BillingContainersOperations, +} from "./classic/billingContainers/index.js"; +import { + getDiscoveredAssetsOperations, + DiscoveredAssetsOperations, +} from "./classic/discoveredAssets/index.js"; +import { + getDiscoveredAssetEndpointProfilesOperations, + DiscoveredAssetEndpointProfilesOperations, +} from "./classic/discoveredAssetEndpointProfiles/index.js"; +import { + getSchemaRegistriesOperations, + SchemaRegistriesOperations, +} from "./classic/schemaRegistries/index.js"; +import { getSchemasOperations, SchemasOperations } from "./classic/schemas/index.js"; +import { + getSchemaVersionsOperations, + SchemaVersionsOperations, +} from "./classic/schemaVersions/index.js"; +import { + createDeviceRegistryManagement, + DeviceRegistryManagementContext, + DeviceRegistryManagementClientOptionalParams, +} from "./api/index.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { TokenCredential } from "@azure/core-auth"; + +export { DeviceRegistryManagementClientOptionalParams } from "./api/deviceRegistryManagementContext.js"; -export class DeviceRegistryManagementClient extends coreClient.ServiceClient { - $host: string; - apiVersion: string; - subscriptionId: string; +export class DeviceRegistryManagementClient { + private _client: DeviceRegistryManagementContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; - /** - * Initializes a new instance of the DeviceRegistryManagementClient class. - * @param credentials Subscription credentials which uniquely identify client subscription. - * @param subscriptionId The ID of the target subscription. - * @param options The parameter options - */ + /** Microsoft.DeviceRegistry Resource Provider management API. */ constructor( - credentials: coreAuth.TokenCredential, + credential: TokenCredential, subscriptionId: string, - options?: DeviceRegistryManagementClientOptionalParams, + options: DeviceRegistryManagementClientOptionalParams = {}, ) { - 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: DeviceRegistryManagementClientOptionalParams = { - requestContentType: "application/json; charset=utf-8", - credential: credentials, - }; - - const packageDetails = `azsdk-js-arm-deviceregistry/1.0.0-beta.2`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; - - const optionsWithDefaults = { - ...defaults, + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createDeviceRegistryManagement(credential, { ...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 || "2023-11-01-preview"; - this.operations = new OperationsImpl(this); - this.assetEndpointProfiles = new AssetEndpointProfilesImpl(this); - this.assets = new AssetsImpl(this); - this.operationStatus = new OperationStatusImpl(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); + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.operations = getOperationsOperations(this._client); + this.operationStatus = getOperationStatusOperations(this._client, subscriptionId); + this.assets = getAssetsOperations(this._client, subscriptionId); + this.assetEndpointProfiles = getAssetEndpointProfilesOperations(this._client, subscriptionId); + this.billingContainers = getBillingContainersOperations(this._client, subscriptionId); + this.discoveredAssets = getDiscoveredAssetsOperations(this._client, subscriptionId); + this.discoveredAssetEndpointProfiles = getDiscoveredAssetEndpointProfilesOperations( + this._client, + subscriptionId, + ); + this.schemaRegistries = getSchemaRegistriesOperations(this._client, subscriptionId); + this.schemas = getSchemasOperations(this._client, subscriptionId); + this.schemaVersions = getSchemaVersionsOperations(this._client, subscriptionId); } - operations: Operations; - assetEndpointProfiles: AssetEndpointProfiles; - assets: Assets; - operationStatus: OperationStatus; + /** The operation groups for Operations */ + public readonly operations: OperationsOperations; + /** The operation groups for OperationStatus */ + public readonly operationStatus: OperationStatusOperations; + /** The operation groups for Assets */ + public readonly assets: AssetsOperations; + /** The operation groups for AssetEndpointProfiles */ + public readonly assetEndpointProfiles: AssetEndpointProfilesOperations; + /** The operation groups for BillingContainers */ + public readonly billingContainers: BillingContainersOperations; + /** The operation groups for DiscoveredAssets */ + public readonly discoveredAssets: DiscoveredAssetsOperations; + /** The operation groups for DiscoveredAssetEndpointProfiles */ + public readonly discoveredAssetEndpointProfiles: DiscoveredAssetEndpointProfilesOperations; + /** The operation groups for SchemaRegistries */ + public readonly schemaRegistries: SchemaRegistriesOperations; + /** The operation groups for Schemas */ + public readonly schemas: SchemasOperations; + /** The operation groups for SchemaVersions */ + public readonly schemaVersions: SchemaVersionsOperations; } diff --git a/sdk/deviceregistry/arm-deviceregistry/src/helpers/serializerHelpers.ts b/sdk/deviceregistry/arm-deviceregistry/src/helpers/serializerHelpers.ts new file mode 100644 index 000000000000..7518a16c2ee9 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/helpers/serializerHelpers.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export function serializeRecord( + item: Record, +): Record; +export function serializeRecord( + item: Record, + serializer: (item: T) => R, +): Record; +export function serializeRecord( + item: Record, + serializer?: (item: T) => R, +): Record { + return Object.keys(item).reduce( + (acc, key) => { + if (isSupportedRecordType(item[key])) { + acc[key] = item[key] as any; + } else if (serializer) { + const value = item[key]; + if (value !== undefined) { + acc[key] = serializer(value); + } + } else { + console.warn(`Don't know how to serialize ${item[key]}`); + acc[key] = item[key] as any; + } + return acc; + }, + {} as Record, + ); +} + +function isSupportedRecordType(t: any) { + return ["number", "string", "boolean", "null"].includes(typeof t) || t instanceof Date; +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/index.ts index 282aa26cdb42..46a6f6570713 100644 --- a/sdk/deviceregistry/arm-deviceregistry/src/index.ts +++ b/sdk/deviceregistry/arm-deviceregistry/src/index.ts @@ -1,13 +1,150 @@ -/* - * 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"; -export * from "./models"; -export { DeviceRegistryManagementClient } from "./deviceRegistryManagementClient"; -export * from "./operationsInterfaces"; +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; + +export { DeviceRegistryManagementClient } from "./deviceRegistryManagementClient.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + SchemaVersion, + SchemaVersionProperties, + KnownProvisioningState, + ProvisioningState, + ProxyResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + ErrorDetail, + ErrorAdditionalInfo, + Schema, + SchemaProperties, + KnownFormat, + Format, + KnownSchemaType, + SchemaType, + SchemaRegistry, + SchemaRegistryProperties, + SystemAssignedServiceIdentity, + KnownSystemAssignedServiceIdentityType, + SystemAssignedServiceIdentityType, + TrackedResource, + SchemaRegistryUpdate, + SchemaRegistryUpdateProperties, + DiscoveredAssetEndpointProfile, + DiscoveredAssetEndpointProfileProperties, + KnownAuthenticationMethod, + AuthenticationMethod, + ExtendedLocation, + DiscoveredAssetEndpointProfileUpdate, + DiscoveredAssetEndpointProfileUpdateProperties, + DiscoveredAsset, + DiscoveredAssetProperties, + Topic, + KnownTopicRetainType, + TopicRetainType, + DiscoveredDataset, + DiscoveredDataPoint, + DiscoveredEvent, + DiscoveredAssetUpdate, + DiscoveredAssetUpdateProperties, + BillingContainer, + BillingContainerProperties, + AssetEndpointProfile, + AssetEndpointProfileProperties, + Authentication, + UsernamePasswordCredentials, + X509Credentials, + AssetEndpointProfileStatus, + AssetEndpointProfileStatusError, + AssetEndpointProfileUpdate, + AssetEndpointProfileUpdateProperties, + Asset, + AssetProperties, + Dataset, + DataPoint, + KnownDataPointObservabilityMode, + DataPointObservabilityMode, + Event, + KnownEventObservabilityMode, + EventObservabilityMode, + AssetStatus, + AssetStatusError, + AssetStatusDataset, + MessageSchemaReference, + AssetStatusEvent, + DataPointBase, + EventBase, + AssetUpdate, + AssetUpdateProperties, + OperationStatusResult, + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + KnownVersions, +} from "./models/index.js"; +export { + DeviceRegistryManagementClientOptionalParams, + OperationsListOptionalParams, + OperationStatusGetOptionalParams, + AssetsGetOptionalParams, + AssetsCreateOrReplaceOptionalParams, + AssetsUpdateOptionalParams, + AssetsDeleteOptionalParams, + AssetsListByResourceGroupOptionalParams, + AssetsListBySubscriptionOptionalParams, + AssetEndpointProfilesGetOptionalParams, + AssetEndpointProfilesCreateOrReplaceOptionalParams, + AssetEndpointProfilesUpdateOptionalParams, + AssetEndpointProfilesDeleteOptionalParams, + AssetEndpointProfilesListByResourceGroupOptionalParams, + AssetEndpointProfilesListBySubscriptionOptionalParams, + BillingContainersGetOptionalParams, + BillingContainersListBySubscriptionOptionalParams, + DiscoveredAssetsGetOptionalParams, + DiscoveredAssetsCreateOrReplaceOptionalParams, + DiscoveredAssetsUpdateOptionalParams, + DiscoveredAssetsDeleteOptionalParams, + DiscoveredAssetsListByResourceGroupOptionalParams, + DiscoveredAssetsListBySubscriptionOptionalParams, + DiscoveredAssetEndpointProfilesGetOptionalParams, + DiscoveredAssetEndpointProfilesCreateOrReplaceOptionalParams, + DiscoveredAssetEndpointProfilesUpdateOptionalParams, + DiscoveredAssetEndpointProfilesDeleteOptionalParams, + DiscoveredAssetEndpointProfilesListByResourceGroupOptionalParams, + DiscoveredAssetEndpointProfilesListBySubscriptionOptionalParams, + SchemaRegistriesGetOptionalParams, + SchemaRegistriesCreateOrReplaceOptionalParams, + SchemaRegistriesUpdateOptionalParams, + SchemaRegistriesDeleteOptionalParams, + SchemaRegistriesListByResourceGroupOptionalParams, + SchemaRegistriesListBySubscriptionOptionalParams, + SchemasGetOptionalParams, + SchemasCreateOrReplaceOptionalParams, + SchemasDeleteOptionalParams, + SchemasListBySchemaRegistryOptionalParams, + SchemaVersionsGetOptionalParams, + SchemaVersionsCreateOrReplaceOptionalParams, + SchemaVersionsDeleteOptionalParams, + SchemaVersionsListBySchemaOptionalParams, +} from "./api/index.js"; +export { + AssetEndpointProfilesOperations, + AssetsOperations, + BillingContainersOperations, + DiscoveredAssetEndpointProfilesOperations, + DiscoveredAssetsOperations, + OperationsOperations, + OperationStatusOperations, + SchemaRegistriesOperations, + SchemasOperations, + SchemaVersionsOperations, +} from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/sdk/deviceregistry/arm-deviceregistry/src/logger.ts b/sdk/deviceregistry/arm-deviceregistry/src/logger.ts new file mode 100644 index 000000000000..4ed09ebc54a8 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/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-deviceregistry"); diff --git a/sdk/deviceregistry/arm-deviceregistry/src/lroImpl.ts b/sdk/deviceregistry/arm-deviceregistry/src/lroImpl.ts deleted file mode 100644 index 5f88efab981b..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/src/lroImpl.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 { 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/deviceregistry/arm-deviceregistry/src/models/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/models/index.ts index 9f8fc1b8b7ee..9d74b2d78782 100644 --- a/sdk/deviceregistry/arm-deviceregistry/src/models/index.ts +++ b/sdk/deviceregistry/arm-deviceregistry/src/models/index.ts @@ -1,866 +1,84 @@ -/* - * 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 AssetEndpointProfile list operation. */ -export interface AssetEndpointProfileListResult { - /** The AssetEndpointProfile items on this page */ - value: AssetEndpointProfile[]; - /** The link to the next page of items */ - nextLink?: string; -} - -/** Defines the Asset Endpoint Profile properties. */ -export interface AssetEndpointProfileProperties { - /** - * Globally unique, immutable, non-reusable id. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly uuid?: string; - /** The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. */ - targetAddress: string; - /** Defines the client authentication mechanism to the server. */ - userAuthentication?: UserAuthentication; - /** Defines the authentication mechanism for the southbound connector connecting to the shop floor/OT device. */ - transportAuthentication?: TransportAuthentication; - /** Contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). */ - additionalConfiguration?: string; - /** - * Provisioning state of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; -} - -/** Definition of the client authentication mechanism to the server. */ -export interface UserAuthentication { - /** Defines the mode to authenticate the user of the client at the server. */ - mode: UserAuthenticationMode; - /** Defines the username and password references when UsernamePassword user authentication mode is selected. */ - usernamePasswordCredentials?: UsernamePasswordCredentials; - /** Defines the certificate reference when Certificate user authentication mode is selected. */ - x509Credentials?: X509Credentials; -} - -/** The credentials for authentication mode UsernamePassword. */ -export interface UsernamePasswordCredentials { - /** A reference to secret containing the username. */ - usernameReference: string; - /** A reference to secret containing the password. */ - passwordReference: string; -} - -/** The x509 certificate for authentication mode Certificate. */ -export interface X509Credentials { - /** A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). */ - certificateReference: string; -} - -/** Definition of the authentication mechanism for the southbound connector. */ -export interface TransportAuthentication { - /** Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. */ - ownCertificates: OwnCertificate[]; -} - -/** Certificate or private key that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. */ -export interface OwnCertificate { - /** Certificate thumbprint. */ - certThumbprint?: string; - /** Secret Reference name (cert and private key). */ - certSecretReference?: string; - /** Secret Reference Name (Pfx or Pem password). */ - certPasswordReference?: string; -} - -/** The extended location. */ -export interface ExtendedLocation { - /** The extended location type. */ - type: string; - /** The extended location name. */ - name: string; -} - -/** 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 response of a Asset list operation. */ -export interface AssetListResult { - /** The Asset items on this page */ - value: Asset[]; - /** The link to the next page of items */ - nextLink?: string; -} - -/** Defines the asset properties. */ -export interface AssetProperties { - /** - * Globally unique, immutable, non-reusable id. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly uuid?: string; - /** Resource path to asset type (model) definition. */ - assetType?: string; - /** Enabled/Disabled status of the asset. */ - enabled?: boolean; - /** Asset id provided by the customer. */ - externalAssetId?: string; - /** Human-readable display name. */ - displayName?: string; - /** Human-readable description of the asset. */ - description?: string; - /** A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must have the format /. */ - assetEndpointProfileUri: string; - /** - * An integer that is incremented each time the resource is modified. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly version?: number; - /** Asset manufacturer name. */ - manufacturer?: string; - /** Asset manufacturer URI. */ - manufacturerUri?: string; - /** Asset model name. */ - model?: string; - /** Asset product code. */ - productCode?: string; - /** Revision number of the hardware. */ - hardwareRevision?: string; - /** Revision number of the software. */ - softwareRevision?: string; - /** Reference to the documentation. */ - documentationUri?: string; - /** Asset serial number. */ - serialNumber?: string; - /** A set of key-value pairs that contain custom attributes set by the customer. */ - attributes?: { [propertyName: string]: any }; - /** Protocol-specific default configuration for all data points. Each data point can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. */ - defaultDataPointsConfiguration?: string; - /** Protocol-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. */ - defaultEventsConfiguration?: string; - /** Array of data points that are part of the asset. Each data point can reference an asset type capability and have per-data point configuration. See below for more details for the definition of the dataPoints element. */ - dataPoints?: DataPoint[]; - /** Array of events that are part of the asset. Each event can reference an asset type capability and have per-event configuration. See below for more details about the definition of the events element. */ - events?: Event[]; - /** - * Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes status property for custom resources. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly status?: AssetStatus; - /** - * Provisioning state of the resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; -} - -/** Defines the data point properties. */ -export interface DataPoint { - /** The name of the data point. */ - name?: string; - /** The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the asset. */ - dataSource: string; - /** The path to the type definition of the capability (e.g. DTMI, OPC UA information model node id, etc.), for example dtmi:com:example:Robot:_contents:__prop1;1. */ - capabilityId?: string; - /** An indication of how the data point should be mapped to OpenTelemetry. */ - observabilityMode?: DataPointsObservabilityMode; - /** Protocol-specific configuration for the data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. */ - dataPointConfiguration?: string; -} - -/** Defines the event properties. */ -export interface Event { - /** The name of the event. */ - name?: string; - /** The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the asset. */ - eventNotifier: string; - /** The path to the type definition of the capability (e.g. DTMI, OPC UA information model node id, etc.), for example dtmi:com:example:Robot:_contents:__prop1;1. */ - capabilityId?: string; - /** An indication of how the event should be mapped to OpenTelemetry. */ - observabilityMode?: EventsObservabilityMode; - /** Protocol-specific configuration for the event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. */ - eventConfiguration?: string; -} - -/** Defines the asset status properties. */ -export interface AssetStatus { - /** Array object to transfer and persist errors that originate from the Edge. */ - errors?: AssetStatusError[]; - /** A read only incremental counter indicating the number of times the configuration has been modified from the perspective of the current actual (Edge) state of the Asset. Edge would be the only writer of this value and would sync back up to the cloud. In steady state, this should equal version. */ - version?: number; -} - -/** Defines the asset status error properties. */ -export interface AssetStatusError { - /** Error code for classification of errors (ex: 400, 404, 500, etc.). */ - code?: number; - /** Human readable helpful error message to provide additional context for error (ex: “capability Id 'foo' does not exist”). */ - message?: string; -} - -/** The current status of an async operation. */ -export interface OperationStatusResult { - /** Fully qualified ID for the async operation. */ - id?: string; - /** Name of the async operation. */ - name?: string; - /** Operation status. */ - status: string; - /** Percent of the operation that is complete. */ - percentComplete?: number; - /** The start time of the operation. */ - startTime?: Date; - /** The end time of the operation. */ - endTime?: Date; - /** The operations list. */ - operations?: OperationStatusResult[]; - /** If present, details of the operation error. */ - error?: ErrorDetail; -} - -/** The type used for update operations of the AssetEndpointProfile. */ -export interface AssetEndpointProfileUpdate { - /** Resource tags. */ - tags?: { [propertyName: string]: string }; - /** The updatable properties of the AssetEndpointProfile. */ - properties?: AssetEndpointProfileUpdateProperties; -} - -/** The updatable properties of the AssetEndpointProfile. */ -export interface AssetEndpointProfileUpdateProperties { - /** The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. */ - targetAddress?: string; - /** Defines the client authentication mechanism to the server. */ - userAuthentication?: UserAuthenticationUpdate; - /** Defines the authentication mechanism for the southbound connector connecting to the shop floor/OT device. */ - transportAuthentication?: TransportAuthenticationUpdate; - /** Contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). */ - additionalConfiguration?: string; -} - -/** Definition of the client authentication mechanism to the server. */ -export interface UserAuthenticationUpdate { - /** Defines the mode to authenticate the user of the client at the server. */ - mode?: UserAuthenticationMode; - /** Defines the username and password references when UsernamePassword user authentication mode is selected. */ - usernamePasswordCredentials?: UsernamePasswordCredentialsUpdate; - /** Defines the certificate reference when Certificate user authentication mode is selected. */ - x509Credentials?: X509CredentialsUpdate; -} - -/** The credentials for authentication mode UsernamePassword. */ -export interface UsernamePasswordCredentialsUpdate { - /** A reference to secret containing the username. */ - usernameReference?: string; - /** A reference to secret containing the password. */ - passwordReference?: string; -} - -/** The x509 certificate for authentication mode Certificate. */ -export interface X509CredentialsUpdate { - /** A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). */ - certificateReference?: string; -} - -/** Definition of the authentication mechanism for the southbound connector. */ -export interface TransportAuthenticationUpdate { - /** Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. */ - ownCertificates?: OwnCertificate[]; -} - -/** The type used for update operations of the Asset. */ -export interface AssetUpdate { - /** Resource tags. */ - tags?: { [propertyName: string]: string }; - /** The updatable properties of the Asset. */ - properties?: AssetUpdateProperties; -} - -/** The updatable properties of the Asset. */ -export interface AssetUpdateProperties { - /** Resource path to asset type (model) definition. */ - assetType?: string; - /** Enabled/Disabled status of the asset. */ - enabled?: boolean; - /** Human-readable display name. */ - displayName?: string; - /** Human-readable description of the asset. */ - description?: string; - /** Asset manufacturer name. */ - manufacturer?: string; - /** Asset manufacturer URI. */ - manufacturerUri?: string; - /** Asset model name. */ - model?: string; - /** Asset product code. */ - productCode?: string; - /** Revision number of the hardware. */ - hardwareRevision?: string; - /** Revision number of the software. */ - softwareRevision?: string; - /** Reference to the documentation. */ - documentationUri?: string; - /** Asset serial number. */ - serialNumber?: string; - /** A set of key-value pairs that contain custom attributes set by the customer. */ - attributes?: { [propertyName: string]: any }; - /** Protocol-specific default configuration for all data points. Each data point can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. */ - defaultDataPointsConfiguration?: string; - /** Protocol-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. */ - defaultEventsConfiguration?: string; - /** Array of data points that are part of the asset. Each data point can reference an asset type capability and have per-data point configuration. See below for more details for the definition of the dataPoints element. */ - dataPoints?: DataPoint[]; - /** Array of events that are part of the asset. Each event can reference an asset type capability and have per-event configuration. See below for more details about the definition of the events element. */ - events?: Event[]; -} - -/** 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; -} - -/** Asset Endpoint Profile definition. */ -export interface AssetEndpointProfile extends TrackedResource { - /** The resource-specific properties for this resource. */ - properties?: AssetEndpointProfileProperties; - /** The extended location. */ - extendedLocation: ExtendedLocation; -} - -/** Asset definition. */ -export interface Asset extends TrackedResource { - /** The resource-specific properties for this resource. */ - properties?: AssetProperties; - /** The extended location. */ - extendedLocation: ExtendedLocation; -} - -/** Defines headers for AssetEndpointProfiles_createOrReplace operation. */ -export interface AssetEndpointProfilesCreateOrReplaceHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for AssetEndpointProfiles_update operation. */ -export interface AssetEndpointProfilesUpdateHeaders { - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for AssetEndpointProfiles_delete operation. */ -export interface AssetEndpointProfilesDeleteHeaders { - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for Assets_createOrReplace operation. */ -export interface AssetsCreateOrReplaceHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for Assets_update operation. */ -export interface AssetsUpdateHeaders { - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for Assets_delete operation. */ -export interface AssetsDeleteHeaders { - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** 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 UserAuthenticationMode} that the service accepts. */ -export enum KnownUserAuthenticationMode { - /** The user authentication mode is anonymous. */ - Anonymous = "Anonymous", - /** The user authentication mode is an x509 certificate. */ - Certificate = "Certificate", - /** The user authentication mode is a username and password. */ - UsernamePassword = "UsernamePassword", -} - -/** - * Defines values for UserAuthenticationMode. \ - * {@link KnownUserAuthenticationMode} can be used interchangeably with UserAuthenticationMode, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Anonymous**: The user authentication mode is anonymous. \ - * **Certificate**: The user authentication mode is an x509 certificate. \ - * **UsernamePassword**: The user authentication mode is a username and password. - */ -export type UserAuthenticationMode = 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", - /** Resource has been accepted by the server. */ - 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. \ - * **Accepted**: Resource has been accepted by the server. - */ -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 DataPointsObservabilityMode} that the service accepts. */ -export enum KnownDataPointsObservabilityMode { - /** No mapping to OpenTelemetry. */ - None = "none", - /** Map as counter to OpenTelemetry. */ - Counter = "counter", - /** Map as gauge to OpenTelemetry. */ - Gauge = "gauge", - /** Map as histogram to OpenTelemetry. */ - Histogram = "histogram", - /** Map as log to OpenTelemetry. */ - Log = "log", -} - -/** - * Defines values for DataPointsObservabilityMode. \ - * {@link KnownDataPointsObservabilityMode} can be used interchangeably with DataPointsObservabilityMode, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **none**: No mapping to OpenTelemetry. \ - * **counter**: Map as counter to OpenTelemetry. \ - * **gauge**: Map as gauge to OpenTelemetry. \ - * **histogram**: Map as histogram to OpenTelemetry. \ - * **log**: Map as log to OpenTelemetry. - */ -export type DataPointsObservabilityMode = string; - -/** Known values of {@link EventsObservabilityMode} that the service accepts. */ -export enum KnownEventsObservabilityMode { - /** No mapping to OpenTelemetry. */ - None = "none", - /** Map as log to OpenTelemetry. */ - Log = "log", -} - -/** - * Defines values for EventsObservabilityMode. \ - * {@link KnownEventsObservabilityMode} can be used interchangeably with EventsObservabilityMode, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **none**: No mapping to OpenTelemetry. \ - * **log**: Map as log to OpenTelemetry. - */ -export type EventsObservabilityMode = 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 AssetEndpointProfilesListBySubscriptionOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscription operation. */ -export type AssetEndpointProfilesListBySubscriptionResponse = - AssetEndpointProfileListResult; - -/** Optional parameters. */ -export interface AssetEndpointProfilesListByResourceGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroup operation. */ -export type AssetEndpointProfilesListByResourceGroupResponse = - AssetEndpointProfileListResult; - -/** Optional parameters. */ -export interface AssetEndpointProfilesGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type AssetEndpointProfilesGetResponse = AssetEndpointProfile; - -/** Optional parameters. */ -export interface AssetEndpointProfilesCreateOrReplaceOptionalParams - 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 createOrReplace operation. */ -export type AssetEndpointProfilesCreateOrReplaceResponse = AssetEndpointProfile; - -/** Optional parameters. */ -export interface AssetEndpointProfilesUpdateOptionalParams - 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 AssetEndpointProfilesUpdateResponse = AssetEndpointProfile; - -/** Optional parameters. */ -export interface AssetEndpointProfilesDeleteOptionalParams - 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 delete operation. */ -export type AssetEndpointProfilesDeleteResponse = - AssetEndpointProfilesDeleteHeaders; - -/** Optional parameters. */ -export interface AssetEndpointProfilesListBySubscriptionNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscriptionNext operation. */ -export type AssetEndpointProfilesListBySubscriptionNextResponse = - AssetEndpointProfileListResult; - -/** Optional parameters. */ -export interface AssetEndpointProfilesListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroupNext operation. */ -export type AssetEndpointProfilesListByResourceGroupNextResponse = - AssetEndpointProfileListResult; - -/** Optional parameters. */ -export interface AssetsListBySubscriptionOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscription operation. */ -export type AssetsListBySubscriptionResponse = AssetListResult; - -/** Optional parameters. */ -export interface AssetsListByResourceGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroup operation. */ -export type AssetsListByResourceGroupResponse = AssetListResult; - -/** Optional parameters. */ -export interface AssetsGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type AssetsGetResponse = Asset; - -/** Optional parameters. */ -export interface AssetsCreateOrReplaceOptionalParams - 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 createOrReplace operation. */ -export type AssetsCreateOrReplaceResponse = Asset; - -/** Optional parameters. */ -export interface AssetsUpdateOptionalParams - 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 AssetsUpdateResponse = Asset; - -/** Optional parameters. */ -export interface AssetsDeleteOptionalParams - 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 delete operation. */ -export type AssetsDeleteResponse = AssetsDeleteHeaders; - -/** Optional parameters. */ -export interface AssetsListBySubscriptionNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscriptionNext operation. */ -export type AssetsListBySubscriptionNextResponse = AssetListResult; - -/** Optional parameters. */ -export interface AssetsListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroupNext operation. */ -export type AssetsListByResourceGroupNextResponse = AssetListResult; - -/** Optional parameters. */ -export interface OperationStatusGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type OperationStatusGetResponse = OperationStatusResult; - -/** Optional parameters. */ -export interface DeviceRegistryManagementClientOptionalParams - 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 { + SchemaVersion, + SchemaVersionProperties, + KnownProvisioningState, + ProvisioningState, + ProxyResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + ErrorDetail, + ErrorAdditionalInfo, + Schema, + SchemaProperties, + KnownFormat, + Format, + KnownSchemaType, + SchemaType, + SchemaRegistry, + SchemaRegistryProperties, + SystemAssignedServiceIdentity, + KnownSystemAssignedServiceIdentityType, + SystemAssignedServiceIdentityType, + TrackedResource, + SchemaRegistryUpdate, + SchemaRegistryUpdateProperties, + DiscoveredAssetEndpointProfile, + DiscoveredAssetEndpointProfileProperties, + KnownAuthenticationMethod, + AuthenticationMethod, + ExtendedLocation, + DiscoveredAssetEndpointProfileUpdate, + DiscoveredAssetEndpointProfileUpdateProperties, + DiscoveredAsset, + DiscoveredAssetProperties, + Topic, + KnownTopicRetainType, + TopicRetainType, + DiscoveredDataset, + DiscoveredDataPoint, + DiscoveredEvent, + DiscoveredAssetUpdate, + DiscoveredAssetUpdateProperties, + BillingContainer, + BillingContainerProperties, + AssetEndpointProfile, + AssetEndpointProfileProperties, + Authentication, + UsernamePasswordCredentials, + X509Credentials, + AssetEndpointProfileStatus, + AssetEndpointProfileStatusError, + AssetEndpointProfileUpdate, + AssetEndpointProfileUpdateProperties, + Asset, + AssetProperties, + Dataset, + DataPoint, + KnownDataPointObservabilityMode, + DataPointObservabilityMode, + Event, + KnownEventObservabilityMode, + EventObservabilityMode, + AssetStatus, + AssetStatusError, + AssetStatusDataset, + MessageSchemaReference, + AssetStatusEvent, + DataPointBase, + EventBase, + AssetUpdate, + AssetUpdateProperties, + OperationStatusResult, + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + KnownVersions, +} from "./models.js"; diff --git a/sdk/deviceregistry/arm-deviceregistry/src/models/mappers.ts b/sdk/deviceregistry/arm-deviceregistry/src/models/mappers.ts deleted file mode 100644 index ecf36abc97fc..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/src/models/mappers.ts +++ /dev/null @@ -1,1387 +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 AssetEndpointProfileListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetEndpointProfileListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "AssetEndpointProfile", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const AssetEndpointProfileProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetEndpointProfileProperties", - modelProperties: { - uuid: { - serializedName: "uuid", - readOnly: true, - type: { - name: "String", - }, - }, - targetAddress: { - serializedName: "targetAddress", - required: true, - type: { - name: "String", - }, - }, - userAuthentication: { - serializedName: "userAuthentication", - type: { - name: "Composite", - className: "UserAuthentication", - }, - }, - transportAuthentication: { - serializedName: "transportAuthentication", - type: { - name: "Composite", - className: "TransportAuthentication", - }, - }, - additionalConfiguration: { - serializedName: "additionalConfiguration", - type: { - name: "String", - }, - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const UserAuthentication: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "UserAuthentication", - modelProperties: { - mode: { - serializedName: "mode", - required: true, - type: { - name: "String", - }, - }, - usernamePasswordCredentials: { - serializedName: "usernamePasswordCredentials", - type: { - name: "Composite", - className: "UsernamePasswordCredentials", - }, - }, - x509Credentials: { - serializedName: "x509Credentials", - type: { - name: "Composite", - className: "X509Credentials", - }, - }, - }, - }, -}; - -export const UsernamePasswordCredentials: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "UsernamePasswordCredentials", - modelProperties: { - usernameReference: { - serializedName: "usernameReference", - required: true, - type: { - name: "String", - }, - }, - passwordReference: { - serializedName: "passwordReference", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const X509Credentials: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "X509Credentials", - modelProperties: { - certificateReference: { - serializedName: "certificateReference", - required: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const TransportAuthentication: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TransportAuthentication", - modelProperties: { - ownCertificates: { - serializedName: "ownCertificates", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "OwnCertificate", - }, - }, - }, - }, - }, - }, -}; - -export const OwnCertificate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OwnCertificate", - modelProperties: { - certThumbprint: { - serializedName: "certThumbprint", - type: { - name: "String", - }, - }, - certSecretReference: { - serializedName: "certSecretReference", - type: { - name: "String", - }, - }, - certPasswordReference: { - serializedName: "certPasswordReference", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const ExtendedLocation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ExtendedLocation", - modelProperties: { - type: { - serializedName: "type", - required: true, - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - required: 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 AssetListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Asset", - }, - }, - }, - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const AssetProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetProperties", - modelProperties: { - uuid: { - serializedName: "uuid", - readOnly: true, - type: { - name: "String", - }, - }, - assetType: { - serializedName: "assetType", - type: { - name: "String", - }, - }, - enabled: { - serializedName: "enabled", - type: { - name: "Boolean", - }, - }, - externalAssetId: { - serializedName: "externalAssetId", - type: { - name: "String", - }, - }, - displayName: { - serializedName: "displayName", - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - type: { - name: "String", - }, - }, - assetEndpointProfileUri: { - serializedName: "assetEndpointProfileUri", - required: true, - type: { - name: "String", - }, - }, - version: { - serializedName: "version", - readOnly: true, - type: { - name: "Number", - }, - }, - manufacturer: { - serializedName: "manufacturer", - type: { - name: "String", - }, - }, - manufacturerUri: { - serializedName: "manufacturerUri", - type: { - name: "String", - }, - }, - model: { - serializedName: "model", - type: { - name: "String", - }, - }, - productCode: { - serializedName: "productCode", - type: { - name: "String", - }, - }, - hardwareRevision: { - serializedName: "hardwareRevision", - type: { - name: "String", - }, - }, - softwareRevision: { - serializedName: "softwareRevision", - type: { - name: "String", - }, - }, - documentationUri: { - serializedName: "documentationUri", - type: { - name: "String", - }, - }, - serialNumber: { - serializedName: "serialNumber", - type: { - name: "String", - }, - }, - attributes: { - serializedName: "attributes", - type: { - name: "Dictionary", - value: { type: { name: "any" } }, - }, - }, - defaultDataPointsConfiguration: { - serializedName: "defaultDataPointsConfiguration", - type: { - name: "String", - }, - }, - defaultEventsConfiguration: { - serializedName: "defaultEventsConfiguration", - type: { - name: "String", - }, - }, - dataPoints: { - serializedName: "dataPoints", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DataPoint", - }, - }, - }, - }, - events: { - serializedName: "events", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Event", - }, - }, - }, - }, - status: { - serializedName: "status", - type: { - name: "Composite", - className: "AssetStatus", - }, - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String", - }, - }, - }, - }, -}; - -export const DataPoint: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "DataPoint", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String", - }, - }, - dataSource: { - serializedName: "dataSource", - required: true, - type: { - name: "String", - }, - }, - capabilityId: { - serializedName: "capabilityId", - type: { - name: "String", - }, - }, - observabilityMode: { - defaultValue: "none", - serializedName: "observabilityMode", - type: { - name: "String", - }, - }, - dataPointConfiguration: { - serializedName: "dataPointConfiguration", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const Event: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Event", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String", - }, - }, - eventNotifier: { - serializedName: "eventNotifier", - required: true, - type: { - name: "String", - }, - }, - capabilityId: { - serializedName: "capabilityId", - type: { - name: "String", - }, - }, - observabilityMode: { - defaultValue: "none", - serializedName: "observabilityMode", - type: { - name: "String", - }, - }, - eventConfiguration: { - serializedName: "eventConfiguration", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const AssetStatus: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetStatus", - modelProperties: { - errors: { - serializedName: "errors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "AssetStatusError", - }, - }, - }, - }, - version: { - serializedName: "version", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const AssetStatusError: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetStatusError", - modelProperties: { - code: { - serializedName: "code", - type: { - name: "Number", - }, - }, - message: { - serializedName: "message", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const OperationStatusResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationStatusResult", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String", - }, - }, - name: { - serializedName: "name", - type: { - name: "String", - }, - }, - status: { - serializedName: "status", - required: true, - type: { - name: "String", - }, - }, - percentComplete: { - constraints: { - InclusiveMaximum: 100, - InclusiveMinimum: 0, - }, - serializedName: "percentComplete", - type: { - name: "Number", - }, - }, - startTime: { - serializedName: "startTime", - type: { - name: "DateTime", - }, - }, - endTime: { - serializedName: "endTime", - type: { - name: "DateTime", - }, - }, - operations: { - serializedName: "operations", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "OperationStatusResult", - }, - }, - }, - }, - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetail", - }, - }, - }, - }, -}; - -export const AssetEndpointProfileUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetEndpointProfileUpdate", - modelProperties: { - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "AssetEndpointProfileUpdateProperties", - }, - }, - }, - }, -}; - -export const AssetEndpointProfileUpdateProperties: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "AssetEndpointProfileUpdateProperties", - modelProperties: { - targetAddress: { - serializedName: "targetAddress", - type: { - name: "String", - }, - }, - userAuthentication: { - serializedName: "userAuthentication", - type: { - name: "Composite", - className: "UserAuthenticationUpdate", - }, - }, - transportAuthentication: { - serializedName: "transportAuthentication", - type: { - name: "Composite", - className: "TransportAuthenticationUpdate", - }, - }, - additionalConfiguration: { - serializedName: "additionalConfiguration", - type: { - name: "String", - }, - }, - }, - }, - }; - -export const UserAuthenticationUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "UserAuthenticationUpdate", - modelProperties: { - mode: { - serializedName: "mode", - type: { - name: "String", - }, - }, - usernamePasswordCredentials: { - serializedName: "usernamePasswordCredentials", - type: { - name: "Composite", - className: "UsernamePasswordCredentialsUpdate", - }, - }, - x509Credentials: { - serializedName: "x509Credentials", - type: { - name: "Composite", - className: "X509CredentialsUpdate", - }, - }, - }, - }, -}; - -export const UsernamePasswordCredentialsUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "UsernamePasswordCredentialsUpdate", - modelProperties: { - usernameReference: { - serializedName: "usernameReference", - type: { - name: "String", - }, - }, - passwordReference: { - serializedName: "passwordReference", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const X509CredentialsUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "X509CredentialsUpdate", - modelProperties: { - certificateReference: { - serializedName: "certificateReference", - type: { - name: "String", - }, - }, - }, - }, -}; - -export const TransportAuthenticationUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TransportAuthenticationUpdate", - modelProperties: { - ownCertificates: { - serializedName: "ownCertificates", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "OwnCertificate", - }, - }, - }, - }, - }, - }, -}; - -export const AssetUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetUpdate", - modelProperties: { - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } }, - }, - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "AssetUpdateProperties", - }, - }, - }, - }, -}; - -export const AssetUpdateProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetUpdateProperties", - modelProperties: { - assetType: { - serializedName: "assetType", - type: { - name: "String", - }, - }, - enabled: { - serializedName: "enabled", - type: { - name: "Boolean", - }, - }, - displayName: { - serializedName: "displayName", - type: { - name: "String", - }, - }, - description: { - serializedName: "description", - type: { - name: "String", - }, - }, - manufacturer: { - serializedName: "manufacturer", - type: { - name: "String", - }, - }, - manufacturerUri: { - serializedName: "manufacturerUri", - type: { - name: "String", - }, - }, - model: { - serializedName: "model", - type: { - name: "String", - }, - }, - productCode: { - serializedName: "productCode", - type: { - name: "String", - }, - }, - hardwareRevision: { - serializedName: "hardwareRevision", - type: { - name: "String", - }, - }, - softwareRevision: { - serializedName: "softwareRevision", - type: { - name: "String", - }, - }, - documentationUri: { - serializedName: "documentationUri", - type: { - name: "String", - }, - }, - serialNumber: { - serializedName: "serialNumber", - type: { - name: "String", - }, - }, - attributes: { - serializedName: "attributes", - type: { - name: "Dictionary", - value: { type: { name: "any" } }, - }, - }, - defaultDataPointsConfiguration: { - serializedName: "defaultDataPointsConfiguration", - type: { - name: "String", - }, - }, - defaultEventsConfiguration: { - serializedName: "defaultEventsConfiguration", - type: { - name: "String", - }, - }, - dataPoints: { - serializedName: "dataPoints", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "DataPoint", - }, - }, - }, - }, - events: { - serializedName: "events", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Event", - }, - }, - }, - }, - }, - }, -}; - -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 AssetEndpointProfile: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetEndpointProfile", - modelProperties: { - ...TrackedResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "AssetEndpointProfileProperties", - }, - }, - extendedLocation: { - serializedName: "extendedLocation", - type: { - name: "Composite", - className: "ExtendedLocation", - }, - }, - }, - }, -}; - -export const Asset: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Asset", - modelProperties: { - ...TrackedResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "AssetProperties", - }, - }, - extendedLocation: { - serializedName: "extendedLocation", - type: { - name: "Composite", - className: "ExtendedLocation", - }, - }, - }, - }, -}; - -export const AssetEndpointProfilesCreateOrReplaceHeaders: coreClient.CompositeMapper = - { - type: { - name: "Composite", - className: "AssetEndpointProfilesCreateOrReplaceHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, - }; - -export const AssetEndpointProfilesUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetEndpointProfilesUpdateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const AssetEndpointProfilesDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetEndpointProfilesDeleteHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const AssetsCreateOrReplaceHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetsCreateOrReplaceHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const AssetsUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetsUpdateHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; - -export const AssetsDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AssetsDeleteHeaders", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String", - }, - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number", - }, - }, - }, - }, -}; diff --git a/sdk/deviceregistry/arm-deviceregistry/src/models/models.ts b/sdk/deviceregistry/arm-deviceregistry/src/models/models.ts new file mode 100644 index 000000000000..0702d93da894 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/models/models.ts @@ -0,0 +1,2294 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** Schema version's definition. */ +export interface SchemaVersion extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: SchemaVersionProperties; +} + +export function schemaVersionSerializer(item: SchemaVersion): any { + return { + properties: !item["properties"] + ? item["properties"] + : schemaVersionPropertiesSerializer(item["properties"]), + }; +} + +export function schemaVersionDeserializer(item: any): SchemaVersion { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : schemaVersionPropertiesDeserializer(item["properties"]), + }; +} + +/** Defines the schema version properties. */ +export interface SchemaVersionProperties { + /** Globally unique, immutable, non-reusable id. */ + readonly uuid?: string; + /** Human-readable description of the schema. */ + description?: string; + /** Schema content. */ + schemaContent: string; + /** Hash of the schema content. */ + readonly hash?: string; + /** Provisioning state of the resource. */ + readonly provisioningState?: ProvisioningState; +} + +export function schemaVersionPropertiesSerializer(item: SchemaVersionProperties): any { + return { + description: item["description"], + schemaContent: item["schemaContent"], + }; +} + +export function schemaVersionPropertiesDeserializer(item: any): SchemaVersionProperties { + return { + uuid: item["uuid"], + description: item["description"], + schemaContent: item["schemaContent"], + hash: item["hash"], + provisioningState: item["provisioningState"], + }; +} + +/** The provisioning status of the resource. */ +export enum KnownProvisioningState { + /** Resource has been created. */ + Succeeded = "Succeeded", + /** Resource creation failed. */ + Failed = "Failed", + /** Resource creation was canceled. */ + Canceled = "Canceled", + /** Resource has been accepted by the server. */ + Accepted = "Accepted", + /** Resource is deleting. */ + Deleting = "Deleting", +} + +/** + * The provisioning status of the 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. \ + * **Accepted**: Resource has been accepted by the server. \ + * **Deleting**: Resource is deleting. + */ +export type ProvisioningState = 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"]), + }; +} + +/** 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 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; +} + +/** The response of a SchemaVersion list operation. */ +export interface _SchemaVersionListResult { + /** The SchemaVersion items on this page */ + value: SchemaVersion[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _schemaVersionListResultDeserializer(item: any): _SchemaVersionListResult { + return { + value: schemaVersionArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function schemaVersionArraySerializer(result: Array): any[] { + return result.map((item) => { + return schemaVersionSerializer(item); + }); +} + +export function schemaVersionArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return schemaVersionDeserializer(item); + }); +} + +/** Schema definition. */ +export interface Schema extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: SchemaProperties; +} + +export function schemaSerializer(item: Schema): any { + return { + properties: !item["properties"] + ? item["properties"] + : schemaPropertiesSerializer(item["properties"]), + }; +} + +export function schemaDeserializer(item: any): Schema { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : schemaPropertiesDeserializer(item["properties"]), + }; +} + +/** Defines the schema properties. */ +export interface SchemaProperties { + /** Globally unique, immutable, non-reusable id. */ + readonly uuid?: string; + /** Human-readable display name. */ + displayName?: string; + /** Human-readable description of the schema. */ + description?: string; + /** Format of the schema. */ + format: Format; + /** Type of the schema. */ + schemaType: SchemaType; + /** Provisioning state of the resource. */ + readonly provisioningState?: ProvisioningState; + /** Schema tags. */ + tags?: Record; +} + +export function schemaPropertiesSerializer(item: SchemaProperties): any { + return { + displayName: item["displayName"], + description: item["description"], + format: item["format"], + schemaType: item["schemaType"], + tags: item["tags"], + }; +} + +export function schemaPropertiesDeserializer(item: any): SchemaProperties { + return { + uuid: item["uuid"], + displayName: item["displayName"], + description: item["description"], + format: item["format"], + schemaType: item["schemaType"], + provisioningState: item["provisioningState"], + tags: item["tags"], + }; +} + +/** Defines the schema format. */ +export enum KnownFormat { + /** JSON Schema version draft 7 format */ + JsonSchemaDraft7 = "JsonSchema/draft-07", + /** Delta format */ + Delta_1_0 = "Delta/1.0", +} + +/** + * Defines the schema format. \ + * {@link KnownFormat} can be used interchangeably with Format, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **JsonSchema\/draft-07**: JSON Schema version draft 7 format \ + * **Delta\/1.0**: Delta format + */ +export type Format = string; + +/** Defines the schema type. */ +export enum KnownSchemaType { + /** Message Schema schema type */ + MessageSchema = "MessageSchema", +} + +/** + * Defines the schema type. \ + * {@link KnownSchemaType} can be used interchangeably with SchemaType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **MessageSchema**: Message Schema schema type + */ +export type SchemaType = string; + +/** The response of a Schema list operation. */ +export interface _SchemaListResult { + /** The Schema items on this page */ + value: Schema[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _schemaListResultDeserializer(item: any): _SchemaListResult { + return { + value: schemaArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function schemaArraySerializer(result: Array): any[] { + return result.map((item) => { + return schemaSerializer(item); + }); +} + +export function schemaArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return schemaDeserializer(item); + }); +} + +/** Schema registry definition. */ +export interface SchemaRegistry extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: SchemaRegistryProperties; + /** The managed service identities assigned to this resource. */ + identity?: SystemAssignedServiceIdentity; +} + +export function schemaRegistrySerializer(item: SchemaRegistry): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : schemaRegistryPropertiesSerializer(item["properties"]), + identity: !item["identity"] + ? item["identity"] + : systemAssignedServiceIdentitySerializer(item["identity"]), + }; +} + +export function schemaRegistryDeserializer(item: any): SchemaRegistry { + 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"] + : schemaRegistryPropertiesDeserializer(item["properties"]), + identity: !item["identity"] + ? item["identity"] + : systemAssignedServiceIdentityDeserializer(item["identity"]), + }; +} + +/** Defines the schema registry properties. */ +export interface SchemaRegistryProperties { + /** Globally unique, immutable, non-reusable id. */ + readonly uuid?: string; + /** Schema registry namespace. Uniquely identifies a schema registry within a tenant. */ + namespace: string; + /** Human-readable display name. */ + displayName?: string; + /** Human-readable description of the schema registry. */ + description?: string; + /** The Storage Account's Container URL where schemas will be stored. */ + storageAccountContainerUrl: string; + /** Provisioning state of the resource. */ + readonly provisioningState?: ProvisioningState; +} + +export function schemaRegistryPropertiesSerializer(item: SchemaRegistryProperties): any { + return { + namespace: item["namespace"], + displayName: item["displayName"], + description: item["description"], + storageAccountContainerUrl: item["storageAccountContainerUrl"], + }; +} + +export function schemaRegistryPropertiesDeserializer(item: any): SchemaRegistryProperties { + return { + uuid: item["uuid"], + namespace: item["namespace"], + displayName: item["displayName"], + description: item["description"], + storageAccountContainerUrl: item["storageAccountContainerUrl"], + provisioningState: item["provisioningState"], + }; +} + +/** Managed service identity (either system assigned, or none) */ +export interface SystemAssignedServiceIdentity { + /** The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. */ + readonly principalId?: string; + /** The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. */ + readonly tenantId?: string; + /** The type of managed identity assigned to this resource. */ + type: SystemAssignedServiceIdentityType; +} + +export function systemAssignedServiceIdentitySerializer(item: SystemAssignedServiceIdentity): any { + return { type: item["type"] }; +} + +export function systemAssignedServiceIdentityDeserializer( + item: any, +): SystemAssignedServiceIdentity { + return { + principalId: item["principalId"], + tenantId: item["tenantId"], + type: item["type"], + }; +} + +/** Type of managed service identity (either system assigned, or none). */ +export enum KnownSystemAssignedServiceIdentityType { + /** No managed system identity. */ + None = "None", + /** System assigned managed system identity. */ + SystemAssigned = "SystemAssigned", +} + +/** + * Type of managed service identity (either system assigned, or none). \ + * {@link KnownSystemAssignedServiceIdentityType} can be used interchangeably with SystemAssignedServiceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None**: No managed system identity. \ + * **SystemAssigned**: System assigned managed system identity. + */ +export type SystemAssignedServiceIdentityType = 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"], + }; +} + +/** The type used for update operations of the SchemaRegistry. */ +export interface SchemaRegistryUpdate { + /** The managed service identities assigned to this resource. */ + identity?: SystemAssignedServiceIdentity; + /** Resource tags. */ + tags?: Record; + /** The resource-specific properties for this resource. */ + properties?: SchemaRegistryUpdateProperties; +} + +export function schemaRegistryUpdateSerializer(item: SchemaRegistryUpdate): any { + return { + identity: !item["identity"] + ? item["identity"] + : systemAssignedServiceIdentitySerializer(item["identity"]), + tags: item["tags"], + properties: !item["properties"] + ? item["properties"] + : schemaRegistryUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** The updatable properties of the SchemaRegistry. */ +export interface SchemaRegistryUpdateProperties { + /** Human-readable display name. */ + displayName?: string; + /** Human-readable description of the schema registry. */ + description?: string; +} + +export function schemaRegistryUpdatePropertiesSerializer( + item: SchemaRegistryUpdateProperties, +): any { + return { displayName: item["displayName"], description: item["description"] }; +} + +/** The response of a SchemaRegistry list operation. */ +export interface _SchemaRegistryListResult { + /** The SchemaRegistry items on this page */ + value: SchemaRegistry[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _schemaRegistryListResultDeserializer(item: any): _SchemaRegistryListResult { + return { + value: schemaRegistryArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function schemaRegistryArraySerializer(result: Array): any[] { + return result.map((item) => { + return schemaRegistrySerializer(item); + }); +} + +export function schemaRegistryArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return schemaRegistryDeserializer(item); + }); +} + +/** Discovered Asset Endpoint Profile definition. */ +export interface DiscoveredAssetEndpointProfile extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: DiscoveredAssetEndpointProfileProperties; + /** The extended location. */ + extendedLocation: ExtendedLocation; +} + +export function discoveredAssetEndpointProfileSerializer( + item: DiscoveredAssetEndpointProfile, +): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : discoveredAssetEndpointProfilePropertiesSerializer(item["properties"]), + extendedLocation: extendedLocationSerializer(item["extendedLocation"]), + }; +} + +export function discoveredAssetEndpointProfileDeserializer( + item: any, +): DiscoveredAssetEndpointProfile { + 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"] + : discoveredAssetEndpointProfilePropertiesDeserializer(item["properties"]), + extendedLocation: extendedLocationDeserializer(item["extendedLocation"]), + }; +} + +/** Defines the Discovered Asset Endpoint Profile properties. */ +export interface DiscoveredAssetEndpointProfileProperties { + /** The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. */ + targetAddress: string; + /** Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). */ + additionalConfiguration?: string; + /** List of supported authentication methods supported by the target server. */ + supportedAuthenticationMethods?: AuthenticationMethod[]; + /** Defines the configuration for the connector type that is being used with the endpoint profile. */ + endpointProfileType: string; + /** Identifier used to detect changes in the asset endpoint profile. */ + discoveryId: string; + /** An integer that is incremented each time the resource is modified. */ + version: number; + /** Provisioning state of the resource. */ + readonly provisioningState?: ProvisioningState; +} + +export function discoveredAssetEndpointProfilePropertiesSerializer( + item: DiscoveredAssetEndpointProfileProperties, +): any { + return { + targetAddress: item["targetAddress"], + additionalConfiguration: item["additionalConfiguration"], + supportedAuthenticationMethods: !item["supportedAuthenticationMethods"] + ? item["supportedAuthenticationMethods"] + : item["supportedAuthenticationMethods"].map((p: any) => { + return p; + }), + endpointProfileType: item["endpointProfileType"], + discoveryId: item["discoveryId"], + version: item["version"], + }; +} + +export function discoveredAssetEndpointProfilePropertiesDeserializer( + item: any, +): DiscoveredAssetEndpointProfileProperties { + return { + targetAddress: item["targetAddress"], + additionalConfiguration: item["additionalConfiguration"], + supportedAuthenticationMethods: !item["supportedAuthenticationMethods"] + ? item["supportedAuthenticationMethods"] + : item["supportedAuthenticationMethods"].map((p: any) => { + return p; + }), + endpointProfileType: item["endpointProfileType"], + discoveryId: item["discoveryId"], + version: item["version"], + provisioningState: item["provisioningState"], + }; +} + +/** The method to authenticate the user of the client at the server. */ +export enum KnownAuthenticationMethod { + /** The user authentication method is anonymous. */ + Anonymous = "Anonymous", + /** The user authentication method is an x509 certificate. */ + Certificate = "Certificate", + /** The user authentication method is a username and password. */ + UsernamePassword = "UsernamePassword", +} + +/** + * The method to authenticate the user of the client at the server. \ + * {@link KnownAuthenticationMethod} can be used interchangeably with AuthenticationMethod, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Anonymous**: The user authentication method is anonymous. \ + * **Certificate**: The user authentication method is an x509 certificate. \ + * **UsernamePassword**: The user authentication method is a username and password. + */ +export type AuthenticationMethod = string; + +/** The extended location. */ +export interface ExtendedLocation { + /** The extended location type. */ + type: string; + /** The extended location name. */ + name: string; +} + +export function extendedLocationSerializer(item: ExtendedLocation): any { + return { type: item["type"], name: item["name"] }; +} + +export function extendedLocationDeserializer(item: any): ExtendedLocation { + return { + type: item["type"], + name: item["name"], + }; +} + +/** The type used for update operations of the DiscoveredAssetEndpointProfile. */ +export interface DiscoveredAssetEndpointProfileUpdate { + /** Resource tags. */ + tags?: Record; + /** The resource-specific properties for this resource. */ + properties?: DiscoveredAssetEndpointProfileUpdateProperties; +} + +export function discoveredAssetEndpointProfileUpdateSerializer( + item: DiscoveredAssetEndpointProfileUpdate, +): any { + return { + tags: item["tags"], + properties: !item["properties"] + ? item["properties"] + : discoveredAssetEndpointProfileUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** The updatable properties of the DiscoveredAssetEndpointProfile. */ +export interface DiscoveredAssetEndpointProfileUpdateProperties { + /** The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. */ + targetAddress?: string; + /** Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). */ + additionalConfiguration?: string; + /** List of supported authentication methods supported by the target server. */ + supportedAuthenticationMethods?: AuthenticationMethod[]; + /** Defines the configuration for the connector type that is being used with the endpoint profile. */ + endpointProfileType?: string; + /** Identifier used to detect changes in the asset endpoint profile. */ + discoveryId?: string; + /** An integer that is incremented each time the resource is modified. */ + version?: number; +} + +export function discoveredAssetEndpointProfileUpdatePropertiesSerializer( + item: DiscoveredAssetEndpointProfileUpdateProperties, +): any { + return { + targetAddress: item["targetAddress"], + additionalConfiguration: item["additionalConfiguration"], + supportedAuthenticationMethods: !item["supportedAuthenticationMethods"] + ? item["supportedAuthenticationMethods"] + : item["supportedAuthenticationMethods"].map((p: any) => { + return p; + }), + endpointProfileType: item["endpointProfileType"], + discoveryId: item["discoveryId"], + version: item["version"], + }; +} + +/** The response of a DiscoveredAssetEndpointProfile list operation. */ +export interface _DiscoveredAssetEndpointProfileListResult { + /** The DiscoveredAssetEndpointProfile items on this page */ + value: DiscoveredAssetEndpointProfile[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _discoveredAssetEndpointProfileListResultDeserializer( + item: any, +): _DiscoveredAssetEndpointProfileListResult { + return { + value: discoveredAssetEndpointProfileArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function discoveredAssetEndpointProfileArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return discoveredAssetEndpointProfileSerializer(item); + }); +} + +export function discoveredAssetEndpointProfileArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return discoveredAssetEndpointProfileDeserializer(item); + }); +} + +/** Discovered Asset definition. */ +export interface DiscoveredAsset extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: DiscoveredAssetProperties; + /** The extended location. */ + extendedLocation: ExtendedLocation; +} + +export function discoveredAssetSerializer(item: DiscoveredAsset): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : discoveredAssetPropertiesSerializer(item["properties"]), + extendedLocation: extendedLocationSerializer(item["extendedLocation"]), + }; +} + +export function discoveredAssetDeserializer(item: any): DiscoveredAsset { + 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"] + : discoveredAssetPropertiesDeserializer(item["properties"]), + extendedLocation: extendedLocationDeserializer(item["extendedLocation"]), + }; +} + +/** Defines the discovered asset properties. */ +export interface DiscoveredAssetProperties { + /** A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint profile name. */ + assetEndpointProfileRef: string; + /** Identifier used to detect changes in the asset. */ + discoveryId: string; + /** An integer that is incremented each time the resource is modified. */ + version: number; + /** Asset manufacturer name. */ + manufacturer?: string; + /** Asset manufacturer URI. */ + manufacturerUri?: string; + /** Asset model name. */ + model?: string; + /** Asset product code. */ + productCode?: string; + /** Revision number of the hardware. */ + hardwareRevision?: string; + /** Revision number of the software. */ + softwareRevision?: string; + /** Reference to the documentation. */ + documentationUri?: string; + /** Asset serial number. */ + serialNumber?: string; + /** Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. */ + defaultDatasetsConfiguration?: string; + /** Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. */ + defaultEventsConfiguration?: string; + /** Object that describes the default topic information for the asset. */ + defaultTopic?: Topic; + /** Array of datasets that are part of the asset. Each dataset spec describes the data points that make up the set. */ + datasets?: DiscoveredDataset[]; + /** Array of events that are part of the asset. Each event can have per-event configuration. */ + events?: DiscoveredEvent[]; + /** Provisioning state of the resource. */ + readonly provisioningState?: ProvisioningState; +} + +export function discoveredAssetPropertiesSerializer(item: DiscoveredAssetProperties): any { + return { + assetEndpointProfileRef: item["assetEndpointProfileRef"], + discoveryId: item["discoveryId"], + version: item["version"], + manufacturer: item["manufacturer"], + manufacturerUri: item["manufacturerUri"], + model: item["model"], + productCode: item["productCode"], + hardwareRevision: item["hardwareRevision"], + softwareRevision: item["softwareRevision"], + documentationUri: item["documentationUri"], + serialNumber: item["serialNumber"], + defaultDatasetsConfiguration: item["defaultDatasetsConfiguration"], + defaultEventsConfiguration: item["defaultEventsConfiguration"], + defaultTopic: !item["defaultTopic"] + ? item["defaultTopic"] + : topicSerializer(item["defaultTopic"]), + datasets: !item["datasets"] + ? item["datasets"] + : discoveredDatasetArraySerializer(item["datasets"]), + events: !item["events"] ? item["events"] : discoveredEventArraySerializer(item["events"]), + }; +} + +export function discoveredAssetPropertiesDeserializer(item: any): DiscoveredAssetProperties { + return { + assetEndpointProfileRef: item["assetEndpointProfileRef"], + discoveryId: item["discoveryId"], + version: item["version"], + manufacturer: item["manufacturer"], + manufacturerUri: item["manufacturerUri"], + model: item["model"], + productCode: item["productCode"], + hardwareRevision: item["hardwareRevision"], + softwareRevision: item["softwareRevision"], + documentationUri: item["documentationUri"], + serialNumber: item["serialNumber"], + defaultDatasetsConfiguration: item["defaultDatasetsConfiguration"], + defaultEventsConfiguration: item["defaultEventsConfiguration"], + defaultTopic: !item["defaultTopic"] + ? item["defaultTopic"] + : topicDeserializer(item["defaultTopic"]), + datasets: !item["datasets"] + ? item["datasets"] + : discoveredDatasetArrayDeserializer(item["datasets"]), + events: !item["events"] ? item["events"] : discoveredEventArrayDeserializer(item["events"]), + provisioningState: item["provisioningState"], + }; +} + +/** Object that describes the topic information. */ +export interface Topic { + /** The topic path for messages published to an MQTT broker. */ + path: string; + /** When set to 'Keep', messages published to an MQTT broker will have the retain flag set. Default: 'Never'. */ + retain?: TopicRetainType; +} + +export function topicSerializer(item: Topic): any { + return { path: item["path"], retain: item["retain"] }; +} + +export function topicDeserializer(item: any): Topic { + return { + path: item["path"], + retain: item["retain"], + }; +} + +/** Topic retain types. */ +export enum KnownTopicRetainType { + /** Retain the messages. */ + Keep = "Keep", + /** Never retain messages. */ + Never = "Never", +} + +/** + * Topic retain types. \ + * {@link KnownTopicRetainType} can be used interchangeably with TopicRetainType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Keep**: Retain the messages. \ + * **Never**: Never retain messages. + */ +export type TopicRetainType = string; + +export function discoveredDatasetArraySerializer(result: Array): any[] { + return result.map((item) => { + return discoveredDatasetSerializer(item); + }); +} + +export function discoveredDatasetArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return discoveredDatasetDeserializer(item); + }); +} + +/** Defines the dataset properties. */ +export interface DiscoveredDataset { + /** Name of the dataset. */ + name: string; + /** Stringified JSON that contains connector-specific properties that describes configuration for the specific dataset. */ + datasetConfiguration?: string; + /** Object that describes the topic information for the specific dataset. */ + topic?: Topic; + /** Array of data points that are part of the dataset. Each data point can have per-data point configuration. */ + dataPoints?: DiscoveredDataPoint[]; +} + +export function discoveredDatasetSerializer(item: DiscoveredDataset): any { + return { + name: item["name"], + datasetConfiguration: item["datasetConfiguration"], + topic: !item["topic"] ? item["topic"] : topicSerializer(item["topic"]), + dataPoints: !item["dataPoints"] + ? item["dataPoints"] + : discoveredDataPointArraySerializer(item["dataPoints"]), + }; +} + +export function discoveredDatasetDeserializer(item: any): DiscoveredDataset { + return { + name: item["name"], + datasetConfiguration: item["datasetConfiguration"], + topic: !item["topic"] ? item["topic"] : topicDeserializer(item["topic"]), + dataPoints: !item["dataPoints"] + ? item["dataPoints"] + : discoveredDataPointArrayDeserializer(item["dataPoints"]), + }; +} + +export function discoveredDataPointArraySerializer(result: Array): any[] { + return result.map((item) => { + return discoveredDataPointSerializer(item); + }); +} + +export function discoveredDataPointArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return discoveredDataPointDeserializer(item); + }); +} + +/** Defines the data point properties. */ +export interface DiscoveredDataPoint { + /** The name of the data point. */ + name: string; + /** The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the asset. */ + dataSource: string; + /** Stringified JSON that contains connector-specific configuration for the data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. */ + dataPointConfiguration?: string; + /** UTC timestamp indicating when the data point was added or modified. */ + lastUpdatedOn?: Date; +} + +export function discoveredDataPointSerializer(item: DiscoveredDataPoint): any { + return { + name: item["name"], + dataSource: item["dataSource"], + dataPointConfiguration: item["dataPointConfiguration"], + lastUpdatedOn: item["lastUpdatedOn"]?.toISOString(), + }; +} + +export function discoveredDataPointDeserializer(item: any): DiscoveredDataPoint { + return { + name: item["name"], + dataSource: item["dataSource"], + dataPointConfiguration: item["dataPointConfiguration"], + lastUpdatedOn: !item["lastUpdatedOn"] ? item["lastUpdatedOn"] : new Date(item["lastUpdatedOn"]), + }; +} + +export function discoveredEventArraySerializer(result: Array): any[] { + return result.map((item) => { + return discoveredEventSerializer(item); + }); +} + +export function discoveredEventArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return discoveredEventDeserializer(item); + }); +} + +/** Defines the event properties. */ +export interface DiscoveredEvent { + /** The name of the event. */ + name: string; + /** The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the asset. */ + eventNotifier: string; + /** Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. */ + eventConfiguration?: string; + /** Object that describes the topic information for the specific event. */ + topic?: Topic; + /** UTC timestamp indicating when the event was added or modified. */ + lastUpdatedOn?: Date; +} + +export function discoveredEventSerializer(item: DiscoveredEvent): any { + return { + name: item["name"], + eventNotifier: item["eventNotifier"], + eventConfiguration: item["eventConfiguration"], + topic: !item["topic"] ? item["topic"] : topicSerializer(item["topic"]), + lastUpdatedOn: item["lastUpdatedOn"]?.toISOString(), + }; +} + +export function discoveredEventDeserializer(item: any): DiscoveredEvent { + return { + name: item["name"], + eventNotifier: item["eventNotifier"], + eventConfiguration: item["eventConfiguration"], + topic: !item["topic"] ? item["topic"] : topicDeserializer(item["topic"]), + lastUpdatedOn: !item["lastUpdatedOn"] ? item["lastUpdatedOn"] : new Date(item["lastUpdatedOn"]), + }; +} + +/** The type used for update operations of the DiscoveredAsset. */ +export interface DiscoveredAssetUpdate { + /** Resource tags. */ + tags?: Record; + /** The resource-specific properties for this resource. */ + properties?: DiscoveredAssetUpdateProperties; +} + +export function discoveredAssetUpdateSerializer(item: DiscoveredAssetUpdate): any { + return { + tags: item["tags"], + properties: !item["properties"] + ? item["properties"] + : discoveredAssetUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** The updatable properties of the DiscoveredAsset. */ +export interface DiscoveredAssetUpdateProperties { + /** Identifier used to detect changes in the asset. */ + discoveryId?: string; + /** An integer that is incremented each time the resource is modified. */ + version?: number; + /** Asset manufacturer name. */ + manufacturer?: string; + /** Asset manufacturer URI. */ + manufacturerUri?: string; + /** Asset model name. */ + model?: string; + /** Asset product code. */ + productCode?: string; + /** Revision number of the hardware. */ + hardwareRevision?: string; + /** Revision number of the software. */ + softwareRevision?: string; + /** Reference to the documentation. */ + documentationUri?: string; + /** Asset serial number. */ + serialNumber?: string; + /** Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. */ + defaultDatasetsConfiguration?: string; + /** Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. */ + defaultEventsConfiguration?: string; + /** Object that describes the default topic information for the asset. */ + defaultTopic?: Topic; + /** Array of datasets that are part of the asset. Each dataset spec describes the data points that make up the set. */ + datasets?: DiscoveredDataset[]; + /** Array of events that are part of the asset. Each event can have per-event configuration. */ + events?: DiscoveredEvent[]; +} + +export function discoveredAssetUpdatePropertiesSerializer( + item: DiscoveredAssetUpdateProperties, +): any { + return { + discoveryId: item["discoveryId"], + version: item["version"], + manufacturer: item["manufacturer"], + manufacturerUri: item["manufacturerUri"], + model: item["model"], + productCode: item["productCode"], + hardwareRevision: item["hardwareRevision"], + softwareRevision: item["softwareRevision"], + documentationUri: item["documentationUri"], + serialNumber: item["serialNumber"], + defaultDatasetsConfiguration: item["defaultDatasetsConfiguration"], + defaultEventsConfiguration: item["defaultEventsConfiguration"], + defaultTopic: !item["defaultTopic"] + ? item["defaultTopic"] + : topicSerializer(item["defaultTopic"]), + datasets: !item["datasets"] + ? item["datasets"] + : discoveredDatasetArraySerializer(item["datasets"]), + events: !item["events"] ? item["events"] : discoveredEventArraySerializer(item["events"]), + }; +} + +/** The response of a DiscoveredAsset list operation. */ +export interface _DiscoveredAssetListResult { + /** The DiscoveredAsset items on this page */ + value: DiscoveredAsset[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _discoveredAssetListResultDeserializer(item: any): _DiscoveredAssetListResult { + return { + value: discoveredAssetArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function discoveredAssetArraySerializer(result: Array): any[] { + return result.map((item) => { + return discoveredAssetSerializer(item); + }); +} + +export function discoveredAssetArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return discoveredAssetDeserializer(item); + }); +} + +/** billingContainer Model as Azure resource whose sole purpose is to keep track of billables resources under a subscription. */ +export interface BillingContainer extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: BillingContainerProperties; + /** Resource ETag */ + readonly etag?: string; +} + +export function billingContainerDeserializer(item: any): BillingContainer { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : billingContainerPropertiesDeserializer(item["properties"]), + etag: item["etag"], + }; +} + +/** Defines the billingContainer properties. */ +export interface BillingContainerProperties { + /** Provisioning state of the resource. */ + readonly provisioningState?: ProvisioningState; +} + +export function billingContainerPropertiesDeserializer(item: any): BillingContainerProperties { + return { + provisioningState: item["provisioningState"], + }; +} + +/** The response of a BillingContainer list operation. */ +export interface _BillingContainerListResult { + /** The BillingContainer items on this page */ + value: BillingContainer[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _billingContainerListResultDeserializer(item: any): _BillingContainerListResult { + return { + value: billingContainerArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function billingContainerArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return billingContainerDeserializer(item); + }); +} + +/** Asset Endpoint Profile definition. */ +export interface AssetEndpointProfile extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: AssetEndpointProfileProperties; + /** The extended location. */ + extendedLocation: ExtendedLocation; +} + +export function assetEndpointProfileSerializer(item: AssetEndpointProfile): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : assetEndpointProfilePropertiesSerializer(item["properties"]), + extendedLocation: extendedLocationSerializer(item["extendedLocation"]), + }; +} + +export function assetEndpointProfileDeserializer(item: any): AssetEndpointProfile { + 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"] + : assetEndpointProfilePropertiesDeserializer(item["properties"]), + extendedLocation: extendedLocationDeserializer(item["extendedLocation"]), + }; +} + +/** Defines the Asset Endpoint Profile properties. */ +export interface AssetEndpointProfileProperties { + /** Globally unique, immutable, non-reusable id. */ + readonly uuid?: string; + /** The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. */ + targetAddress: string; + /** Defines the configuration for the connector type that is being used with the endpoint profile. */ + endpointProfileType: string; + /** Defines the client authentication mechanism to the server. */ + authentication?: Authentication; + /** Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). */ + additionalConfiguration?: string; + /** Reference to a discovered asset endpoint profile. Populated only if the asset endpoint profile has been created from discovery flow. Discovered asset endpoint profile name must be provided. */ + discoveredAssetEndpointProfileRef?: string; + /** Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes status property for custom resources. */ + readonly status?: AssetEndpointProfileStatus; + /** Provisioning state of the resource. */ + readonly provisioningState?: ProvisioningState; +} + +export function assetEndpointProfilePropertiesSerializer( + item: AssetEndpointProfileProperties, +): any { + return { + targetAddress: item["targetAddress"], + endpointProfileType: item["endpointProfileType"], + authentication: !item["authentication"] + ? item["authentication"] + : authenticationSerializer(item["authentication"]), + additionalConfiguration: item["additionalConfiguration"], + discoveredAssetEndpointProfileRef: item["discoveredAssetEndpointProfileRef"], + }; +} + +export function assetEndpointProfilePropertiesDeserializer( + item: any, +): AssetEndpointProfileProperties { + return { + uuid: item["uuid"], + targetAddress: item["targetAddress"], + endpointProfileType: item["endpointProfileType"], + authentication: !item["authentication"] + ? item["authentication"] + : authenticationDeserializer(item["authentication"]), + additionalConfiguration: item["additionalConfiguration"], + discoveredAssetEndpointProfileRef: item["discoveredAssetEndpointProfileRef"], + status: !item["status"] + ? item["status"] + : assetEndpointProfileStatusDeserializer(item["status"]), + provisioningState: item["provisioningState"], + }; +} + +/** Definition of the client authentication mechanism to the server. */ +export interface Authentication { + /** Defines the method to authenticate the user of the client at the server. */ + method: AuthenticationMethod; + /** Defines the username and password references when UsernamePassword user authentication mode is selected. */ + usernamePasswordCredentials?: UsernamePasswordCredentials; + /** Defines the certificate reference when Certificate user authentication mode is selected. */ + x509Credentials?: X509Credentials; +} + +export function authenticationSerializer(item: Authentication): any { + return { + method: item["method"], + usernamePasswordCredentials: !item["usernamePasswordCredentials"] + ? item["usernamePasswordCredentials"] + : usernamePasswordCredentialsSerializer(item["usernamePasswordCredentials"]), + x509Credentials: !item["x509Credentials"] + ? item["x509Credentials"] + : x509CredentialsSerializer(item["x509Credentials"]), + }; +} + +export function authenticationDeserializer(item: any): Authentication { + return { + method: item["method"], + usernamePasswordCredentials: !item["usernamePasswordCredentials"] + ? item["usernamePasswordCredentials"] + : usernamePasswordCredentialsDeserializer(item["usernamePasswordCredentials"]), + x509Credentials: !item["x509Credentials"] + ? item["x509Credentials"] + : x509CredentialsDeserializer(item["x509Credentials"]), + }; +} + +/** The credentials for authentication mode UsernamePassword. */ +export interface UsernamePasswordCredentials { + /** The name of the secret containing the username. */ + usernameSecretName: string; + /** The name of the secret containing the password. */ + passwordSecretName: string; +} + +export function usernamePasswordCredentialsSerializer(item: UsernamePasswordCredentials): any { + return { + usernameSecretName: item["usernameSecretName"], + passwordSecretName: item["passwordSecretName"], + }; +} + +export function usernamePasswordCredentialsDeserializer(item: any): UsernamePasswordCredentials { + return { + usernameSecretName: item["usernameSecretName"], + passwordSecretName: item["passwordSecretName"], + }; +} + +/** The x509 certificate for authentication mode Certificate. */ +export interface X509Credentials { + /** The name of the secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). */ + certificateSecretName: string; +} + +export function x509CredentialsSerializer(item: X509Credentials): any { + return { certificateSecretName: item["certificateSecretName"] }; +} + +export function x509CredentialsDeserializer(item: any): X509Credentials { + return { + certificateSecretName: item["certificateSecretName"], + }; +} + +/** Defines the asset endpoint profile status properties. */ +export interface AssetEndpointProfileStatus { + /** Array object to transfer and persist errors that originate from the Edge. */ + readonly errors?: AssetEndpointProfileStatusError[]; +} + +export function assetEndpointProfileStatusDeserializer(item: any): AssetEndpointProfileStatus { + return { + errors: !item["errors"] + ? item["errors"] + : assetEndpointProfileStatusErrorArrayDeserializer(item["errors"]), + }; +} + +export function assetEndpointProfileStatusErrorArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return assetEndpointProfileStatusErrorDeserializer(item); + }); +} + +/** Defines the asset endpoint profile status error properties. */ +export interface AssetEndpointProfileStatusError { + /** Error code for classification of errors (ex: 400, 404, 500, etc.). */ + readonly code?: number; + /** Human readable helpful error message to provide additional context for error (ex: “targetAddress 'foo' is not a valid url”). */ + readonly message?: string; +} + +export function assetEndpointProfileStatusErrorDeserializer( + item: any, +): AssetEndpointProfileStatusError { + return { + code: item["code"], + message: item["message"], + }; +} + +/** The type used for update operations of the AssetEndpointProfile. */ +export interface AssetEndpointProfileUpdate { + /** Resource tags. */ + tags?: Record; + /** The resource-specific properties for this resource. */ + properties?: AssetEndpointProfileUpdateProperties; +} + +export function assetEndpointProfileUpdateSerializer(item: AssetEndpointProfileUpdate): any { + return { + tags: item["tags"], + properties: !item["properties"] + ? item["properties"] + : assetEndpointProfileUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** The updatable properties of the AssetEndpointProfile. */ +export interface AssetEndpointProfileUpdateProperties { + /** The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. */ + targetAddress?: string; + /** Defines the configuration for the connector type that is being used with the endpoint profile. */ + endpointProfileType?: string; + /** Defines the client authentication mechanism to the server. */ + authentication?: Authentication; + /** Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). */ + additionalConfiguration?: string; +} + +export function assetEndpointProfileUpdatePropertiesSerializer( + item: AssetEndpointProfileUpdateProperties, +): any { + return { + targetAddress: item["targetAddress"], + endpointProfileType: item["endpointProfileType"], + authentication: !item["authentication"] + ? item["authentication"] + : authenticationSerializer(item["authentication"]), + additionalConfiguration: item["additionalConfiguration"], + }; +} + +/** The response of a AssetEndpointProfile list operation. */ +export interface _AssetEndpointProfileListResult { + /** The AssetEndpointProfile items on this page */ + value: AssetEndpointProfile[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _assetEndpointProfileListResultDeserializer( + item: any, +): _AssetEndpointProfileListResult { + return { + value: assetEndpointProfileArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function assetEndpointProfileArraySerializer(result: Array): any[] { + return result.map((item) => { + return assetEndpointProfileSerializer(item); + }); +} + +export function assetEndpointProfileArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return assetEndpointProfileDeserializer(item); + }); +} + +/** Asset definition. */ +export interface Asset extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: AssetProperties; + /** The extended location. */ + extendedLocation: ExtendedLocation; +} + +export function assetSerializer(item: Asset): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : assetPropertiesSerializer(item["properties"]), + extendedLocation: extendedLocationSerializer(item["extendedLocation"]), + }; +} + +export function assetDeserializer(item: any): Asset { + 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"] + : assetPropertiesDeserializer(item["properties"]), + extendedLocation: extendedLocationDeserializer(item["extendedLocation"]), + }; +} + +/** Defines the asset properties. */ +export interface AssetProperties { + /** Globally unique, immutable, non-reusable id. */ + readonly uuid?: string; + /** Enabled/Disabled status of the asset. */ + enabled?: boolean; + /** Asset id provided by the customer. */ + externalAssetId?: string; + /** Human-readable display name. */ + displayName?: string; + /** Human-readable description of the asset. */ + description?: string; + /** A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint profile name. */ + assetEndpointProfileRef: string; + /** An integer that is incremented each time the resource is modified. */ + readonly version?: number; + /** Asset manufacturer name. */ + manufacturer?: string; + /** Asset manufacturer URI. */ + manufacturerUri?: string; + /** Asset model name. */ + model?: string; + /** Asset product code. */ + productCode?: string; + /** Revision number of the hardware. */ + hardwareRevision?: string; + /** Revision number of the software. */ + softwareRevision?: string; + /** Reference to the documentation. */ + documentationUri?: string; + /** Asset serial number. */ + serialNumber?: string; + /** A set of key-value pairs that contain custom attributes set by the customer. */ + attributes?: Record; + /** Reference to a list of discovered assets. Populated only if the asset has been created from discovery flow. Discovered asset names must be provided. */ + discoveredAssetRefs?: string[]; + /** Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. */ + defaultDatasetsConfiguration?: string; + /** Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. */ + defaultEventsConfiguration?: string; + /** Object that describes the default topic information for the asset. */ + defaultTopic?: Topic; + /** Array of datasets that are part of the asset. Each dataset describes the data points that make up the set. */ + datasets?: Dataset[]; + /** Array of events that are part of the asset. Each event can have per-event configuration. */ + events?: Event[]; + /** Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes status property for custom resources. */ + readonly status?: AssetStatus; + /** Provisioning state of the resource. */ + readonly provisioningState?: ProvisioningState; +} + +export function assetPropertiesSerializer(item: AssetProperties): any { + return { + enabled: item["enabled"], + externalAssetId: item["externalAssetId"], + displayName: item["displayName"], + description: item["description"], + assetEndpointProfileRef: item["assetEndpointProfileRef"], + manufacturer: item["manufacturer"], + manufacturerUri: item["manufacturerUri"], + model: item["model"], + productCode: item["productCode"], + hardwareRevision: item["hardwareRevision"], + softwareRevision: item["softwareRevision"], + documentationUri: item["documentationUri"], + serialNumber: item["serialNumber"], + attributes: item["attributes"], + discoveredAssetRefs: !item["discoveredAssetRefs"] + ? item["discoveredAssetRefs"] + : item["discoveredAssetRefs"].map((p: any) => { + return p; + }), + defaultDatasetsConfiguration: item["defaultDatasetsConfiguration"], + defaultEventsConfiguration: item["defaultEventsConfiguration"], + defaultTopic: !item["defaultTopic"] + ? item["defaultTopic"] + : topicSerializer(item["defaultTopic"]), + datasets: !item["datasets"] ? item["datasets"] : datasetArraySerializer(item["datasets"]), + events: !item["events"] ? item["events"] : eventArraySerializer(item["events"]), + }; +} + +export function assetPropertiesDeserializer(item: any): AssetProperties { + return { + uuid: item["uuid"], + enabled: item["enabled"], + externalAssetId: item["externalAssetId"], + displayName: item["displayName"], + description: item["description"], + assetEndpointProfileRef: item["assetEndpointProfileRef"], + version: item["version"], + manufacturer: item["manufacturer"], + manufacturerUri: item["manufacturerUri"], + model: item["model"], + productCode: item["productCode"], + hardwareRevision: item["hardwareRevision"], + softwareRevision: item["softwareRevision"], + documentationUri: item["documentationUri"], + serialNumber: item["serialNumber"], + attributes: item["attributes"], + discoveredAssetRefs: !item["discoveredAssetRefs"] + ? item["discoveredAssetRefs"] + : item["discoveredAssetRefs"].map((p: any) => { + return p; + }), + defaultDatasetsConfiguration: item["defaultDatasetsConfiguration"], + defaultEventsConfiguration: item["defaultEventsConfiguration"], + defaultTopic: !item["defaultTopic"] + ? item["defaultTopic"] + : topicDeserializer(item["defaultTopic"]), + datasets: !item["datasets"] ? item["datasets"] : datasetArrayDeserializer(item["datasets"]), + events: !item["events"] ? item["events"] : eventArrayDeserializer(item["events"]), + status: !item["status"] ? item["status"] : assetStatusDeserializer(item["status"]), + provisioningState: item["provisioningState"], + }; +} + +export function datasetArraySerializer(result: Array): any[] { + return result.map((item) => { + return datasetSerializer(item); + }); +} + +export function datasetArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return datasetDeserializer(item); + }); +} + +/** Defines the dataset properties. */ +export interface Dataset { + /** Name of the dataset. */ + name: string; + /** Stringified JSON that contains connector-specific JSON string that describes configuration for the specific dataset. */ + datasetConfiguration?: string; + /** Object that describes the topic information for the specific dataset. */ + topic?: Topic; + /** Array of data points that are part of the dataset. Each data point can have per-data point configuration. */ + dataPoints?: DataPoint[]; +} + +export function datasetSerializer(item: Dataset): any { + return { + name: item["name"], + datasetConfiguration: item["datasetConfiguration"], + topic: !item["topic"] ? item["topic"] : topicSerializer(item["topic"]), + dataPoints: !item["dataPoints"] + ? item["dataPoints"] + : dataPointArraySerializer(item["dataPoints"]), + }; +} + +export function datasetDeserializer(item: any): Dataset { + return { + name: item["name"], + datasetConfiguration: item["datasetConfiguration"], + topic: !item["topic"] ? item["topic"] : topicDeserializer(item["topic"]), + dataPoints: !item["dataPoints"] + ? item["dataPoints"] + : dataPointArrayDeserializer(item["dataPoints"]), + }; +} + +export function dataPointArraySerializer(result: Array): any[] { + return result.map((item) => { + return dataPointSerializer(item); + }); +} + +export function dataPointArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return dataPointDeserializer(item); + }); +} + +/** Defines the data point properties. */ +export interface DataPoint extends DataPointBase { + /** An indication of how the data point should be mapped to OpenTelemetry. */ + observabilityMode?: DataPointObservabilityMode; +} + +export function dataPointSerializer(item: DataPoint): any { + return { + name: item["name"], + dataSource: item["dataSource"], + dataPointConfiguration: item["dataPointConfiguration"], + observabilityMode: item["observabilityMode"], + }; +} + +export function dataPointDeserializer(item: any): DataPoint { + return { + name: item["name"], + dataSource: item["dataSource"], + dataPointConfiguration: item["dataPointConfiguration"], + observabilityMode: item["observabilityMode"], + }; +} + +/** Defines the data point observability mode. */ +export enum KnownDataPointObservabilityMode { + /** No mapping to OpenTelemetry. */ + None = "None", + /** Map as counter to OpenTelemetry. */ + Counter = "Counter", + /** Map as gauge to OpenTelemetry. */ + Gauge = "Gauge", + /** Map as histogram to OpenTelemetry. */ + Histogram = "Histogram", + /** Map as log to OpenTelemetry. */ + Log = "Log", +} + +/** + * Defines the data point observability mode. \ + * {@link KnownDataPointObservabilityMode} can be used interchangeably with DataPointObservabilityMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None**: No mapping to OpenTelemetry. \ + * **Counter**: Map as counter to OpenTelemetry. \ + * **Gauge**: Map as gauge to OpenTelemetry. \ + * **Histogram**: Map as histogram to OpenTelemetry. \ + * **Log**: Map as log to OpenTelemetry. + */ +export type DataPointObservabilityMode = string; + +export function eventArraySerializer(result: Array): any[] { + return result.map((item) => { + return eventSerializer(item); + }); +} + +export function eventArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return eventDeserializer(item); + }); +} + +/** Defines the event properties. */ +export interface Event extends EventBase { + /** An indication of how the event should be mapped to OpenTelemetry. */ + observabilityMode?: EventObservabilityMode; +} + +export function eventSerializer(item: Event): any { + return { + name: item["name"], + eventNotifier: item["eventNotifier"], + eventConfiguration: item["eventConfiguration"], + topic: !item["topic"] ? item["topic"] : topicSerializer(item["topic"]), + observabilityMode: item["observabilityMode"], + }; +} + +export function eventDeserializer(item: any): Event { + return { + name: item["name"], + eventNotifier: item["eventNotifier"], + eventConfiguration: item["eventConfiguration"], + topic: !item["topic"] ? item["topic"] : topicDeserializer(item["topic"]), + observabilityMode: item["observabilityMode"], + }; +} + +/** Defines the event observability mode. */ +export enum KnownEventObservabilityMode { + /** No mapping to OpenTelemetry. */ + None = "None", + /** Map as log to OpenTelemetry. */ + Log = "Log", +} + +/** + * Defines the event observability mode. \ + * {@link KnownEventObservabilityMode} can be used interchangeably with EventObservabilityMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None**: No mapping to OpenTelemetry. \ + * **Log**: Map as log to OpenTelemetry. + */ +export type EventObservabilityMode = string; + +/** Defines the asset status properties. */ +export interface AssetStatus { + /** Array object to transfer and persist errors that originate from the Edge. */ + readonly errors?: AssetStatusError[]; + /** A read only incremental counter indicating the number of times the configuration has been modified from the perspective of the current actual (Edge) state of the Asset. Edge would be the only writer of this value and would sync back up to the cloud. In steady state, this should equal version. */ + readonly version?: number; + /** Array of dataset statuses that describe the status of each dataset. */ + readonly datasets?: AssetStatusDataset[]; + /** Array of event statuses that describe the status of each event. */ + readonly events?: AssetStatusEvent[]; +} + +export function assetStatusDeserializer(item: any): AssetStatus { + return { + errors: !item["errors"] ? item["errors"] : assetStatusErrorArrayDeserializer(item["errors"]), + version: item["version"], + datasets: !item["datasets"] + ? item["datasets"] + : assetStatusDatasetArrayDeserializer(item["datasets"]), + events: !item["events"] ? item["events"] : assetStatusEventArrayDeserializer(item["events"]), + }; +} + +export function assetStatusErrorArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return assetStatusErrorDeserializer(item); + }); +} + +/** Defines the asset status error properties. */ +export interface AssetStatusError { + /** Error code for classification of errors (ex: 400, 404, 500, etc.). */ + readonly code?: number; + /** Human readable helpful error message to provide additional context for error (ex: “capability Id 'foo' does not exist”). */ + readonly message?: string; +} + +export function assetStatusErrorDeserializer(item: any): AssetStatusError { + return { + code: item["code"], + message: item["message"], + }; +} + +export function assetStatusDatasetArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return assetStatusDatasetDeserializer(item); + }); +} + +/** Defines the asset status dataset properties. */ +export interface AssetStatusDataset { + /** The name of the dataset. Must be unique within the status.datasets array. This name is used to correlate between the spec and status dataset information. */ + readonly name: string; + /** The message schema reference object. */ + readonly messageSchemaReference?: MessageSchemaReference; +} + +export function assetStatusDatasetDeserializer(item: any): AssetStatusDataset { + return { + name: item["name"], + messageSchemaReference: !item["messageSchemaReference"] + ? item["messageSchemaReference"] + : messageSchemaReferenceDeserializer(item["messageSchemaReference"]), + }; +} + +/** Defines the message schema reference properties. */ +export interface MessageSchemaReference { + /** The message schema registry namespace. */ + readonly schemaRegistryNamespace: string; + /** The message schema name. */ + readonly schemaName: string; + /** The message schema version. */ + readonly schemaVersion: string; +} + +export function messageSchemaReferenceDeserializer(item: any): MessageSchemaReference { + return { + schemaRegistryNamespace: item["schemaRegistryNamespace"], + schemaName: item["schemaName"], + schemaVersion: item["schemaVersion"], + }; +} + +export function assetStatusEventArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return assetStatusEventDeserializer(item); + }); +} + +/** Defines the asset status event properties. */ +export interface AssetStatusEvent { + /** The name of the event. Must be unique within the status.events array. This name is used to correlate between the spec and status event information. */ + readonly name: string; + /** The message schema reference object. */ + readonly messageSchemaReference?: MessageSchemaReference; +} + +export function assetStatusEventDeserializer(item: any): AssetStatusEvent { + return { + name: item["name"], + messageSchemaReference: !item["messageSchemaReference"] + ? item["messageSchemaReference"] + : messageSchemaReferenceDeserializer(item["messageSchemaReference"]), + }; +} + +/** Defines the data point properties. */ +export interface DataPointBase { + /** The name of the data point. */ + name: string; + /** The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the asset. */ + dataSource: string; + /** Stringified JSON that contains connector-specific configuration for the data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. */ + dataPointConfiguration?: string; +} + +export function dataPointBaseSerializer(item: DataPointBase): any { + return { + name: item["name"], + dataSource: item["dataSource"], + dataPointConfiguration: item["dataPointConfiguration"], + }; +} + +export function dataPointBaseDeserializer(item: any): DataPointBase { + return { + name: item["name"], + dataSource: item["dataSource"], + dataPointConfiguration: item["dataPointConfiguration"], + }; +} + +/** Defines the event properties. */ +export interface EventBase { + /** The name of the event. */ + name: string; + /** The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the asset. */ + eventNotifier: string; + /** Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. */ + eventConfiguration?: string; + /** Object that describes the topic information for the specific event. */ + topic?: Topic; +} + +export function eventBaseSerializer(item: EventBase): any { + return { + name: item["name"], + eventNotifier: item["eventNotifier"], + eventConfiguration: item["eventConfiguration"], + topic: !item["topic"] ? item["topic"] : topicSerializer(item["topic"]), + }; +} + +export function eventBaseDeserializer(item: any): EventBase { + return { + name: item["name"], + eventNotifier: item["eventNotifier"], + eventConfiguration: item["eventConfiguration"], + topic: !item["topic"] ? item["topic"] : topicDeserializer(item["topic"]), + }; +} + +/** The type used for update operations of the Asset. */ +export interface AssetUpdate { + /** Resource tags. */ + tags?: Record; + /** The resource-specific properties for this resource. */ + properties?: AssetUpdateProperties; +} + +export function assetUpdateSerializer(item: AssetUpdate): any { + return { + tags: item["tags"], + properties: !item["properties"] + ? item["properties"] + : assetUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** The updatable properties of the Asset. */ +export interface AssetUpdateProperties { + /** Enabled/Disabled status of the asset. */ + enabled?: boolean; + /** Human-readable display name. */ + displayName?: string; + /** Human-readable description of the asset. */ + description?: string; + /** Asset manufacturer name. */ + manufacturer?: string; + /** Asset manufacturer URI. */ + manufacturerUri?: string; + /** Asset model name. */ + model?: string; + /** Asset product code. */ + productCode?: string; + /** Revision number of the hardware. */ + hardwareRevision?: string; + /** Revision number of the software. */ + softwareRevision?: string; + /** Reference to the documentation. */ + documentationUri?: string; + /** Asset serial number. */ + serialNumber?: string; + /** A set of key-value pairs that contain custom attributes set by the customer. */ + attributes?: Record; + /** Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own configuration that overrides the default settings here. */ + defaultDatasetsConfiguration?: string; + /** Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. */ + defaultEventsConfiguration?: string; + /** Object that describes the default topic information for the asset. */ + defaultTopic?: Topic; + /** Array of datasets that are part of the asset. Each dataset describes the data points that make up the set. */ + datasets?: Dataset[]; + /** Array of events that are part of the asset. Each event can have per-event configuration. */ + events?: Event[]; +} + +export function assetUpdatePropertiesSerializer(item: AssetUpdateProperties): any { + return { + enabled: item["enabled"], + displayName: item["displayName"], + description: item["description"], + manufacturer: item["manufacturer"], + manufacturerUri: item["manufacturerUri"], + model: item["model"], + productCode: item["productCode"], + hardwareRevision: item["hardwareRevision"], + softwareRevision: item["softwareRevision"], + documentationUri: item["documentationUri"], + serialNumber: item["serialNumber"], + attributes: item["attributes"], + defaultDatasetsConfiguration: item["defaultDatasetsConfiguration"], + defaultEventsConfiguration: item["defaultEventsConfiguration"], + defaultTopic: !item["defaultTopic"] + ? item["defaultTopic"] + : topicSerializer(item["defaultTopic"]), + datasets: !item["datasets"] ? item["datasets"] : datasetArraySerializer(item["datasets"]), + events: !item["events"] ? item["events"] : eventArraySerializer(item["events"]), + }; +} + +/** The response of a Asset list operation. */ +export interface _AssetListResult { + /** The Asset items on this page */ + value: Asset[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _assetListResultDeserializer(item: any): _AssetListResult { + return { + value: assetArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function assetArraySerializer(result: Array): any[] { + return result.map((item) => { + return assetSerializer(item); + }); +} + +export function assetArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return assetDeserializer(item); + }); +} + +/** The current status of an async operation. */ +export interface OperationStatusResult { + /** Fully qualified ID for the async operation. */ + id?: string; + /** Name of the async operation. */ + name?: string; + /** Operation status. */ + status: string; + /** Percent of the operation that is complete. */ + percentComplete?: number; + /** The start time of the operation. */ + startTime?: Date; + /** The end time of the operation. */ + endTime?: Date; + /** The operations list. */ + operations?: OperationStatusResult[]; + /** If present, details of the operation error. */ + error?: ErrorDetail; +} + +export function operationStatusResultDeserializer(item: any): OperationStatusResult { + return { + id: item["id"], + name: item["name"], + status: item["status"], + percentComplete: item["percentComplete"], + startTime: !item["startTime"] ? item["startTime"] : new Date(item["startTime"]), + endTime: !item["endTime"] ? item["endTime"] : new Date(item["endTime"]), + operations: !item["operations"] + ? item["operations"] + : operationStatusResultArrayDeserializer(item["operations"]), + error: !item["error"] ? item["error"] : errorDetailDeserializer(item["error"]), + }; +} + +export function operationStatusResultArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return operationStatusResultDeserializer(item); + }); +} + +/** 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. */ + readonly 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. */ + 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; + +/** Microsoft.DeviceRegistry Resource Provider supported API versions. */ +export enum KnownVersions { + /** Microsoft.DeviceRegistry Resource Provider management API version 2023-11-01-preview. */ + V2023_11_01_Preview = "2023-11-01-preview", + /** Microsoft.DeviceRegistry Resource Provider management API version 2024-09-01-preview. */ + V2024_09_01_Preview = "2024-09-01-preview", +} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/models/parameters.ts b/sdk/deviceregistry/arm-deviceregistry/src/models/parameters.ts deleted file mode 100644 index c0afb0c27f7c..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/src/models/parameters.ts +++ /dev/null @@ -1,188 +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 { - AssetEndpointProfile as AssetEndpointProfileMapper, - AssetEndpointProfileUpdate as AssetEndpointProfileUpdateMapper, - Asset as AssetMapper, - AssetUpdate as AssetUpdateMapper, -} from "../models/mappers"; - -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: "2023-11-01-preview", - 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 assetEndpointProfileName: OperationURLParameter = { - parameterPath: "assetEndpointProfileName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-z0-9][a-z0-9-]*[a-z0-9]$"), - MaxLength: 63, - MinLength: 3, - }, - serializedName: "assetEndpointProfileName", - 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: AssetEndpointProfileMapper, -}; - -export const properties: OperationParameter = { - parameterPath: "properties", - mapper: AssetEndpointProfileUpdateMapper, -}; - -export const assetName: OperationURLParameter = { - parameterPath: "assetName", - mapper: { - constraints: { - Pattern: new RegExp("^[a-z0-9][a-z0-9-]*[a-z0-9]$"), - MaxLength: 63, - MinLength: 3, - }, - serializedName: "assetName", - required: true, - type: { - name: "String", - }, - }, -}; - -export const resource1: OperationParameter = { - parameterPath: "resource", - mapper: AssetMapper, -}; - -export const properties1: OperationParameter = { - parameterPath: "properties", - mapper: AssetUpdateMapper, -}; - -export const location: OperationURLParameter = { - parameterPath: "location", - mapper: { - constraints: { - MinLength: 1, - }, - serializedName: "location", - required: true, - type: { - name: "String", - }, - }, -}; - -export const operationId: OperationURLParameter = { - parameterPath: "operationId", - mapper: { - constraints: { - MinLength: 1, - }, - serializedName: "operationId", - required: true, - type: { - name: "String", - }, - }, -}; diff --git a/sdk/deviceregistry/arm-deviceregistry/src/operations/assetEndpointProfiles.ts b/sdk/deviceregistry/arm-deviceregistry/src/operations/assetEndpointProfiles.ts deleted file mode 100644 index 39cdec0e920b..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/src/operations/assetEndpointProfiles.ts +++ /dev/null @@ -1,733 +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"; -import { AssetEndpointProfiles } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { DeviceRegistryManagementClient } from "../deviceRegistryManagementClient"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl"; -import { - AssetEndpointProfile, - AssetEndpointProfilesListBySubscriptionNextOptionalParams, - AssetEndpointProfilesListBySubscriptionOptionalParams, - AssetEndpointProfilesListBySubscriptionResponse, - AssetEndpointProfilesListByResourceGroupNextOptionalParams, - AssetEndpointProfilesListByResourceGroupOptionalParams, - AssetEndpointProfilesListByResourceGroupResponse, - AssetEndpointProfilesGetOptionalParams, - AssetEndpointProfilesGetResponse, - AssetEndpointProfilesCreateOrReplaceOptionalParams, - AssetEndpointProfilesCreateOrReplaceResponse, - AssetEndpointProfileUpdate, - AssetEndpointProfilesUpdateOptionalParams, - AssetEndpointProfilesUpdateResponse, - AssetEndpointProfilesDeleteOptionalParams, - AssetEndpointProfilesDeleteResponse, - AssetEndpointProfilesListBySubscriptionNextResponse, - AssetEndpointProfilesListByResourceGroupNextResponse, -} from "../models"; - -/// -/** Class containing AssetEndpointProfiles operations. */ -export class AssetEndpointProfilesImpl implements AssetEndpointProfiles { - private readonly client: DeviceRegistryManagementClient; - - /** - * Initialize a new instance of the class AssetEndpointProfiles class. - * @param client Reference to the service client - */ - constructor(client: DeviceRegistryManagementClient) { - this.client = client; - } - - /** - * List AssetEndpointProfile resources by subscription ID - * @param options The options parameters. - */ - public listBySubscription( - options?: AssetEndpointProfilesListBySubscriptionOptionalParams, - ): 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?: AssetEndpointProfilesListBySubscriptionOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: AssetEndpointProfilesListBySubscriptionResponse; - 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?: AssetEndpointProfilesListBySubscriptionOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listBySubscriptionPagingPage(options)) { - yield* page; - } - } - - /** - * List AssetEndpointProfile 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?: AssetEndpointProfilesListByResourceGroupOptionalParams, - ): 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?: AssetEndpointProfilesListByResourceGroupOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: AssetEndpointProfilesListByResourceGroupResponse; - 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?: AssetEndpointProfilesListByResourceGroupOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByResourceGroupPagingPage( - resourceGroupName, - options, - )) { - yield* page; - } - } - - /** - * List AssetEndpointProfile resources by subscription ID - * @param options The options parameters. - */ - private _listBySubscription( - options?: AssetEndpointProfilesListBySubscriptionOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { options }, - listBySubscriptionOperationSpec, - ); - } - - /** - * List AssetEndpointProfile 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?: AssetEndpointProfilesListByResourceGroupOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, options }, - listByResourceGroupOperationSpec, - ); - } - - /** - * Get a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - assetEndpointProfileName: string, - options?: AssetEndpointProfilesGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, assetEndpointProfileName, options }, - getOperationSpec, - ); - } - - /** - * Create a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrReplace( - resourceGroupName: string, - assetEndpointProfileName: string, - resource: AssetEndpointProfile, - options?: AssetEndpointProfilesCreateOrReplaceOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - AssetEndpointProfilesCreateOrReplaceResponse - > - > { - 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, assetEndpointProfileName, resource, options }, - spec: createOrReplaceOperationSpec, - }); - const poller = await createHttpPoller< - AssetEndpointProfilesCreateOrReplaceResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrReplaceAndWait( - resourceGroupName: string, - assetEndpointProfileName: string, - resource: AssetEndpointProfile, - options?: AssetEndpointProfilesCreateOrReplaceOptionalParams, - ): Promise { - const poller = await this.beginCreateOrReplace( - resourceGroupName, - assetEndpointProfileName, - resource, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Update a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - assetEndpointProfileName: string, - properties: AssetEndpointProfileUpdate, - options?: AssetEndpointProfilesUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - AssetEndpointProfilesUpdateResponse - > - > { - 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, - assetEndpointProfileName, - properties, - options, - }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - AssetEndpointProfilesUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Update a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - assetEndpointProfileName: string, - properties: AssetEndpointProfileUpdate, - options?: AssetEndpointProfilesUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - assetEndpointProfileName, - properties, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Delete a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - assetEndpointProfileName: string, - options?: AssetEndpointProfilesDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - AssetEndpointProfilesDeleteResponse - > - > { - 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, assetEndpointProfileName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - AssetEndpointProfilesDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Delete a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - assetEndpointProfileName: string, - options?: AssetEndpointProfilesDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - assetEndpointProfileName, - 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?: AssetEndpointProfilesListBySubscriptionNextOptionalParams, - ): 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?: AssetEndpointProfilesListByResourceGroupNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, nextLink, options }, - listByResourceGroupNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listBySubscriptionOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AssetEndpointProfileListResult, - }, - 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.DeviceRegistry/assetEndpointProfiles", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AssetEndpointProfileListResult, - }, - 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.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AssetEndpointProfile, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.assetEndpointProfileName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrReplaceOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.AssetEndpointProfile, - }, - 201: { - bodyMapper: Mappers.AssetEndpointProfile, - }, - 202: { - bodyMapper: Mappers.AssetEndpointProfile, - }, - 204: { - bodyMapper: Mappers.AssetEndpointProfile, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.resource, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.assetEndpointProfileName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.AssetEndpointProfile, - }, - 201: { - bodyMapper: Mappers.AssetEndpointProfile, - }, - 202: { - bodyMapper: Mappers.AssetEndpointProfile, - }, - 204: { - bodyMapper: Mappers.AssetEndpointProfile, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.properties, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.assetEndpointProfileName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}", - httpMethod: "DELETE", - responses: { - 200: { - headersMapper: Mappers.AssetEndpointProfilesDeleteHeaders, - }, - 201: { - headersMapper: Mappers.AssetEndpointProfilesDeleteHeaders, - }, - 202: { - headersMapper: Mappers.AssetEndpointProfilesDeleteHeaders, - }, - 204: { - headersMapper: Mappers.AssetEndpointProfilesDeleteHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.assetEndpointProfileName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AssetEndpointProfileListResult, - }, - 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.AssetEndpointProfileListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/deviceregistry/arm-deviceregistry/src/operations/assets.ts b/sdk/deviceregistry/arm-deviceregistry/src/operations/assets.ts deleted file mode 100644 index d09b14681f07..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/src/operations/assets.ts +++ /dev/null @@ -1,722 +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"; -import { Assets } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { DeviceRegistryManagementClient } from "../deviceRegistryManagementClient"; -import { - SimplePollerLike, - OperationState, - createHttpPoller, -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl"; -import { - Asset, - AssetsListBySubscriptionNextOptionalParams, - AssetsListBySubscriptionOptionalParams, - AssetsListBySubscriptionResponse, - AssetsListByResourceGroupNextOptionalParams, - AssetsListByResourceGroupOptionalParams, - AssetsListByResourceGroupResponse, - AssetsGetOptionalParams, - AssetsGetResponse, - AssetsCreateOrReplaceOptionalParams, - AssetsCreateOrReplaceResponse, - AssetUpdate, - AssetsUpdateOptionalParams, - AssetsUpdateResponse, - AssetsDeleteOptionalParams, - AssetsDeleteResponse, - AssetsListBySubscriptionNextResponse, - AssetsListByResourceGroupNextResponse, -} from "../models"; - -/// -/** Class containing Assets operations. */ -export class AssetsImpl implements Assets { - private readonly client: DeviceRegistryManagementClient; - - /** - * Initialize a new instance of the class Assets class. - * @param client Reference to the service client - */ - constructor(client: DeviceRegistryManagementClient) { - this.client = client; - } - - /** - * List Asset resources by subscription ID - * @param options The options parameters. - */ - public listBySubscription( - options?: AssetsListBySubscriptionOptionalParams, - ): 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?: AssetsListBySubscriptionOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: AssetsListBySubscriptionResponse; - 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?: AssetsListBySubscriptionOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listBySubscriptionPagingPage(options)) { - yield* page; - } - } - - /** - * List Asset 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?: AssetsListByResourceGroupOptionalParams, - ): 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?: AssetsListByResourceGroupOptionalParams, - settings?: PageSettings, - ): AsyncIterableIterator { - let result: AssetsListByResourceGroupResponse; - 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?: AssetsListByResourceGroupOptionalParams, - ): AsyncIterableIterator { - for await (const page of this.listByResourceGroupPagingPage( - resourceGroupName, - options, - )) { - yield* page; - } - } - - /** - * List Asset resources by subscription ID - * @param options The options parameters. - */ - private _listBySubscription( - options?: AssetsListBySubscriptionOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { options }, - listBySubscriptionOperationSpec, - ); - } - - /** - * List Asset 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?: AssetsListByResourceGroupOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, options }, - listByResourceGroupOperationSpec, - ); - } - - /** - * Get a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - assetName: string, - options?: AssetsGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, assetName, options }, - getOperationSpec, - ); - } - - /** - * Create a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrReplace( - resourceGroupName: string, - assetName: string, - resource: Asset, - options?: AssetsCreateOrReplaceOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - AssetsCreateOrReplaceResponse - > - > { - 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, assetName, resource, options }, - spec: createOrReplaceOperationSpec, - }); - const poller = await createHttpPoller< - AssetsCreateOrReplaceResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation", - }); - await poller.poll(); - return poller; - } - - /** - * Create a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrReplaceAndWait( - resourceGroupName: string, - assetName: string, - resource: Asset, - options?: AssetsCreateOrReplaceOptionalParams, - ): Promise { - const poller = await this.beginCreateOrReplace( - resourceGroupName, - assetName, - resource, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Update a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - async beginUpdate( - resourceGroupName: string, - assetName: string, - properties: AssetUpdate, - options?: AssetsUpdateOptionalParams, - ): Promise< - SimplePollerLike, AssetsUpdateResponse> - > { - 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, assetName, properties, options }, - spec: updateOperationSpec, - }); - const poller = await createHttpPoller< - AssetsUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Update a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - async beginUpdateAndWait( - resourceGroupName: string, - assetName: string, - properties: AssetUpdate, - options?: AssetsUpdateOptionalParams, - ): Promise { - const poller = await this.beginUpdate( - resourceGroupName, - assetName, - properties, - options, - ); - return poller.pollUntilDone(); - } - - /** - * Delete a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - assetName: string, - options?: AssetsDeleteOptionalParams, - ): Promise< - SimplePollerLike, AssetsDeleteResponse> - > { - 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, assetName, options }, - spec: deleteOperationSpec, - }); - const poller = await createHttpPoller< - AssetsDeleteResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location", - }); - await poller.poll(); - return poller; - } - - /** - * Delete a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - assetName: string, - options?: AssetsDeleteOptionalParams, - ): Promise { - const poller = await this.beginDelete( - resourceGroupName, - assetName, - 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?: AssetsListBySubscriptionNextOptionalParams, - ): 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?: AssetsListByResourceGroupNextOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, nextLink, options }, - listByResourceGroupNextOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listBySubscriptionOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assets", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AssetListResult, - }, - 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.DeviceRegistry/assets", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AssetListResult, - }, - 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.DeviceRegistry/assets/{assetName}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Asset, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.assetName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const createOrReplaceOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Asset, - }, - 201: { - bodyMapper: Mappers.Asset, - }, - 202: { - bodyMapper: Mappers.Asset, - }, - 204: { - bodyMapper: Mappers.Asset, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.resource1, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.assetName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.Asset, - }, - 201: { - bodyMapper: Mappers.Asset, - }, - 202: { - bodyMapper: Mappers.Asset, - }, - 204: { - bodyMapper: Mappers.Asset, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - requestBody: Parameters.properties1, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.assetName, - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer, -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}", - httpMethod: "DELETE", - responses: { - 200: { - headersMapper: Mappers.AssetsDeleteHeaders, - }, - 201: { - headersMapper: Mappers.AssetsDeleteHeaders, - }, - 202: { - headersMapper: Mappers.AssetsDeleteHeaders, - }, - 204: { - headersMapper: Mappers.AssetsDeleteHeaders, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.assetName, - ], - headerParameters: [Parameters.accept], - serializer, -}; -const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AssetListResult, - }, - 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.AssetListResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/deviceregistry/arm-deviceregistry/src/operations/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/operations/index.ts deleted file mode 100644 index a5b6de543e80..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/src/operations/index.ts +++ /dev/null @@ -1,12 +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"; -export * from "./assetEndpointProfiles"; -export * from "./assets"; -export * from "./operationStatus"; diff --git a/sdk/deviceregistry/arm-deviceregistry/src/operations/operationStatus.ts b/sdk/deviceregistry/arm-deviceregistry/src/operations/operationStatus.ts deleted file mode 100644 index b192ce24790d..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/src/operations/operationStatus.ts +++ /dev/null @@ -1,71 +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 { OperationStatus } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { DeviceRegistryManagementClient } from "../deviceRegistryManagementClient"; -import { - OperationStatusGetOptionalParams, - OperationStatusGetResponse, -} from "../models"; - -/** Class containing OperationStatus operations. */ -export class OperationStatusImpl implements OperationStatus { - private readonly client: DeviceRegistryManagementClient; - - /** - * Initialize a new instance of the class OperationStatus class. - * @param client Reference to the service client - */ - constructor(client: DeviceRegistryManagementClient) { - this.client = client; - } - - /** - * Returns the current status of an async operation. - * @param location The name of Azure region. - * @param operationId The ID of an ongoing async operation. - * @param options The options parameters. - */ - get( - location: string, - operationId: string, - options?: OperationStatusGetOptionalParams, - ): Promise { - return this.client.sendOperationRequest( - { location, operationId, options }, - getOperationSpec, - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const getOperationSpec: coreClient.OperationSpec = { - path: "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/locations/{location}/operationStatuses/{operationId}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationStatusResult, - }, - default: { - bodyMapper: Mappers.ErrorResponse, - }, - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.location, - Parameters.operationId, - ], - headerParameters: [Parameters.accept], - serializer, -}; diff --git a/sdk/deviceregistry/arm-deviceregistry/src/operations/operations.ts b/sdk/deviceregistry/arm-deviceregistry/src/operations/operations.ts deleted file mode 100644 index 221d98ab21a2..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/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"; -import { Operations } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { DeviceRegistryManagementClient } from "../deviceRegistryManagementClient"; -import { - Operation, - OperationsListNextOptionalParams, - OperationsListOptionalParams, - OperationsListResponse, - OperationsListNextResponse, -} from "../models"; - -/// -/** Class containing Operations operations. */ -export class OperationsImpl implements Operations { - private readonly client: DeviceRegistryManagementClient; - - /** - * Initialize a new instance of the class Operations class. - * @param client Reference to the service client - */ - constructor(client: DeviceRegistryManagementClient) { - 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.DeviceRegistry/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/deviceregistry/arm-deviceregistry/src/operationsInterfaces/assetEndpointProfiles.ts b/sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/assetEndpointProfiles.ts deleted file mode 100644 index 95f8f1046d85..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/assetEndpointProfiles.ts +++ /dev/null @@ -1,145 +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 { - AssetEndpointProfile, - AssetEndpointProfilesListBySubscriptionOptionalParams, - AssetEndpointProfilesListByResourceGroupOptionalParams, - AssetEndpointProfilesGetOptionalParams, - AssetEndpointProfilesGetResponse, - AssetEndpointProfilesCreateOrReplaceOptionalParams, - AssetEndpointProfilesCreateOrReplaceResponse, - AssetEndpointProfileUpdate, - AssetEndpointProfilesUpdateOptionalParams, - AssetEndpointProfilesUpdateResponse, - AssetEndpointProfilesDeleteOptionalParams, - AssetEndpointProfilesDeleteResponse, -} from "../models"; - -/// -/** Interface representing a AssetEndpointProfiles. */ -export interface AssetEndpointProfiles { - /** - * List AssetEndpointProfile resources by subscription ID - * @param options The options parameters. - */ - listBySubscription( - options?: AssetEndpointProfilesListBySubscriptionOptionalParams, - ): PagedAsyncIterableIterator; - /** - * List AssetEndpointProfile 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?: AssetEndpointProfilesListByResourceGroupOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - assetEndpointProfileName: string, - options?: AssetEndpointProfilesGetOptionalParams, - ): Promise; - /** - * Create a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrReplace( - resourceGroupName: string, - assetEndpointProfileName: string, - resource: AssetEndpointProfile, - options?: AssetEndpointProfilesCreateOrReplaceOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - AssetEndpointProfilesCreateOrReplaceResponse - > - >; - /** - * Create a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrReplaceAndWait( - resourceGroupName: string, - assetEndpointProfileName: string, - resource: AssetEndpointProfile, - options?: AssetEndpointProfilesCreateOrReplaceOptionalParams, - ): Promise; - /** - * Update a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - assetEndpointProfileName: string, - properties: AssetEndpointProfileUpdate, - options?: AssetEndpointProfilesUpdateOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - AssetEndpointProfilesUpdateResponse - > - >; - /** - * Update a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - assetEndpointProfileName: string, - properties: AssetEndpointProfileUpdate, - options?: AssetEndpointProfilesUpdateOptionalParams, - ): Promise; - /** - * Delete a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - assetEndpointProfileName: string, - options?: AssetEndpointProfilesDeleteOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - AssetEndpointProfilesDeleteResponse - > - >; - /** - * Delete a AssetEndpointProfile - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetEndpointProfileName Asset Endpoint Profile name parameter. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - assetEndpointProfileName: string, - options?: AssetEndpointProfilesDeleteOptionalParams, - ): Promise; -} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/assets.ts b/sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/assets.ts deleted file mode 100644 index 1c8ea67be71a..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/assets.ts +++ /dev/null @@ -1,139 +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 { - Asset, - AssetsListBySubscriptionOptionalParams, - AssetsListByResourceGroupOptionalParams, - AssetsGetOptionalParams, - AssetsGetResponse, - AssetsCreateOrReplaceOptionalParams, - AssetsCreateOrReplaceResponse, - AssetUpdate, - AssetsUpdateOptionalParams, - AssetsUpdateResponse, - AssetsDeleteOptionalParams, - AssetsDeleteResponse, -} from "../models"; - -/// -/** Interface representing a Assets. */ -export interface Assets { - /** - * List Asset resources by subscription ID - * @param options The options parameters. - */ - listBySubscription( - options?: AssetsListBySubscriptionOptionalParams, - ): PagedAsyncIterableIterator; - /** - * List Asset 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?: AssetsListByResourceGroupOptionalParams, - ): PagedAsyncIterableIterator; - /** - * Get a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param options The options parameters. - */ - get( - resourceGroupName: string, - assetName: string, - options?: AssetsGetOptionalParams, - ): Promise; - /** - * Create a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrReplace( - resourceGroupName: string, - assetName: string, - resource: Asset, - options?: AssetsCreateOrReplaceOptionalParams, - ): Promise< - SimplePollerLike< - OperationState, - AssetsCreateOrReplaceResponse - > - >; - /** - * Create a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrReplaceAndWait( - resourceGroupName: string, - assetName: string, - resource: Asset, - options?: AssetsCreateOrReplaceOptionalParams, - ): Promise; - /** - * Update a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - beginUpdate( - resourceGroupName: string, - assetName: string, - properties: AssetUpdate, - options?: AssetsUpdateOptionalParams, - ): Promise< - SimplePollerLike, AssetsUpdateResponse> - >; - /** - * Update a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - beginUpdateAndWait( - resourceGroupName: string, - assetName: string, - properties: AssetUpdate, - options?: AssetsUpdateOptionalParams, - ): Promise; - /** - * Delete a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - assetName: string, - options?: AssetsDeleteOptionalParams, - ): Promise< - SimplePollerLike, AssetsDeleteResponse> - >; - /** - * Delete a Asset - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param assetName Asset name parameter. - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - assetName: string, - options?: AssetsDeleteOptionalParams, - ): Promise; -} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/index.ts b/sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/index.ts deleted file mode 100644 index a5b6de543e80..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/index.ts +++ /dev/null @@ -1,12 +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"; -export * from "./assetEndpointProfiles"; -export * from "./assets"; -export * from "./operationStatus"; diff --git a/sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/operationStatus.ts b/sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/operationStatus.ts deleted file mode 100644 index e2a1a2c1cda1..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/operationStatus.ts +++ /dev/null @@ -1,27 +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 { - OperationStatusGetOptionalParams, - OperationStatusGetResponse, -} from "../models"; - -/** Interface representing a OperationStatus. */ -export interface OperationStatus { - /** - * Returns the current status of an async operation. - * @param location The name of Azure region. - * @param operationId The ID of an ongoing async operation. - * @param options The options parameters. - */ - get( - location: string, - operationId: string, - options?: OperationStatusGetOptionalParams, - ): Promise; -} diff --git a/sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/operations.ts b/sdk/deviceregistry/arm-deviceregistry/src/operationsInterfaces/operations.ts deleted file mode 100644 index 251f5f582e64..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/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"; - -/// -/** 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/deviceregistry/arm-deviceregistry/src/pagingHelper.ts b/sdk/deviceregistry/arm-deviceregistry/src/pagingHelper.ts deleted file mode 100644 index 205cccc26592..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/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/deviceregistry/arm-deviceregistry/src/restorePollerHelpers.ts b/sdk/deviceregistry/arm-deviceregistry/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..bc6b8e91f298 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/src/restorePollerHelpers.ts @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { DeviceRegistryManagementClient } from "./deviceRegistryManagementClient.js"; +import { + _assetsCreateOrReplaceDeserialize, + _assetsUpdateDeserialize, + _assetsDeleteDeserialize, +} from "./api/assets/index.js"; +import { + _assetEndpointProfilesCreateOrReplaceDeserialize, + _assetEndpointProfilesUpdateDeserialize, + _assetEndpointProfilesDeleteDeserialize, +} from "./api/assetEndpointProfiles/index.js"; +import { + _discoveredAssetsCreateOrReplaceDeserialize, + _discoveredAssetsUpdateDeserialize, + _discoveredAssetsDeleteDeserialize, +} from "./api/discoveredAssets/index.js"; +import { + _discoveredAssetEndpointProfilesCreateOrReplaceDeserialize, + _discoveredAssetEndpointProfilesUpdateDeserialize, + _discoveredAssetEndpointProfilesDeleteDeserialize, +} from "./api/discoveredAssetEndpointProfiles/index.js"; +import { + _schemaRegistriesCreateOrReplaceDeserialize, + _schemaRegistriesUpdateDeserialize, + _schemaRegistriesDeleteDeserialize, +} from "./api/schemaRegistries/index.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: DeviceRegistryManagementClient, + 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 = { + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}": + { + deserializer: _assetsCreateOrReplaceDeserialize, + expectedStatuses: ["200", "201"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}": + { + deserializer: _assetsUpdateDeserialize, + expectedStatuses: ["200", "202"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}": + { + deserializer: _assetsDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}": + { + deserializer: _assetEndpointProfilesCreateOrReplaceDeserialize, + expectedStatuses: ["200", "201"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}": + { + deserializer: _assetEndpointProfilesUpdateDeserialize, + expectedStatuses: ["200", "202"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}": + { + deserializer: _assetEndpointProfilesDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}": + { + deserializer: _discoveredAssetsCreateOrReplaceDeserialize, + expectedStatuses: ["200", "201"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}": + { + deserializer: _discoveredAssetsUpdateDeserialize, + expectedStatuses: ["200", "202"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}": + { + deserializer: _discoveredAssetsDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}": + { + deserializer: _discoveredAssetEndpointProfilesCreateOrReplaceDeserialize, + expectedStatuses: ["200", "201"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}": + { + deserializer: _discoveredAssetEndpointProfilesUpdateDeserialize, + expectedStatuses: ["200", "202"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}": + { + deserializer: _discoveredAssetEndpointProfilesDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}": + { + deserializer: _schemaRegistriesCreateOrReplaceDeserialize, + expectedStatuses: ["200", "201"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}": + { + deserializer: _schemaRegistriesUpdateDeserialize, + expectedStatuses: ["200", "202"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}": + { + deserializer: _schemaRegistriesDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, +}; + +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/deviceregistry/arm-deviceregistry/src/static-helpers/pagingHelpers.ts b/sdk/deviceregistry/arm-deviceregistry/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..ce33af5f4178 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/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/deviceregistry/arm-deviceregistry/src/static-helpers/pollingHelpers.ts b/sdk/deviceregistry/arm-deviceregistry/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..f01c41bab69d --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/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/deviceregistry/arm-deviceregistry/test/deviceregistry_operations_test.spec.ts b/sdk/deviceregistry/arm-deviceregistry/test/deviceregistry_operations_test.spec.ts deleted file mode 100644 index bf71c8103a26..000000000000 --- a/sdk/deviceregistry/arm-deviceregistry/test/deviceregistry_operations_test.spec.ts +++ /dev/null @@ -1,70 +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, - delay, - isPlaybackMode, -} from "@azure-tools/test-recorder"; -import { createTestCredential } from "@azure-tools/test-credential"; -import { assert } from "chai"; -import { Context } from "mocha"; -import { DeviceRegistryManagementClient } from "../src/deviceRegistryManagementClient"; - -const replaceableVariables: Record = { - 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("DeviceRegistry test", () => { - let recorder: Recorder; - let subscriptionId: string; - let client: DeviceRegistryManagementClient; - let location: string; - let resourceGroup: string; - let resourcename: string; - - beforeEach(async function (this: Context) { - recorder = new Recorder(this.currentTest); - await recorder.start(recorderOptions); - subscriptionId = env.SUBSCRIPTION_ID || ''; - // This is an example of how the environment variables are used - const credential = createTestCredential(); - client = new DeviceRegistryManagementClient(credential, subscriptionId, recorder.configureClientOptions({})); - location = "eastus"; - resourceGroup = "myjstest"; - resourcename = "resourcetest"; - - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("operations list test", async function () { - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - assert.notEqual(resArray.length, 0); - }); - -}) diff --git a/sdk/deviceregistry/arm-deviceregistry/test/public/deviceregistry_operations_test.spec.ts b/sdk/deviceregistry/arm-deviceregistry/test/public/deviceregistry_operations_test.spec.ts new file mode 100644 index 000000000000..bd3a4a21047d --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/test/public/deviceregistry_operations_test.spec.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { env, Recorder, isPlaybackMode } from "@azure-tools/test-recorder"; +import { createTestCredential } from "@azure-tools/test-credential"; +import { assert, beforeEach, afterEach, it, describe } from "vitest"; +import { createRecorder } from "./utils/recordedClient.js"; +import { DeviceRegistryManagementClient } from "../../src/deviceRegistryManagementClient.js"; + +export const testPollingOptions = { + updateIntervalInMs: isPlaybackMode() ? 0 : undefined, +}; + +describe("DeviceRegistry test", () => { + let recorder: Recorder; + let subscriptionId: string; + let client: DeviceRegistryManagementClient; + + beforeEach(async (context) => { + process.env.SystemRoot = process.env.SystemRoot || "C:\\Windows"; + recorder = await createRecorder(context); + subscriptionId = env.SUBSCRIPTION_ID || ""; + // This is an example of how the environment variables are used + const credential = createTestCredential(); + client = new DeviceRegistryManagementClient( + credential, + subscriptionId, + recorder.configureClientOptions({}), + ); + }); + + afterEach(async function () { + await recorder.stop(); + }); + it("operations list test", async function () { + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + assert.notEqual(resArray.length, 0); + }); +}); diff --git a/sdk/deviceregistry/arm-deviceregistry/test/public/utils/recordedClient.ts b/sdk/deviceregistry/arm-deviceregistry/test/public/utils/recordedClient.ts new file mode 100644 index 000000000000..14dcd9fa397c --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/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/deviceregistry/arm-deviceregistry/tsconfig.browser.config.json b/sdk/deviceregistry/arm-deviceregistry/tsconfig.browser.config.json new file mode 100644 index 000000000000..75871518e3a0 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/tsconfig.browser.config.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.test.json", "../../../tsconfig.browser.base.json"] +} diff --git a/sdk/deviceregistry/arm-deviceregistry/tsconfig.json b/sdk/deviceregistry/arm-deviceregistry/tsconfig.json index 0eb02e213670..19ceb382b521 100644 --- a/sdk/deviceregistry/arm-deviceregistry/tsconfig.json +++ b/sdk/deviceregistry/arm-deviceregistry/tsconfig.json @@ -1,33 +1,13 @@ { - "compilerOptions": { - "module": "es6", - "moduleResolution": "node", - "strict": true, - "target": "es6", - "sourceMap": true, - "declarationMap": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "lib": [ - "es6", - "dom" - ], - "declaration": true, - "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-deviceregistry": [ - "./src/index" - ] + "references": [ + { + "path": "./tsconfig.src.json" + }, + { + "path": "./tsconfig.samples.json" + }, + { + "path": "./tsconfig.test.json" } - }, - "include": [ - "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" - ], - "exclude": [ - "node_modules" ] -} \ No newline at end of file +} diff --git a/sdk/deviceregistry/arm-deviceregistry/tsconfig.samples.json b/sdk/deviceregistry/arm-deviceregistry/tsconfig.samples.json new file mode 100644 index 000000000000..08116b2e9189 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure/arm-deviceregistry": ["./dist/esm"] + } + } +} diff --git a/sdk/deviceregistry/arm-deviceregistry/tsconfig.src.json b/sdk/deviceregistry/arm-deviceregistry/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/deviceregistry/arm-deviceregistry/tsconfig.test.json b/sdk/deviceregistry/arm-deviceregistry/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/deviceregistry/arm-deviceregistry/tsp-location.yaml b/sdk/deviceregistry/arm-deviceregistry/tsp-location.yaml new file mode 100644 index 000000000000..dbbdd96677a7 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/deviceregistry/DeviceRegistry.Management +commit: 6132d27fe22b7876e0064827a5ac70f7a6166ab9 +repo: ../azure-rest-api-specs +additionalDirectories: diff --git a/sdk/deviceregistry/arm-deviceregistry/vitest.browser.config.ts b/sdk/deviceregistry/arm-deviceregistry/vitest.browser.config.ts new file mode 100644 index 000000000000..b48c61b2ef46 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/vitest.browser.config.ts @@ -0,0 +1,17 @@ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { defineConfig, mergeConfig } from "vitest/config"; +import viteConfig from "../../../vitest.browser.shared.config.ts"; + +export default mergeConfig( + viteConfig, + defineConfig({ + test: { + include: [ + "dist-test/browser/test/**/*.spec.js", + ], + }, + }), +); diff --git a/sdk/deviceregistry/arm-deviceregistry/vitest.config.ts b/sdk/deviceregistry/arm-deviceregistry/vitest.config.ts new file mode 100644 index 000000000000..86a71911ccc2 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/vitest.config.ts @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { defineConfig, mergeConfig } from "vitest/config"; +import viteConfig from "../../../vitest.shared.config.ts"; + +export default mergeConfig( + viteConfig, + defineConfig({ + test: { + testTimeout: 1200000, + hookTimeout: 1200000, + }, + }), +); diff --git a/sdk/deviceregistry/arm-deviceregistry/vitest.esm.config.ts b/sdk/deviceregistry/arm-deviceregistry/vitest.esm.config.ts new file mode 100644 index 000000000000..a70127279fc9 --- /dev/null +++ b/sdk/deviceregistry/arm-deviceregistry/vitest.esm.config.ts @@ -0,0 +1,12 @@ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { mergeConfig } from "vitest/config"; +import vitestConfig from "./vitest.config.ts"; +import vitestEsmConfig from "../../../vitest.esm.shared.config.ts"; + +export default mergeConfig( + vitestConfig, + vitestEsmConfig +); diff --git a/sdk/deviceregistry/ci.mgmt.yml b/sdk/deviceregistry/ci.mgmt.yml index 9ff6e9b200e1..4637b02a4997 100644 --- a/sdk/deviceregistry/ci.mgmt.yml +++ b/sdk/deviceregistry/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/deviceregistry/arm-deviceregistry - sdk/deviceregistry/ci.mgmt.yml - pr: branches: include: @@ -27,7 +26,6 @@ pr: include: - sdk/deviceregistry/arm-deviceregistry - sdk/deviceregistry/ci.mgmt.yml - extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: @@ -35,4 +33,3 @@ extends: Artifacts: - name: azure-arm-deviceregistry safeName: azurearmdeviceregistry - \ No newline at end of file