From f1f6bf96d6dd0b61f8d62ee7af1c2cac50777d4d Mon Sep 17 00:00:00 2001 From: colawwj <70128817+colawwj@users.noreply.github.com> Date: Mon, 7 Mar 2022 16:39:14 +0800 Subject: [PATCH] digitalwins-release (#20616) --- common/config/rush/pnpm-lock.yaml | 15 +- .../arm-digitaltwins/CHANGELOG.md | 47 +- sdk/digitaltwins/arm-digitaltwins/README.md | 13 +- sdk/digitaltwins/arm-digitaltwins/_meta.json | 8 +- .../arm-digitaltwins/api-extractor.json | 25 +- .../arm-digitaltwins/package.json | 32 +- .../review/arm-digitaltwins.api.md | 175 ++++++- .../arm-digitaltwins/rollup.config.js | 78 +-- sdk/digitaltwins/arm-digitaltwins/sample.env | 4 + ...digitalTwinsCheckNameAvailabilitySample.ts | 42 ++ .../digitalTwinsCreateOrUpdateSample.ts | 101 ++++ .../samples-dev/digitalTwinsDeleteSample.ts | 60 +++ ...igitalTwinsEndpointCreateOrUpdateSample.ts | 87 +++ .../digitalTwinsEndpointDeleteSample.ts | 64 +++ .../digitalTwinsEndpointGetSample.ts | 64 +++ .../digitalTwinsEndpointListSample.ts | 66 +++ .../samples-dev/digitalTwinsGetSample.ts | 77 +++ .../digitalTwinsListByResourceGroupSample.ts | 37 ++ .../samples-dev/digitalTwinsListSample.ts | 34 ++ .../samples-dev/digitalTwinsUpdateSample.ts | 101 ++++ .../samples-dev/operationsListSample.ts | 34 ++ ...EndpointConnectionsCreateOrUpdateSample.ts | 52 ++ .../privateEndpointConnectionsDeleteSample.ts | 38 ++ .../privateEndpointConnectionsGetSample.ts | 40 ++ .../privateEndpointConnectionsListSample.ts | 36 ++ .../privateLinkResourcesGetSample.ts | 38 ++ .../privateLinkResourcesListSample.ts | 36 ++ ...DatabaseConnectionsCreateOrUpdateSample.ts | 58 ++ ...meSeriesDatabaseConnectionsDeleteSample.ts | 40 ++ .../timeSeriesDatabaseConnectionsGetSample.ts | 38 ++ ...timeSeriesDatabaseConnectionsListSample.ts | 41 ++ .../samples/v1-beta/javascript/README.md | 92 ++++ ...digitalTwinsCheckNameAvailabilitySample.js | 36 ++ .../digitalTwinsCreateOrUpdateSample.js | 87 +++ .../javascript/digitalTwinsDeleteSample.js | 48 ++ ...igitalTwinsEndpointCreateOrUpdateSample.js | 78 +++ .../digitalTwinsEndpointDeleteSample.js | 58 ++ .../digitalTwinsEndpointGetSample.js | 58 ++ .../digitalTwinsEndpointListSample.js | 54 ++ .../javascript/digitalTwinsGetSample.js | 66 +++ .../digitalTwinsListByResourceGroupSample.js | 32 ++ .../javascript/digitalTwinsListSample.js | 31 ++ .../javascript/digitalTwinsUpdateSample.js | 87 +++ .../javascript/operationsListSample.js | 31 ++ .../samples/v1-beta/javascript/package.json | 32 ++ ...EndpointConnectionsCreateOrUpdateSample.js | 44 ++ .../privateEndpointConnectionsDeleteSample.js | 35 ++ .../privateEndpointConnectionsGetSample.js | 35 ++ .../privateEndpointConnectionsListSample.js | 30 ++ .../privateLinkResourcesGetSample.js | 31 ++ .../privateLinkResourcesListSample.js | 30 ++ .../samples/v1-beta/javascript/sample.env | 4 + ...DatabaseConnectionsCreateOrUpdateSample.js | 50 ++ ...meSeriesDatabaseConnectionsDeleteSample.js | 35 ++ .../timeSeriesDatabaseConnectionsGetSample.js | 35 ++ ...timeSeriesDatabaseConnectionsListSample.js | 36 ++ .../samples/v1-beta/typescript/README.md | 105 ++++ .../samples/v1-beta/typescript/package.json | 41 ++ .../samples/v1-beta/typescript/sample.env | 4 + ...digitalTwinsCheckNameAvailabilitySample.ts | 42 ++ .../src/digitalTwinsCreateOrUpdateSample.ts | 101 ++++ .../src/digitalTwinsDeleteSample.ts | 60 +++ ...igitalTwinsEndpointCreateOrUpdateSample.ts | 87 +++ .../src/digitalTwinsEndpointDeleteSample.ts | 64 +++ .../src/digitalTwinsEndpointGetSample.ts | 64 +++ .../src/digitalTwinsEndpointListSample.ts | 66 +++ .../typescript/src/digitalTwinsGetSample.ts | 77 +++ .../digitalTwinsListByResourceGroupSample.ts | 37 ++ .../typescript/src/digitalTwinsListSample.ts | 34 ++ .../src/digitalTwinsUpdateSample.ts | 101 ++++ .../typescript/src/operationsListSample.ts | 34 ++ ...EndpointConnectionsCreateOrUpdateSample.ts | 52 ++ .../privateEndpointConnectionsDeleteSample.ts | 38 ++ .../privateEndpointConnectionsGetSample.ts | 40 ++ .../privateEndpointConnectionsListSample.ts | 36 ++ .../src/privateLinkResourcesGetSample.ts | 38 ++ .../src/privateLinkResourcesListSample.ts | 36 ++ ...DatabaseConnectionsCreateOrUpdateSample.ts | 58 ++ ...meSeriesDatabaseConnectionsDeleteSample.ts | 40 ++ .../timeSeriesDatabaseConnectionsGetSample.ts | 38 ++ ...timeSeriesDatabaseConnectionsListSample.ts | 41 ++ .../samples/v1-beta/typescript/tsconfig.json | 17 + .../src/azureDigitalTwinsManagementClient.ts | 14 +- .../arm-digitaltwins/src/models/index.ts | 231 +++++++- .../arm-digitaltwins/src/models/mappers.ts | 229 +++++++- .../arm-digitaltwins/src/models/parameters.ts | 26 +- .../arm-digitaltwins/src/operations/index.ts | 1 + .../timeSeriesDatabaseConnections.ts | 495 ++++++++++++++++++ .../src/operationsInterfaces/index.ts | 1 + .../timeSeriesDatabaseConnections.ts | 115 ++++ .../arm-digitaltwins/tsconfig.json | 24 +- sdk/digitaltwins/ci.mgmt.yml | 9 +- sdk/digitaltwins/ci.yml | 3 + 93 files changed, 5063 insertions(+), 172 deletions(-) create mode 100644 sdk/digitaltwins/arm-digitaltwins/sample.env create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsCheckNameAvailabilitySample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsCreateOrUpdateSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsDeleteSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointCreateOrUpdateSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointDeleteSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointGetSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointListSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsGetSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsListByResourceGroupSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsListSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsUpdateSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/operationsListSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsCreateOrUpdateSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsDeleteSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsGetSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsListSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/privateLinkResourcesGetSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/privateLinkResourcesListSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsCreateOrUpdateSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsDeleteSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsGetSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsListSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/README.md create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsCheckNameAvailabilitySample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsCreateOrUpdateSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsDeleteSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointCreateOrUpdateSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointDeleteSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointGetSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointListSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsGetSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsListByResourceGroupSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsListSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsUpdateSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/operationsListSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/package.json create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsCreateOrUpdateSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsListSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateLinkResourcesGetSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateLinkResourcesListSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/sample.env create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsCreateOrUpdateSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsDeleteSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsGetSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsListSample.js create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/README.md create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/package.json create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/sample.env create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsCheckNameAvailabilitySample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsCreateOrUpdateSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsDeleteSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointCreateOrUpdateSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointDeleteSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointGetSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointListSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsGetSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsListByResourceGroupSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsListSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsUpdateSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/operationsListSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateOrUpdateSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsListSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateLinkResourcesGetSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateLinkResourcesListSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsCreateOrUpdateSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsDeleteSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsGetSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsListSample.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/tsconfig.json create mode 100644 sdk/digitaltwins/arm-digitaltwins/src/operations/timeSeriesDatabaseConnections.ts create mode 100644 sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/timeSeriesDatabaseConnections.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 652d4d196478..935ca74901a6 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -10370,27 +10370,28 @@ packages: dev: false file:projects/arm-digitaltwins.tgz: - resolution: {integrity: sha512-6R4pbTXuSogk3aU0tLFTEUTrQ3wLmS0if3qpQ0TxW8jBiqWuC035pQwo26q1C5/RgNG95NrO87b6QNF0f+aktw==, tarball: file:projects/arm-digitaltwins.tgz} + resolution: {integrity: sha512-UoYxvLJ6lsdjg2ko5jVsLEQQLC1nIjSFPc4lkFkwwUJAMFgceRXpPAcTMs+O0aICUIZSgs3Fw+sVW8m6ZbFsxA==, tarball: file:projects/arm-digitaltwins.tgz} name: '@rush-temp/arm-digitaltwins' version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 '@azure/identity': 2.0.4 '@microsoft/api-extractor': 7.19.4 - '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 - '@rollup/plugin-json': 4.1.0_rollup@1.32.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + '@rollup/plugin-commonjs': 21.0.1_rollup@2.67.1 + '@rollup/plugin-json': 4.1.0_rollup@2.67.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.67.1 + '@rollup/plugin-node-resolve': 13.1.3_rollup@2.67.1 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 - rollup: 1.32.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + rollup: 2.67.1 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.67.1 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.15.1 transitivePeerDependencies: + - '@types/node' - debug - encoding - supports-color diff --git a/sdk/digitaltwins/arm-digitaltwins/CHANGELOG.md b/sdk/digitaltwins/arm-digitaltwins/CHANGELOG.md index 6aecb7110b1b..99362b0f54bf 100644 --- a/sdk/digitaltwins/arm-digitaltwins/CHANGELOG.md +++ b/sdk/digitaltwins/arm-digitaltwins/CHANGELOG.md @@ -1,15 +1,40 @@ # Release History - -## 3.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + +## 3.1.0-beta.1 (2022-03-02) + +**Features** + + - Added operation group TimeSeriesDatabaseConnections + - Added Interface GroupIdInformationProperties + - Added Interface SystemData + - Added Interface TimeSeriesDatabaseConnectionListResult + - Added Interface TimeSeriesDatabaseConnectionProperties + - Added Interface TimeSeriesDatabaseConnectionsCreateOrUpdateOptionalParams + - Added Interface TimeSeriesDatabaseConnectionsDeleteOptionalParams + - Added Interface TimeSeriesDatabaseConnectionsGetOptionalParams + - Added Interface TimeSeriesDatabaseConnectionsListNextOptionalParams + - Added Interface TimeSeriesDatabaseConnectionsListOptionalParams + - Added Type Alias AzureDataExplorerConnectionProperties + - Added Type Alias ConnectionType_2 + - Added Type Alias CreatedByType + - Added Type Alias TimeSeriesDatabaseConnection + - Added Type Alias TimeSeriesDatabaseConnectionPropertiesUnion + - Added Type Alias TimeSeriesDatabaseConnectionsCreateOrUpdateResponse + - Added Type Alias TimeSeriesDatabaseConnectionsDeleteResponse + - Added Type Alias TimeSeriesDatabaseConnectionsGetResponse + - Added Type Alias TimeSeriesDatabaseConnectionsListNextResponse + - Added Type Alias TimeSeriesDatabaseConnectionsListResponse + - Added Type Alias TimeSeriesDatabaseConnectionState + - Interface DigitalTwinsResource has a new optional parameter systemData + - Interface ExternalResource has a new optional parameter systemData + - Interface Operation has a new optional parameter properties + - Interface PrivateEndpointConnection has a new optional parameter systemData + - Class AzureDigitalTwinsManagementClient has a new parameter timeSeriesDatabaseConnections + - Added Enum KnownConnectionType + - Added Enum KnownCreatedByType + - Added Enum KnownTimeSeriesDatabaseConnectionState + + ## 3.0.0 (2022-01-13) The package of @azure/arm-digitaltwins is using our next generation design principles since version 3.0.0, which contains breaking changes. diff --git a/sdk/digitaltwins/arm-digitaltwins/README.md b/sdk/digitaltwins/arm-digitaltwins/README.md index 7a8e9e51a0b7..659e8cb83b5f 100644 --- a/sdk/digitaltwins/arm-digitaltwins/README.md +++ b/sdk/digitaltwins/arm-digitaltwins/README.md @@ -6,7 +6,7 @@ Azure Digital Twins Client for managing DigitalTwinsInstance [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/digitaltwins/arm-digitaltwins) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-digitaltwins) | -[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-digitaltwins) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-digitaltwins?view=azure-node-preview) | [Samples](https://github.com/Azure-Samples/azure-samples-js-management) ## Getting started @@ -16,6 +16,8 @@ Azure Digital Twins Client for managing DigitalTwinsInstance - [LTS versions of Node.js](https://nodejs.org/about/releases/) - Latest versions of Safari, Chrome, Edge and Firefox. +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + ### Prerequisites - An [Azure subscription][azure_sub]. @@ -49,8 +51,17 @@ For more information about how to create an Azure AD Application check out [this ```javascript const { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); const { DefaultAzureCredential } = require("@azure/identity"); +// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. + const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new AzureDigitalTwinsManagementClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); ``` diff --git a/sdk/digitaltwins/arm-digitaltwins/_meta.json b/sdk/digitaltwins/arm-digitaltwins/_meta.json index 5369742eb463..0ff4af9e798a 100644 --- a/sdk/digitaltwins/arm-digitaltwins/_meta.json +++ b/sdk/digitaltwins/arm-digitaltwins/_meta.json @@ -1,7 +1,7 @@ { - "commit": "1f1d5b0b9ce6cc94605b2fd619dce374fb6e033a", + "commit": "4042a47cff72c950d35dd72149895b044ed79713", "readme": "specification/digitaltwins/resource-manager/readme.md", - "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/devspaces/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211217.1", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\digitaltwins\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-beta.16 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20211217.1" -} + "use": "@autorest/typescript@6.0.0-beta.16" +} \ No newline at end of file diff --git a/sdk/digitaltwins/arm-digitaltwins/api-extractor.json b/sdk/digitaltwins/arm-digitaltwins/api-extractor.json index f74b96ff2afe..02dd3e1aedb3 100644 --- a/sdk/digitaltwins/arm-digitaltwins/api-extractor.json +++ b/sdk/digitaltwins/arm-digitaltwins/api-extractor.json @@ -1,18 +1,31 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", - "docModel": { "enabled": true }, - "apiReport": { "enabled": true, "reportFolder": "./review" }, + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, "dtsRollup": { "enabled": true, "untrimmedFilePath": "", "publicTrimmedFilePath": "./types/arm-digitaltwins.d.ts" }, "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } } } -} +} \ No newline at end of file diff --git a/sdk/digitaltwins/arm-digitaltwins/package.json b/sdk/digitaltwins/arm-digitaltwins/package.json index 6386ddef0347..f59aab8a20d1 100644 --- a/sdk/digitaltwins/arm-digitaltwins/package.json +++ b/sdk/digitaltwins/arm-digitaltwins/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for AzureDigitalTwinsManagementClient.", - "version": "3.0.1", + "version": "3.1.0-beta.1", "engines": { "node": ">=12.0.0" }, @@ -29,13 +29,13 @@ "types": "./types/arm-digitaltwins.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.18.11", - "@rollup/plugin-commonjs": "11.0.2", - "@rollup/plugin-json": "^4.0.0", - "@rollup/plugin-multi-entry": "^3.0.0", - "@rollup/plugin-node-resolve": "^8.0.0", + "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-multi-entry": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", "mkdirp": "^1.0.4", - "rollup": "^1.16.3", - "rollup-plugin-sourcemaps": "^0.4.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.2.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", @@ -98,5 +98,21 @@ "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true + "//metadata": { + "constantPaths": [ + { + "path": "src/azureDigitalTwinsManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-digitaltwins?view=azure-node-preview" + } } diff --git a/sdk/digitaltwins/arm-digitaltwins/review/arm-digitaltwins.api.md b/sdk/digitaltwins/arm-digitaltwins/review/arm-digitaltwins.api.md index d0926f188c5f..c59f4630fcbe 100644 --- a/sdk/digitaltwins/arm-digitaltwins/review/arm-digitaltwins.api.md +++ b/sdk/digitaltwins/arm-digitaltwins/review/arm-digitaltwins.api.md @@ -13,6 +13,19 @@ import { PollOperationState } from '@azure/core-lro'; // @public export type AuthenticationType = string; +// @public +export type AzureDataExplorerConnectionProperties = TimeSeriesDatabaseConnectionProperties & { + connectionType: "AzureDataExplorer"; + adxResourceId: string; + adxEndpointUri: string; + adxDatabaseName: string; + adxTableName?: string; + eventHubEndpointUri: string; + eventHubEntityPath: string; + eventHubNamespaceResourceId: string; + eventHubConsumerGroup?: string; +}; + // @public (undocumented) export class AzureDigitalTwinsManagementClient extends coreClient.ServiceClient { // (undocumented) @@ -32,6 +45,8 @@ export class AzureDigitalTwinsManagementClient extends coreClient.ServiceClient privateLinkResources: PrivateLinkResources; // (undocumented) subscriptionId: string; + // (undocumented) + timeSeriesDatabaseConnections: TimeSeriesDatabaseConnections; } // @public @@ -57,17 +72,12 @@ export interface CheckNameResult { // @public export interface ConnectionProperties { groupIds?: string[]; - // (undocumented) - privateEndpoint?: ConnectionPropertiesPrivateEndpoint; - // (undocumented) + privateEndpoint?: PrivateEndpoint; privateLinkServiceConnectionState?: ConnectionPropertiesPrivateLinkServiceConnectionState; readonly provisioningState?: ConnectionPropertiesProvisioningState; } -// @public (undocumented) -export type ConnectionPropertiesPrivateEndpoint = PrivateEndpoint & {}; - -// @public (undocumented) +// @public export type ConnectionPropertiesPrivateLinkServiceConnectionState = ConnectionState & {}; // @public @@ -80,6 +90,13 @@ export interface ConnectionState { status: PrivateLinkServiceConnectionStatus; } +// @public +type ConnectionType_2 = string; +export { ConnectionType_2 as ConnectionType } + +// @public +export type CreatedByType = string; + // @public export interface DigitalTwins { beginCreateOrUpdate(resourceGroupName: string, resourceName: string, digitalTwinsCreate: DigitalTwinsDescription, options?: DigitalTwinsCreateOrUpdateOptionalParams): Promise, DigitalTwinsCreateOrUpdateResponse>>; @@ -273,6 +290,7 @@ export interface DigitalTwinsResource { identity?: DigitalTwinsIdentity; location: string; readonly name?: string; + readonly systemData?: SystemData; tags?: { [propertyName: string]: string; }; @@ -327,6 +345,7 @@ export type EventHub = DigitalTwinsEndpointResourceProperties & { export interface ExternalResource { readonly id?: string; readonly name?: string; + readonly systemData?: SystemData; readonly type?: string; } @@ -334,16 +353,12 @@ export interface ExternalResource { export interface GroupIdInformation { id?: string; readonly name?: string; - // (undocumented) properties: GroupIdInformationProperties; readonly type?: string; } -// @public (undocumented) -export type GroupIdInformationProperties = GroupIdInformationPropertiesAutoGenerated & {}; - // @public -export interface GroupIdInformationPropertiesAutoGenerated { +export interface GroupIdInformationProperties { groupId?: string; requiredMembers?: string[]; requiredZoneNames?: string[]; @@ -374,6 +389,24 @@ export enum KnownConnectionPropertiesProvisioningState { Rejected = "Rejected" } +// @public +export enum KnownConnectionType { + // (undocumented) + AzureDataExplorer = "AzureDataExplorer" +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + // @public export enum KnownDigitalTwinsIdentityType { // (undocumented) @@ -472,12 +505,41 @@ export enum KnownReason { Invalid = "Invalid" } +// @public +export enum KnownTimeSeriesDatabaseConnectionState { + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Deleted = "Deleted", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Failed = "Failed", + // (undocumented) + Moving = "Moving", + // (undocumented) + Provisioning = "Provisioning", + // (undocumented) + Restoring = "Restoring", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Suspending = "Suspending", + // (undocumented) + Warning = "Warning" +} + // @public export interface Operation { display?: OperationDisplay; readonly isDataAction?: boolean; readonly name?: string; readonly origin?: string; + readonly properties?: { + [propertyName: string]: Record; + }; } // @public @@ -522,14 +584,11 @@ export interface PrivateEndpoint { export interface PrivateEndpointConnection { readonly id?: string; readonly name?: string; - // (undocumented) - properties: PrivateEndpointConnectionProperties; + properties: ConnectionProperties; + readonly systemData?: SystemData; readonly type?: string; } -// @public (undocumented) -export type PrivateEndpointConnectionProperties = ConnectionProperties & {}; - // @public export interface PrivateEndpointConnections { beginCreateOrUpdate(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: PrivateEndpointConnectionsCreateOrUpdateOptionalParams): Promise, PrivateEndpointConnectionsCreateOrUpdateResponse>>; @@ -615,6 +674,88 @@ export type ServiceBus = DigitalTwinsEndpointResourceProperties & { entityPath?: string; }; +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export type TimeSeriesDatabaseConnection = ExternalResource & { + properties?: TimeSeriesDatabaseConnectionPropertiesUnion; +}; + +// @public +export interface TimeSeriesDatabaseConnectionListResult { + nextLink?: string; + value?: TimeSeriesDatabaseConnection[]; +} + +// @public +export interface TimeSeriesDatabaseConnectionProperties { + connectionType: "AzureDataExplorer"; + readonly provisioningState?: TimeSeriesDatabaseConnectionState; +} + +// @public (undocumented) +export type TimeSeriesDatabaseConnectionPropertiesUnion = TimeSeriesDatabaseConnectionProperties | AzureDataExplorerConnectionProperties; + +// @public +export interface TimeSeriesDatabaseConnections { + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, timeSeriesDatabaseConnectionName: string, timeSeriesDatabaseConnectionDescription: TimeSeriesDatabaseConnection, options?: TimeSeriesDatabaseConnectionsCreateOrUpdateOptionalParams): Promise, TimeSeriesDatabaseConnectionsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, resourceName: string, timeSeriesDatabaseConnectionName: string, timeSeriesDatabaseConnectionDescription: TimeSeriesDatabaseConnection, options?: TimeSeriesDatabaseConnectionsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, resourceName: string, timeSeriesDatabaseConnectionName: string, options?: TimeSeriesDatabaseConnectionsDeleteOptionalParams): Promise, TimeSeriesDatabaseConnectionsDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, resourceName: string, timeSeriesDatabaseConnectionName: string, options?: TimeSeriesDatabaseConnectionsDeleteOptionalParams): Promise; + get(resourceGroupName: string, resourceName: string, timeSeriesDatabaseConnectionName: string, options?: TimeSeriesDatabaseConnectionsGetOptionalParams): Promise; + list(resourceGroupName: string, resourceName: string, options?: TimeSeriesDatabaseConnectionsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface TimeSeriesDatabaseConnectionsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type TimeSeriesDatabaseConnectionsCreateOrUpdateResponse = TimeSeriesDatabaseConnection; + +// @public +export interface TimeSeriesDatabaseConnectionsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type TimeSeriesDatabaseConnectionsDeleteResponse = TimeSeriesDatabaseConnection; + +// @public +export interface TimeSeriesDatabaseConnectionsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TimeSeriesDatabaseConnectionsGetResponse = TimeSeriesDatabaseConnection; + +// @public +export interface TimeSeriesDatabaseConnectionsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TimeSeriesDatabaseConnectionsListNextResponse = TimeSeriesDatabaseConnectionListResult; + +// @public +export interface TimeSeriesDatabaseConnectionsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TimeSeriesDatabaseConnectionsListResponse = TimeSeriesDatabaseConnectionListResult; + +// @public +export type TimeSeriesDatabaseConnectionState = string; + // (No @packageDocumentation comment for this package) ``` diff --git a/sdk/digitaltwins/arm-digitaltwins/rollup.config.js b/sdk/digitaltwins/arm-digitaltwins/rollup.config.js index 9be1955eb7f1..3f89d7309da5 100644 --- a/sdk/digitaltwins/arm-digitaltwins/rollup.config.js +++ b/sdk/digitaltwins/arm-digitaltwins/rollup.config.js @@ -14,62 +14,14 @@ import json from "@rollup/plugin-json"; import nodeBuiltins from "builtin-modules"; -/** - * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. - * - * NOTE: this manual configuration is only needed because OpenTelemetry uses an - * __exportStar downleveled helper function to declare its exports which confuses - * rollup's automatic discovery mechanism. - * - * @returns an object reference that can be `...`'d into your cjs() configuration. - */ -export function openTelemetryCommonJs() { - const namedExports = {}; - - for (const key of [ - "@opentelemetry/api", - "@azure/core-tracing/node_modules/@opentelemetry/api" - ]) { - namedExports[key] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "SpanStatusCode", - "getSpanContext", - "setSpanContext" - ]; - } - - const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; - - for (const version of releasedOpenTelemetryVersions) { - namedExports[ - // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. - `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` - ] = [ - "SpanKind", - "TraceFlags", - "getSpan", - "setSpan", - "StatusCode", - "CanonicalCode", - "getSpanContext", - "setSpanContext" - ]; - } - - return namedExports; -} - // #region Warning Handler /** - * A function that can determine whether a rollupwarning should be ignored. If + * A function that can determine whether a rollup warning should be ignored. If * the function returns `true`, then the warning will not be displayed. */ -function ignoreNiseSinonEvalWarnings(warning) { +function ignoreNiseSinonEval(warning) { return ( warning.code === "EVAL" && warning.id && @@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) { ); } -function ignoreChaiCircularDependencyWarnings(warning) { +function ignoreChaiCircularDependency(warning) { return ( warning.code === "CIRCULAR_DEPENDENCY" && warning.importer && warning.importer.includes("node_modules/chai") === true ); } -const warningInhibitors = [ - ignoreChaiCircularDependencyWarnings, - ignoreNiseSinonEvalWarnings -]; +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; /** * Construct a warning handler for the shared rollup configuration @@ -122,22 +71,7 @@ function makeBrowserTestConfig() { nodeResolve({ mainFields: ["module", "browser"] }), - cjs({ - namedExports: { - // Chai's strange internal architecture makes it impossible to statically - // analyze its exports. - chai: [ - "version", - "use", - "util", - "config", - "expect", - "should", - "assert" - ], - ...openTelemetryCommonJs() - } - }), + cjs(), json(), sourcemaps() //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) @@ -173,7 +107,7 @@ export function makeConfig(pkg, options) { ], output: { file: "dist/index.js", format: "cjs", sourcemap: true }, preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve(), cjs()] + plugins: [sourcemaps(), nodeResolve()] }; const config = [baseConfig]; diff --git a/sdk/digitaltwins/arm-digitaltwins/sample.env b/sdk/digitaltwins/arm-digitaltwins/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsCheckNameAvailabilitySample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..2ce6144cf6b9 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsCheckNameAvailabilitySample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + CheckNameRequest, + AzureDigitalTwinsManagementClient +} from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Check if a DigitalTwinsInstance name is available. + * + * @summary Check if a DigitalTwinsInstance name is available. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsCheckNameAvailability_example.json + */ +async function checkNameAvailability() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const location = "WestUS2"; + const digitalTwinsInstanceCheckName: CheckNameRequest = { + name: "myadtinstance", + type: "Microsoft.DigitalTwins/digitalTwinsInstances" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.checkNameAvailability( + location, + digitalTwinsInstanceCheckName + ); + console.log(result); +} + +checkNameAvailability().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsCreateOrUpdateSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ef3bbcfb1d3e --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsCreateOrUpdateSample.ts @@ -0,0 +1,101 @@ +/* + * 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 { + DigitalTwinsDescription, + AzureDigitalTwinsManagementClient +} from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * + * @summary Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPut_example.json + */ +async function putADigitalTwinsInstanceResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsCreate: DigitalTwinsDescription = { location: "WestUS2" }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsCreate + ); + console.log(result); +} + +putADigitalTwinsInstanceResource().catch(console.error); + +/** + * This sample demonstrates how to Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * + * @summary Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPut_WithIdentity_example.json + */ +async function putADigitalTwinsInstanceResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsCreate: DigitalTwinsDescription = { + identity: { type: "SystemAssigned" }, + location: "WestUS2" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsCreate + ); + console.log(result); +} + +putADigitalTwinsInstanceResourceWithIdentity().catch(console.error); + +/** + * This sample demonstrates how to Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * + * @summary Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPut_WithPublicNetworkAccess.json + */ +async function putADigitalTwinsInstanceResourceWithPublicNetworkAccessProperty() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsCreate: DigitalTwinsDescription = { + location: "WestUS2", + publicNetworkAccess: "Enabled" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsCreate + ); + console.log(result); +} + +putADigitalTwinsInstanceResourceWithPublicNetworkAccessProperty().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsDeleteSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsDeleteSample.ts new file mode 100644 index 000000000000..b5a1e484b5ab --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsDeleteSample.ts @@ -0,0 +1,60 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete a DigitalTwinsInstance. + * + * @summary Delete a DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsDelete_example.json + */ +async function deleteADigitalTwinsInstanceResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginDeleteAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +deleteADigitalTwinsInstanceResource().catch(console.error); + +/** + * This sample demonstrates how to Delete a DigitalTwinsInstance. + * + * @summary Delete a DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsDelete_WithIdentity_example.json + */ +async function deleteADigitalTwinsInstanceResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginDeleteAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +deleteADigitalTwinsInstanceResourceWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointCreateOrUpdateSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointCreateOrUpdateSample.ts new file mode 100644 index 000000000000..cc63c11efc1e --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointCreateOrUpdateSample.ts @@ -0,0 +1,87 @@ +/* + * 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 { + DigitalTwinsEndpointResource, + AzureDigitalTwinsManagementClient +} from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update DigitalTwinsInstance endpoint. + * + * @summary Create or update DigitalTwinsInstance endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointPut_example.json + */ +async function putADigitalTwinsEndpointResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myServiceBus"; + const endpointDescription: DigitalTwinsEndpointResource = { + properties: { + authenticationType: "KeyBased", + endpointType: "ServiceBus", + primaryConnectionString: + "Endpoint=sb://mysb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xyzxyzoX4=;EntityPath=abcabc", + secondaryConnectionString: + "Endpoint=sb://mysb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xyzxyzoX4=;EntityPath=abcabc" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwinsEndpoint.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + endpointName, + endpointDescription + ); + console.log(result); +} + +putADigitalTwinsEndpointResource().catch(console.error); + +/** + * This sample demonstrates how to Create or update DigitalTwinsInstance endpoint. + * + * @summary Create or update DigitalTwinsInstance endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointPut_WithIdentity_example.json + */ +async function putADigitalTwinsEndpointResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myServiceBus"; + const endpointDescription: DigitalTwinsEndpointResource = { + properties: { + authenticationType: "IdentityBased", + endpointType: "ServiceBus", + endpointUri: "sb://mysb.servicebus.windows.net/", + entityPath: "mysbtopic" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwinsEndpoint.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + endpointName, + endpointDescription + ); + console.log(result); +} + +putADigitalTwinsEndpointResourceWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointDeleteSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointDeleteSample.ts new file mode 100644 index 000000000000..8ff3640b4085 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointDeleteSample.ts @@ -0,0 +1,64 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete a DigitalTwinsInstance endpoint. + * + * @summary Delete a DigitalTwinsInstance endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointDelete_example.json + */ +async function deleteADigitalTwinsInstanceEndpoint() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myendpoint"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwinsEndpoint.beginDeleteAndWait( + resourceGroupName, + resourceName, + endpointName + ); + console.log(result); +} + +deleteADigitalTwinsInstanceEndpoint().catch(console.error); + +/** + * This sample demonstrates how to Delete a DigitalTwinsInstance endpoint. + * + * @summary Delete a DigitalTwinsInstance endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointDelete_WithIdentity_example.json + */ +async function deleteADigitalTwinsInstanceEndpointWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myendpoint"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwinsEndpoint.beginDeleteAndWait( + resourceGroupName, + resourceName, + endpointName + ); + console.log(result); +} + +deleteADigitalTwinsInstanceEndpointWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointGetSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointGetSample.ts new file mode 100644 index 000000000000..3e71d8f47ac3 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointGetSample.ts @@ -0,0 +1,64 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get DigitalTwinsInstances Endpoint. + * + * @summary Get DigitalTwinsInstances Endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointGet_example.json + */ +async function getADigitalTwinsInstanceEndpoint() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myServiceBus"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwinsEndpoint.get( + resourceGroupName, + resourceName, + endpointName + ); + console.log(result); +} + +getADigitalTwinsInstanceEndpoint().catch(console.error); + +/** + * This sample demonstrates how to Get DigitalTwinsInstances Endpoint. + * + * @summary Get DigitalTwinsInstances Endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointGet_WithIdentity_example.json + */ +async function getADigitalTwinsInstanceEndpointWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myServiceBus"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwinsEndpoint.get( + resourceGroupName, + resourceName, + endpointName + ); + console.log(result); +} + +getADigitalTwinsInstanceEndpointWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointListSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointListSample.ts new file mode 100644 index 000000000000..b90b153e5f6e --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsEndpointListSample.ts @@ -0,0 +1,66 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get DigitalTwinsInstance Endpoints. + * + * @summary Get DigitalTwinsInstance Endpoints. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointsGet_example.json + */ +async function getADigitalTwinsInstanceEndpoints() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.digitalTwinsEndpoint.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +getADigitalTwinsInstanceEndpoints().catch(console.error); + +/** + * This sample demonstrates how to Get DigitalTwinsInstance Endpoints. + * + * @summary Get DigitalTwinsInstance Endpoints. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointsGet_WithIdentity_example.json + */ +async function getADigitalTwinsInstanceEndpointsWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.digitalTwinsEndpoint.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +getADigitalTwinsInstanceEndpointsWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsGetSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsGetSample.ts new file mode 100644 index 000000000000..8efb0602720c --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsGetSample.ts @@ -0,0 +1,77 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get DigitalTwinsInstances resource. + * + * @summary Get DigitalTwinsInstances resource. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsGet_example.json + */ +async function getADigitalTwinsInstanceResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.get(resourceGroupName, resourceName); + console.log(result); +} + +getADigitalTwinsInstanceResource().catch(console.error); + +/** + * This sample demonstrates how to Get DigitalTwinsInstances resource. + * + * @summary Get DigitalTwinsInstances resource. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsGet_WithPrivateEndpointConnection_example.json + */ +async function getADigitalTwinsInstanceResourceWithAPrivateEndpointConnection() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.get(resourceGroupName, resourceName); + console.log(result); +} + +getADigitalTwinsInstanceResourceWithAPrivateEndpointConnection().catch( + console.error +); + +/** + * This sample demonstrates how to Get DigitalTwinsInstances resource. + * + * @summary Get DigitalTwinsInstances resource. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsGet_WithIdentity_example.json + */ +async function getADigitalTwinsInstanceResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.get(resourceGroupName, resourceName); + console.log(result); +} + +getADigitalTwinsInstanceResourceWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsListByResourceGroupSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsListByResourceGroupSample.ts new file mode 100644 index 000000000000..7c31fc561d4a --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsListByResourceGroupSample.ts @@ -0,0 +1,37 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get all the DigitalTwinsInstances in a resource group. + * + * @summary Get all the DigitalTwinsInstances in a resource group. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsListByResourceGroup_example.json + */ +async function getDigitalTwinsInstanceResourcesByResourceGroup() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.digitalTwins.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +getDigitalTwinsInstanceResourcesByResourceGroup().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsListSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsListSample.ts new file mode 100644 index 000000000000..74d809274b5f --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsListSample.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get all the DigitalTwinsInstances in a subscription. + * + * @summary Get all the DigitalTwinsInstances in a subscription. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsList_example.json + */ +async function getDigitalTwinsInstanceResourcesBySubscription() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.digitalTwins.list()) { + resArray.push(item); + } + console.log(resArray); +} + +getDigitalTwinsInstanceResourcesBySubscription().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsUpdateSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsUpdateSample.ts new file mode 100644 index 000000000000..ea53963d9efa --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/digitalTwinsUpdateSample.ts @@ -0,0 +1,101 @@ +/* + * 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 { + DigitalTwinsPatchDescription, + AzureDigitalTwinsManagementClient +} from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update metadata of DigitalTwinsInstance. + * + * @summary Update metadata of DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPatch_example.json + */ +async function patchADigitalTwinsInstanceResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsPatchDescription: DigitalTwinsPatchDescription = { + tags: { purpose: "dev" } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsPatchDescription + ); + console.log(result); +} + +patchADigitalTwinsInstanceResource().catch(console.error); + +/** + * This sample demonstrates how to Update metadata of DigitalTwinsInstance. + * + * @summary Update metadata of DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPatch_WithIdentity_example.json + */ +async function patchADigitalTwinsInstanceResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsPatchDescription: DigitalTwinsPatchDescription = { + identity: { type: "None" } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsPatchDescription + ); + console.log(result); +} + +patchADigitalTwinsInstanceResourceWithIdentity().catch(console.error); + +/** + * This sample demonstrates how to Update metadata of DigitalTwinsInstance. + * + * @summary Update metadata of DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPatch_WithPublicNetworkAccess.json + */ +async function patchADigitalTwinsInstanceResourceWithPublicNetworkAccessProperty() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsPatchDescription: DigitalTwinsPatchDescription = { + properties: { publicNetworkAccess: "Disabled" } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsPatchDescription + ); + console.log(result); +} + +patchADigitalTwinsInstanceResourceWithPublicNetworkAccessProperty().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/operationsListSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..49b1f158a27f --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/operationsListSample.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the available DigitalTwins service REST API operations. + * + * @summary Lists all of the available DigitalTwins service REST API operations. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsOperationsList_example.json + */ +async function getAvailableOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +getAvailableOperations().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsCreateOrUpdateSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..3863682e6e8c --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsCreateOrUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { + PrivateEndpointConnection, + AzureDigitalTwinsManagementClient +} from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update the status of a private endpoint connection with the given name. + * + * @summary Update the status of a private endpoint connection with the given name. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionPut_example.json + */ +async function updateTheStatusOfAPrivateEndpointConnectionWithTheGivenName() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const privateEndpointConnectionName = "myPrivateConnection"; + const privateEndpointConnection: PrivateEndpointConnection = { + properties: { + privateLinkServiceConnectionState: { + description: "Approved by johndoe@company.com.", + status: "Approved" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.privateEndpointConnections.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection + ); + console.log(result); +} + +updateTheStatusOfAPrivateEndpointConnectionWithTheGivenName().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsDeleteSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsDeleteSample.ts new file mode 100644 index 000000000000..8af9de6d22a1 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsDeleteSample.ts @@ -0,0 +1,38 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete private endpoint connection with the specified name. + * + * @summary Delete private endpoint connection with the specified name. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionDelete_example.json + */ +async function deletePrivateEndpointConnectionWithTheSpecifiedName() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const privateEndpointConnectionName = "myPrivateConnection"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.privateEndpointConnections.beginDeleteAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +deletePrivateEndpointConnectionWithTheSpecifiedName().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsGetSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsGetSample.ts new file mode 100644 index 000000000000..472e1b30c1ec --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsGetSample.ts @@ -0,0 +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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get private endpoint connection properties for the given private endpoint. + * + * @summary Get private endpoint connection properties for the given private endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionByConnectionName_example.json + */ +async function getPrivateEndpointConnectionPropertiesForTheGivenPrivateEndpoint() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const privateEndpointConnectionName = "myPrivateConnection"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +getPrivateEndpointConnectionPropertiesForTheGivenPrivateEndpoint().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsListSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsListSample.ts new file mode 100644 index 000000000000..19b4e4a9410e --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateEndpointConnectionsListSample.ts @@ -0,0 +1,36 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List private endpoint connection properties. + * + * @summary List private endpoint connection properties. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionsList_example.json + */ +async function listPrivateEndpointConnectionProperties() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.privateEndpointConnections.list( + resourceGroupName, + resourceName + ); + console.log(result); +} + +listPrivateEndpointConnectionProperties().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateLinkResourcesGetSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateLinkResourcesGetSample.ts new file mode 100644 index 000000000000..2a26c1a3d724 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateLinkResourcesGetSample.ts @@ -0,0 +1,38 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the specified private link resource for the given Digital Twin. + * + * @summary Get the specified private link resource for the given Digital Twin. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateLinkResourcesByGroupId_example.json + */ +async function getTheSpecifiedPrivateLinkResourceForTheGivenDigitalTwin() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const resourceId = "subResource"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.privateLinkResources.get( + resourceGroupName, + resourceName, + resourceId + ); + console.log(result); +} + +getTheSpecifiedPrivateLinkResourceForTheGivenDigitalTwin().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateLinkResourcesListSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateLinkResourcesListSample.ts new file mode 100644 index 000000000000..29fcefb69c8b --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/privateLinkResourcesListSample.ts @@ -0,0 +1,36 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List private link resources for given Digital Twin. + * + * @summary List private link resources for given Digital Twin. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateLinkResourcesList_example.json + */ +async function listPrivateLinkResourcesForGivenDigitalTwin() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.privateLinkResources.list( + resourceGroupName, + resourceName + ); + console.log(result); +} + +listPrivateLinkResourcesForGivenDigitalTwin().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsCreateOrUpdateSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..459fb9556b02 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsCreateOrUpdateSample.ts @@ -0,0 +1,58 @@ +/* + * 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 { + TimeSeriesDatabaseConnection, + AzureDigitalTwinsManagementClient +} from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update a time series database connection. + * + * @summary Create or update a time series database connection. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsPut_example.json + */ +async function createOrReplaceATimeSeriesDatabaseConnectionForADigitalTwinsInstance() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const timeSeriesDatabaseConnectionName = "myConnection"; + const timeSeriesDatabaseConnectionDescription: TimeSeriesDatabaseConnection = { + properties: { + adxDatabaseName: "myDatabase", + adxEndpointUri: "https://mycluster.kusto.windows.net", + adxResourceId: + "/subscriptions/c493073e-2460-45ba-a403-f3e0df1e9feg/resourceGroups/testrg/providers/Microsoft.Kusto/clusters/mycluster", + adxTableName: "myTable", + connectionType: "AzureDataExplorer", + eventHubEndpointUri: "sb://myeh.servicebus.windows.net/", + eventHubEntityPath: "myeh", + eventHubNamespaceResourceId: + "/subscriptions/c493073e-2460-45ba-a403-f3e0df1e9feg/resourceGroups/testrg/providers/Microsoft.EventHub/namespaces/myeh" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.timeSeriesDatabaseConnections.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName, + timeSeriesDatabaseConnectionDescription + ); + console.log(result); +} + +createOrReplaceATimeSeriesDatabaseConnectionForADigitalTwinsInstance().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsDeleteSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsDeleteSample.ts new file mode 100644 index 000000000000..7e5f84191724 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsDeleteSample.ts @@ -0,0 +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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete a time series database connection. + * + * @summary Delete a time series database connection. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsDelete_example.json + */ +async function deleteATimeSeriesDatabaseConnectionForADigitalTwinsInstance() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const timeSeriesDatabaseConnectionName = "myConnection"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.timeSeriesDatabaseConnections.beginDeleteAndWait( + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName + ); + console.log(result); +} + +deleteATimeSeriesDatabaseConnectionForADigitalTwinsInstance().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsGetSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsGetSample.ts new file mode 100644 index 000000000000..6d3b8538ad65 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsGetSample.ts @@ -0,0 +1,38 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the description of an existing time series database connection. + * + * @summary Get the description of an existing time series database connection. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsGet_example.json + */ +async function getTimeSeriesDatabaseConnectionForADigitalTwinsInstance() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const timeSeriesDatabaseConnectionName = "myConnection"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.timeSeriesDatabaseConnections.get( + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName + ); + console.log(result); +} + +getTimeSeriesDatabaseConnectionForADigitalTwinsInstance().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsListSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsListSample.ts new file mode 100644 index 000000000000..45771366c0b0 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples-dev/timeSeriesDatabaseConnectionsListSample.ts @@ -0,0 +1,41 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get all existing time series database connections for this DigitalTwins instance. + * + * @summary Get all existing time series database connections for this DigitalTwins instance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsList_example.json + */ +async function listTimeSeriesDatabaseConnectionsForADigitalTwinsInstance() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.timeSeriesDatabaseConnections.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listTimeSeriesDatabaseConnectionsForADigitalTwinsInstance().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/README.md b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/README.md new file mode 100644 index 000000000000..0ecf14b1b4c3 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/README.md @@ -0,0 +1,92 @@ +# 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** | +| --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [digitalTwinsCheckNameAvailabilitySample.js][digitaltwinschecknameavailabilitysample] | Check if a DigitalTwinsInstance name is available. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsCheckNameAvailability_example.json | +| [digitalTwinsCreateOrUpdateSample.js][digitaltwinscreateorupdatesample] | Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPut_example.json | +| [digitalTwinsDeleteSample.js][digitaltwinsdeletesample] | Delete a DigitalTwinsInstance. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsDelete_example.json | +| [digitalTwinsEndpointCreateOrUpdateSample.js][digitaltwinsendpointcreateorupdatesample] | Create or update DigitalTwinsInstance endpoint. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointPut_example.json | +| [digitalTwinsEndpointDeleteSample.js][digitaltwinsendpointdeletesample] | Delete a DigitalTwinsInstance endpoint. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointDelete_example.json | +| [digitalTwinsEndpointGetSample.js][digitaltwinsendpointgetsample] | Get DigitalTwinsInstances Endpoint. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointGet_example.json | +| [digitalTwinsEndpointListSample.js][digitaltwinsendpointlistsample] | Get DigitalTwinsInstance Endpoints. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointsGet_example.json | +| [digitalTwinsGetSample.js][digitaltwinsgetsample] | Get DigitalTwinsInstances resource. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsGet_example.json | +| [digitalTwinsListByResourceGroupSample.js][digitaltwinslistbyresourcegroupsample] | Get all the DigitalTwinsInstances in a resource group. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsListByResourceGroup_example.json | +| [digitalTwinsListSample.js][digitaltwinslistsample] | Get all the DigitalTwinsInstances in a subscription. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsList_example.json | +| [digitalTwinsUpdateSample.js][digitaltwinsupdatesample] | Update metadata of DigitalTwinsInstance. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPatch_example.json | +| [operationsListSample.js][operationslistsample] | Lists all of the available DigitalTwins service REST API operations. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsOperationsList_example.json | +| [privateEndpointConnectionsCreateOrUpdateSample.js][privateendpointconnectionscreateorupdatesample] | Update the status of a private endpoint connection with the given name. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionPut_example.json | +| [privateEndpointConnectionsDeleteSample.js][privateendpointconnectionsdeletesample] | Delete private endpoint connection with the specified name. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionDelete_example.json | +| [privateEndpointConnectionsGetSample.js][privateendpointconnectionsgetsample] | Get private endpoint connection properties for the given private endpoint. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionByConnectionName_example.json | +| [privateEndpointConnectionsListSample.js][privateendpointconnectionslistsample] | List private endpoint connection properties. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionsList_example.json | +| [privateLinkResourcesGetSample.js][privatelinkresourcesgetsample] | Get the specified private link resource for the given Digital Twin. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateLinkResourcesByGroupId_example.json | +| [privateLinkResourcesListSample.js][privatelinkresourceslistsample] | List private link resources for given Digital Twin. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateLinkResourcesList_example.json | +| [timeSeriesDatabaseConnectionsCreateOrUpdateSample.js][timeseriesdatabaseconnectionscreateorupdatesample] | Create or update a time series database connection. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsPut_example.json | +| [timeSeriesDatabaseConnectionsDeleteSample.js][timeseriesdatabaseconnectionsdeletesample] | Delete a time series database connection. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsDelete_example.json | +| [timeSeriesDatabaseConnectionsGetSample.js][timeseriesdatabaseconnectionsgetsample] | Get the description of an existing time series database connection. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsGet_example.json | +| [timeSeriesDatabaseConnectionsListSample.js][timeseriesdatabaseconnectionslistsample] | Get all existing time series database connections for this DigitalTwins instance. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsList_example.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node digitalTwinsCheckNameAvailabilitySample.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 cross-env node digitalTwinsCheckNameAvailabilitySample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[digitaltwinschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsCheckNameAvailabilitySample.js +[digitaltwinscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsCreateOrUpdateSample.js +[digitaltwinsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsDeleteSample.js +[digitaltwinsendpointcreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointCreateOrUpdateSample.js +[digitaltwinsendpointdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointDeleteSample.js +[digitaltwinsendpointgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointGetSample.js +[digitaltwinsendpointlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointListSample.js +[digitaltwinsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsGetSample.js +[digitaltwinslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsListByResourceGroupSample.js +[digitaltwinslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsListSample.js +[digitaltwinsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsUpdateSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/operationsListSample.js +[privateendpointconnectionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsCreateOrUpdateSample.js +[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js +[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js +[privateendpointconnectionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsListSample.js +[privatelinkresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateLinkResourcesGetSample.js +[privatelinkresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateLinkResourcesListSample.js +[timeseriesdatabaseconnectionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsCreateOrUpdateSample.js +[timeseriesdatabaseconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsDeleteSample.js +[timeseriesdatabaseconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsGetSample.js +[timeseriesdatabaseconnectionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsListSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-digitaltwins?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/digitaltwins/arm-digitaltwins/README.md diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsCheckNameAvailabilitySample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsCheckNameAvailabilitySample.js new file mode 100644 index 000000000000..2ca7721f5ee3 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsCheckNameAvailabilitySample.js @@ -0,0 +1,36 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Check if a DigitalTwinsInstance name is available. + * + * @summary Check if a DigitalTwinsInstance name is available. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsCheckNameAvailability_example.json + */ +async function checkNameAvailability() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const location = "WestUS2"; + const digitalTwinsInstanceCheckName = { + name: "myadtinstance", + type: "Microsoft.DigitalTwins/digitalTwinsInstances", + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwins.checkNameAvailability( + location, + digitalTwinsInstanceCheckName + ); + console.log(result); +} + +checkNameAvailability().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsCreateOrUpdateSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsCreateOrUpdateSample.js new file mode 100644 index 000000000000..829f9d0c12a3 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsCreateOrUpdateSample.js @@ -0,0 +1,87 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * + * @summary Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPut_example.json + */ +async function putADigitalTwinsInstanceResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsCreate = { location: "WestUS2" }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwins.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsCreate + ); + console.log(result); +} + +putADigitalTwinsInstanceResource().catch(console.error); + +/** + * This sample demonstrates how to Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * + * @summary Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPut_WithIdentity_example.json + */ +async function putADigitalTwinsInstanceResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsCreate = { + identity: { type: "SystemAssigned" }, + location: "WestUS2", + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwins.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsCreate + ); + console.log(result); +} + +putADigitalTwinsInstanceResourceWithIdentity().catch(console.error); + +/** + * This sample demonstrates how to Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * + * @summary Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPut_WithPublicNetworkAccess.json + */ +async function putADigitalTwinsInstanceResourceWithPublicNetworkAccessProperty() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsCreate = { + location: "WestUS2", + publicNetworkAccess: "Enabled", + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwins.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsCreate + ); + console.log(result); +} + +putADigitalTwinsInstanceResourceWithPublicNetworkAccessProperty().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsDeleteSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsDeleteSample.js new file mode 100644 index 000000000000..805ed17ea3b2 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsDeleteSample.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete a DigitalTwinsInstance. + * + * @summary Delete a DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsDelete_example.json + */ +async function deleteADigitalTwinsInstanceResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwins.beginDeleteAndWait(resourceGroupName, resourceName); + console.log(result); +} + +deleteADigitalTwinsInstanceResource().catch(console.error); + +/** + * This sample demonstrates how to Delete a DigitalTwinsInstance. + * + * @summary Delete a DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsDelete_WithIdentity_example.json + */ +async function deleteADigitalTwinsInstanceResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwins.beginDeleteAndWait(resourceGroupName, resourceName); + console.log(result); +} + +deleteADigitalTwinsInstanceResourceWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointCreateOrUpdateSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointCreateOrUpdateSample.js new file mode 100644 index 000000000000..e64a35882e01 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointCreateOrUpdateSample.js @@ -0,0 +1,78 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or update DigitalTwinsInstance endpoint. + * + * @summary Create or update DigitalTwinsInstance endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointPut_example.json + */ +async function putADigitalTwinsEndpointResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myServiceBus"; + const endpointDescription = { + properties: { + authenticationType: "KeyBased", + endpointType: "ServiceBus", + primaryConnectionString: + "Endpoint=sb://mysb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xyzxyzoX4=;EntityPath=abcabc", + secondaryConnectionString: + "Endpoint=sb://mysb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xyzxyzoX4=;EntityPath=abcabc", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwinsEndpoint.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + endpointName, + endpointDescription + ); + console.log(result); +} + +putADigitalTwinsEndpointResource().catch(console.error); + +/** + * This sample demonstrates how to Create or update DigitalTwinsInstance endpoint. + * + * @summary Create or update DigitalTwinsInstance endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointPut_WithIdentity_example.json + */ +async function putADigitalTwinsEndpointResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myServiceBus"; + const endpointDescription = { + properties: { + authenticationType: "IdentityBased", + endpointType: "ServiceBus", + endpointUri: "sb://mysb.servicebus.windows.net/", + entityPath: "mysbtopic", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwinsEndpoint.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + endpointName, + endpointDescription + ); + console.log(result); +} + +putADigitalTwinsEndpointResourceWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointDeleteSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointDeleteSample.js new file mode 100644 index 000000000000..6178584dafc2 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointDeleteSample.js @@ -0,0 +1,58 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete a DigitalTwinsInstance endpoint. + * + * @summary Delete a DigitalTwinsInstance endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointDelete_example.json + */ +async function deleteADigitalTwinsInstanceEndpoint() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myendpoint"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwinsEndpoint.beginDeleteAndWait( + resourceGroupName, + resourceName, + endpointName + ); + console.log(result); +} + +deleteADigitalTwinsInstanceEndpoint().catch(console.error); + +/** + * This sample demonstrates how to Delete a DigitalTwinsInstance endpoint. + * + * @summary Delete a DigitalTwinsInstance endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointDelete_WithIdentity_example.json + */ +async function deleteADigitalTwinsInstanceEndpointWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myendpoint"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwinsEndpoint.beginDeleteAndWait( + resourceGroupName, + resourceName, + endpointName + ); + console.log(result); +} + +deleteADigitalTwinsInstanceEndpointWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointGetSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointGetSample.js new file mode 100644 index 000000000000..73d7f4cbb4d6 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointGetSample.js @@ -0,0 +1,58 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get DigitalTwinsInstances Endpoint. + * + * @summary Get DigitalTwinsInstances Endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointGet_example.json + */ +async function getADigitalTwinsInstanceEndpoint() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myServiceBus"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwinsEndpoint.get( + resourceGroupName, + resourceName, + endpointName + ); + console.log(result); +} + +getADigitalTwinsInstanceEndpoint().catch(console.error); + +/** + * This sample demonstrates how to Get DigitalTwinsInstances Endpoint. + * + * @summary Get DigitalTwinsInstances Endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointGet_WithIdentity_example.json + */ +async function getADigitalTwinsInstanceEndpointWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myServiceBus"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwinsEndpoint.get( + resourceGroupName, + resourceName, + endpointName + ); + console.log(result); +} + +getADigitalTwinsInstanceEndpointWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointListSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointListSample.js new file mode 100644 index 000000000000..6d6201e11762 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsEndpointListSample.js @@ -0,0 +1,54 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get DigitalTwinsInstance Endpoints. + * + * @summary Get DigitalTwinsInstance Endpoints. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointsGet_example.json + */ +async function getADigitalTwinsInstanceEndpoints() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.digitalTwinsEndpoint.list(resourceGroupName, resourceName)) { + resArray.push(item); + } + console.log(resArray); +} + +getADigitalTwinsInstanceEndpoints().catch(console.error); + +/** + * This sample demonstrates how to Get DigitalTwinsInstance Endpoints. + * + * @summary Get DigitalTwinsInstance Endpoints. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointsGet_WithIdentity_example.json + */ +async function getADigitalTwinsInstanceEndpointsWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.digitalTwinsEndpoint.list(resourceGroupName, resourceName)) { + resArray.push(item); + } + console.log(resArray); +} + +getADigitalTwinsInstanceEndpointsWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsGetSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsGetSample.js new file mode 100644 index 000000000000..5e3ad70a253e --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsGetSample.js @@ -0,0 +1,66 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get DigitalTwinsInstances resource. + * + * @summary Get DigitalTwinsInstances resource. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsGet_example.json + */ +async function getADigitalTwinsInstanceResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwins.get(resourceGroupName, resourceName); + console.log(result); +} + +getADigitalTwinsInstanceResource().catch(console.error); + +/** + * This sample demonstrates how to Get DigitalTwinsInstances resource. + * + * @summary Get DigitalTwinsInstances resource. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsGet_WithPrivateEndpointConnection_example.json + */ +async function getADigitalTwinsInstanceResourceWithAPrivateEndpointConnection() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwins.get(resourceGroupName, resourceName); + console.log(result); +} + +getADigitalTwinsInstanceResourceWithAPrivateEndpointConnection().catch(console.error); + +/** + * This sample demonstrates how to Get DigitalTwinsInstances resource. + * + * @summary Get DigitalTwinsInstances resource. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsGet_WithIdentity_example.json + */ +async function getADigitalTwinsInstanceResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwins.get(resourceGroupName, resourceName); + console.log(result); +} + +getADigitalTwinsInstanceResourceWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsListByResourceGroupSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsListByResourceGroupSample.js new file mode 100644 index 000000000000..2af7283b772a --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsListByResourceGroupSample.js @@ -0,0 +1,32 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get all the DigitalTwinsInstances in a resource group. + * + * @summary Get all the DigitalTwinsInstances in a resource group. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsListByResourceGroup_example.json + */ +async function getDigitalTwinsInstanceResourcesByResourceGroup() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.digitalTwins.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +getDigitalTwinsInstanceResourcesByResourceGroup().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsListSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsListSample.js new file mode 100644 index 000000000000..ade6892149d1 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsListSample.js @@ -0,0 +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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get all the DigitalTwinsInstances in a subscription. + * + * @summary Get all the DigitalTwinsInstances in a subscription. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsList_example.json + */ +async function getDigitalTwinsInstanceResourcesBySubscription() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.digitalTwins.list()) { + resArray.push(item); + } + console.log(resArray); +} + +getDigitalTwinsInstanceResourcesBySubscription().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsUpdateSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsUpdateSample.js new file mode 100644 index 000000000000..e64481251bd8 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/digitalTwinsUpdateSample.js @@ -0,0 +1,87 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update metadata of DigitalTwinsInstance. + * + * @summary Update metadata of DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPatch_example.json + */ +async function patchADigitalTwinsInstanceResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsPatchDescription = { + tags: { purpose: "dev" }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwins.beginUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsPatchDescription + ); + console.log(result); +} + +patchADigitalTwinsInstanceResource().catch(console.error); + +/** + * This sample demonstrates how to Update metadata of DigitalTwinsInstance. + * + * @summary Update metadata of DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPatch_WithIdentity_example.json + */ +async function patchADigitalTwinsInstanceResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsPatchDescription = { + identity: { type: "None" }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwins.beginUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsPatchDescription + ); + console.log(result); +} + +patchADigitalTwinsInstanceResourceWithIdentity().catch(console.error); + +/** + * This sample demonstrates how to Update metadata of DigitalTwinsInstance. + * + * @summary Update metadata of DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPatch_WithPublicNetworkAccess.json + */ +async function patchADigitalTwinsInstanceResourceWithPublicNetworkAccessProperty() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsPatchDescription = { + properties: { publicNetworkAccess: "Disabled" }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.digitalTwins.beginUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsPatchDescription + ); + console.log(result); +} + +patchADigitalTwinsInstanceResourceWithPublicNetworkAccessProperty().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/operationsListSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/operationsListSample.js new file mode 100644 index 000000000000..eaf73dcaaf31 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/operationsListSample.js @@ -0,0 +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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Lists all of the available DigitalTwins service REST API operations. + * + * @summary Lists all of the available DigitalTwins service REST API operations. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsOperationsList_example.json + */ +async function getAvailableOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +getAvailableOperations().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/package.json b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/package.json new file mode 100644 index 000000000000..85c1289da473 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "azure-arm-digitaltwins-samples-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/digitaltwins/arm-digitaltwins" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/digitaltwins/arm-digitaltwins", + "dependencies": { + "@azure/arm-digitaltwins": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsCreateOrUpdateSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsCreateOrUpdateSample.js new file mode 100644 index 000000000000..adc929361e58 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsCreateOrUpdateSample.js @@ -0,0 +1,44 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update the status of a private endpoint connection with the given name. + * + * @summary Update the status of a private endpoint connection with the given name. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionPut_example.json + */ +async function updateTheStatusOfAPrivateEndpointConnectionWithTheGivenName() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const privateEndpointConnectionName = "myPrivateConnection"; + const privateEndpointConnection = { + properties: { + privateLinkServiceConnectionState: { + description: "Approved by johndoe@company.com.", + status: "Approved", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection + ); + console.log(result); +} + +updateTheStatusOfAPrivateEndpointConnectionWithTheGivenName().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js new file mode 100644 index 000000000000..5624b3f1e76a --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsDeleteSample.js @@ -0,0 +1,35 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete private endpoint connection with the specified name. + * + * @summary Delete private endpoint connection with the specified name. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionDelete_example.json + */ +async function deletePrivateEndpointConnectionWithTheSpecifiedName() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const privateEndpointConnectionName = "myPrivateConnection"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginDeleteAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +deletePrivateEndpointConnectionWithTheSpecifiedName().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js new file mode 100644 index 000000000000..8b728d91fd8d --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsGetSample.js @@ -0,0 +1,35 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get private endpoint connection properties for the given private endpoint. + * + * @summary Get private endpoint connection properties for the given private endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionByConnectionName_example.json + */ +async function getPrivateEndpointConnectionPropertiesForTheGivenPrivateEndpoint() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const privateEndpointConnectionName = "myPrivateConnection"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +getPrivateEndpointConnectionPropertiesForTheGivenPrivateEndpoint().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsListSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsListSample.js new file mode 100644 index 000000000000..59788ef429c0 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateEndpointConnectionsListSample.js @@ -0,0 +1,30 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List private endpoint connection properties. + * + * @summary List private endpoint connection properties. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionsList_example.json + */ +async function listPrivateEndpointConnectionProperties() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.list(resourceGroupName, resourceName); + console.log(result); +} + +listPrivateEndpointConnectionProperties().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateLinkResourcesGetSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateLinkResourcesGetSample.js new file mode 100644 index 000000000000..c87aad0d0f1c --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateLinkResourcesGetSample.js @@ -0,0 +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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get the specified private link resource for the given Digital Twin. + * + * @summary Get the specified private link resource for the given Digital Twin. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateLinkResourcesByGroupId_example.json + */ +async function getTheSpecifiedPrivateLinkResourceForTheGivenDigitalTwin() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const resourceId = "subResource"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.privateLinkResources.get(resourceGroupName, resourceName, resourceId); + console.log(result); +} + +getTheSpecifiedPrivateLinkResourceForTheGivenDigitalTwin().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateLinkResourcesListSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateLinkResourcesListSample.js new file mode 100644 index 000000000000..7e074d1da053 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/privateLinkResourcesListSample.js @@ -0,0 +1,30 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List private link resources for given Digital Twin. + * + * @summary List private link resources for given Digital Twin. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateLinkResourcesList_example.json + */ +async function listPrivateLinkResourcesForGivenDigitalTwin() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.privateLinkResources.list(resourceGroupName, resourceName); + console.log(result); +} + +listPrivateLinkResourcesForGivenDigitalTwin().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/sample.env b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsCreateOrUpdateSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsCreateOrUpdateSample.js new file mode 100644 index 000000000000..9ecd2191d493 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsCreateOrUpdateSample.js @@ -0,0 +1,50 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or update a time series database connection. + * + * @summary Create or update a time series database connection. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsPut_example.json + */ +async function createOrReplaceATimeSeriesDatabaseConnectionForADigitalTwinsInstance() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const timeSeriesDatabaseConnectionName = "myConnection"; + const timeSeriesDatabaseConnectionDescription = { + properties: { + adxDatabaseName: "myDatabase", + adxEndpointUri: "https://mycluster.kusto.windows.net", + adxResourceId: + "/subscriptions/c493073e-2460-45ba-a403-f3e0df1e9feg/resourceGroups/testrg/providers/Microsoft.Kusto/clusters/mycluster", + adxTableName: "myTable", + connectionType: "AzureDataExplorer", + eventHubEndpointUri: "sb://myeh.servicebus.windows.net/", + eventHubEntityPath: "myeh", + eventHubNamespaceResourceId: + "/subscriptions/c493073e-2460-45ba-a403-f3e0df1e9feg/resourceGroups/testrg/providers/Microsoft.EventHub/namespaces/myeh", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.timeSeriesDatabaseConnections.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName, + timeSeriesDatabaseConnectionDescription + ); + console.log(result); +} + +createOrReplaceATimeSeriesDatabaseConnectionForADigitalTwinsInstance().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsDeleteSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsDeleteSample.js new file mode 100644 index 000000000000..cdd2b1f45753 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsDeleteSample.js @@ -0,0 +1,35 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete a time series database connection. + * + * @summary Delete a time series database connection. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsDelete_example.json + */ +async function deleteATimeSeriesDatabaseConnectionForADigitalTwinsInstance() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const timeSeriesDatabaseConnectionName = "myConnection"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.timeSeriesDatabaseConnections.beginDeleteAndWait( + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName + ); + console.log(result); +} + +deleteATimeSeriesDatabaseConnectionForADigitalTwinsInstance().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsGetSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsGetSample.js new file mode 100644 index 000000000000..b5f353374660 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsGetSample.js @@ -0,0 +1,35 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get the description of an existing time series database connection. + * + * @summary Get the description of an existing time series database connection. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsGet_example.json + */ +async function getTimeSeriesDatabaseConnectionForADigitalTwinsInstance() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const timeSeriesDatabaseConnectionName = "myConnection"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const result = await client.timeSeriesDatabaseConnections.get( + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName + ); + console.log(result); +} + +getTimeSeriesDatabaseConnectionForADigitalTwinsInstance().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsListSample.js b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsListSample.js new file mode 100644 index 000000000000..420d8da70756 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/javascript/timeSeriesDatabaseConnectionsListSample.js @@ -0,0 +1,36 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } = require("@azure/arm-digitaltwins"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get all existing time series database connections for this DigitalTwins instance. + * + * @summary Get all existing time series database connections for this DigitalTwins instance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsList_example.json + */ +async function listTimeSeriesDatabaseConnectionsForADigitalTwinsInstance() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.timeSeriesDatabaseConnections.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listTimeSeriesDatabaseConnectionsForADigitalTwinsInstance().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/README.md b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/README.md new file mode 100644 index 000000000000..c3f7a65c9e8f --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/README.md @@ -0,0 +1,105 @@ +# 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** | +| --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [digitalTwinsCheckNameAvailabilitySample.ts][digitaltwinschecknameavailabilitysample] | Check if a DigitalTwinsInstance name is available. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsCheckNameAvailability_example.json | +| [digitalTwinsCreateOrUpdateSample.ts][digitaltwinscreateorupdatesample] | Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPut_example.json | +| [digitalTwinsDeleteSample.ts][digitaltwinsdeletesample] | Delete a DigitalTwinsInstance. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsDelete_example.json | +| [digitalTwinsEndpointCreateOrUpdateSample.ts][digitaltwinsendpointcreateorupdatesample] | Create or update DigitalTwinsInstance endpoint. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointPut_example.json | +| [digitalTwinsEndpointDeleteSample.ts][digitaltwinsendpointdeletesample] | Delete a DigitalTwinsInstance endpoint. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointDelete_example.json | +| [digitalTwinsEndpointGetSample.ts][digitaltwinsendpointgetsample] | Get DigitalTwinsInstances Endpoint. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointGet_example.json | +| [digitalTwinsEndpointListSample.ts][digitaltwinsendpointlistsample] | Get DigitalTwinsInstance Endpoints. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointsGet_example.json | +| [digitalTwinsGetSample.ts][digitaltwinsgetsample] | Get DigitalTwinsInstances resource. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsGet_example.json | +| [digitalTwinsListByResourceGroupSample.ts][digitaltwinslistbyresourcegroupsample] | Get all the DigitalTwinsInstances in a resource group. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsListByResourceGroup_example.json | +| [digitalTwinsListSample.ts][digitaltwinslistsample] | Get all the DigitalTwinsInstances in a subscription. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsList_example.json | +| [digitalTwinsUpdateSample.ts][digitaltwinsupdatesample] | Update metadata of DigitalTwinsInstance. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPatch_example.json | +| [operationsListSample.ts][operationslistsample] | Lists all of the available DigitalTwins service REST API operations. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsOperationsList_example.json | +| [privateEndpointConnectionsCreateOrUpdateSample.ts][privateendpointconnectionscreateorupdatesample] | Update the status of a private endpoint connection with the given name. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionPut_example.json | +| [privateEndpointConnectionsDeleteSample.ts][privateendpointconnectionsdeletesample] | Delete private endpoint connection with the specified name. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionDelete_example.json | +| [privateEndpointConnectionsGetSample.ts][privateendpointconnectionsgetsample] | Get private endpoint connection properties for the given private endpoint. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionByConnectionName_example.json | +| [privateEndpointConnectionsListSample.ts][privateendpointconnectionslistsample] | List private endpoint connection properties. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionsList_example.json | +| [privateLinkResourcesGetSample.ts][privatelinkresourcesgetsample] | Get the specified private link resource for the given Digital Twin. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateLinkResourcesByGroupId_example.json | +| [privateLinkResourcesListSample.ts][privatelinkresourceslistsample] | List private link resources for given Digital Twin. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateLinkResourcesList_example.json | +| [timeSeriesDatabaseConnectionsCreateOrUpdateSample.ts][timeseriesdatabaseconnectionscreateorupdatesample] | Create or update a time series database connection. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsPut_example.json | +| [timeSeriesDatabaseConnectionsDeleteSample.ts][timeseriesdatabaseconnectionsdeletesample] | Delete a time series database connection. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsDelete_example.json | +| [timeSeriesDatabaseConnectionsGetSample.ts][timeseriesdatabaseconnectionsgetsample] | Get the description of an existing time series database connection. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsGet_example.json | +| [timeSeriesDatabaseConnectionsListSample.ts][timeseriesdatabaseconnectionslistsample] | Get all existing time series database connections for this DigitalTwins instance. x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsList_example.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/digitalTwinsCheckNameAvailabilitySample.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 cross-env node dist/digitalTwinsCheckNameAvailabilitySample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[digitaltwinschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsCheckNameAvailabilitySample.ts +[digitaltwinscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsCreateOrUpdateSample.ts +[digitaltwinsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsDeleteSample.ts +[digitaltwinsendpointcreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointCreateOrUpdateSample.ts +[digitaltwinsendpointdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointDeleteSample.ts +[digitaltwinsendpointgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointGetSample.ts +[digitaltwinsendpointlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointListSample.ts +[digitaltwinsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsGetSample.ts +[digitaltwinslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsListByResourceGroupSample.ts +[digitaltwinslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsListSample.ts +[digitaltwinsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsUpdateSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/operationsListSample.ts +[privateendpointconnectionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateOrUpdateSample.ts +[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts +[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts +[privateendpointconnectionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsListSample.ts +[privatelinkresourcesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateLinkResourcesGetSample.ts +[privatelinkresourceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateLinkResourcesListSample.ts +[timeseriesdatabaseconnectionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsCreateOrUpdateSample.ts +[timeseriesdatabaseconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsDeleteSample.ts +[timeseriesdatabaseconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsGetSample.ts +[timeseriesdatabaseconnectionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsListSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-digitaltwins?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/digitaltwins/arm-digitaltwins/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/package.json b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/package.json new file mode 100644 index 000000000000..c38694ed3e6d --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "azure-arm-digitaltwins-samples-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/digitaltwins/arm-digitaltwins" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/digitaltwins/arm-digitaltwins", + "dependencies": { + "@azure/arm-digitaltwins": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/sample.env b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsCheckNameAvailabilitySample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..2ce6144cf6b9 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsCheckNameAvailabilitySample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + CheckNameRequest, + AzureDigitalTwinsManagementClient +} from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Check if a DigitalTwinsInstance name is available. + * + * @summary Check if a DigitalTwinsInstance name is available. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsCheckNameAvailability_example.json + */ +async function checkNameAvailability() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const location = "WestUS2"; + const digitalTwinsInstanceCheckName: CheckNameRequest = { + name: "myadtinstance", + type: "Microsoft.DigitalTwins/digitalTwinsInstances" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.checkNameAvailability( + location, + digitalTwinsInstanceCheckName + ); + console.log(result); +} + +checkNameAvailability().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsCreateOrUpdateSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ef3bbcfb1d3e --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsCreateOrUpdateSample.ts @@ -0,0 +1,101 @@ +/* + * 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 { + DigitalTwinsDescription, + AzureDigitalTwinsManagementClient +} from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * + * @summary Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPut_example.json + */ +async function putADigitalTwinsInstanceResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsCreate: DigitalTwinsDescription = { location: "WestUS2" }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsCreate + ); + console.log(result); +} + +putADigitalTwinsInstanceResource().catch(console.error); + +/** + * This sample demonstrates how to Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * + * @summary Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPut_WithIdentity_example.json + */ +async function putADigitalTwinsInstanceResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsCreate: DigitalTwinsDescription = { + identity: { type: "SystemAssigned" }, + location: "WestUS2" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsCreate + ); + console.log(result); +} + +putADigitalTwinsInstanceResourceWithIdentity().catch(console.error); + +/** + * This sample demonstrates how to Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * + * @summary Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPut_WithPublicNetworkAccess.json + */ +async function putADigitalTwinsInstanceResourceWithPublicNetworkAccessProperty() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsCreate: DigitalTwinsDescription = { + location: "WestUS2", + publicNetworkAccess: "Enabled" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsCreate + ); + console.log(result); +} + +putADigitalTwinsInstanceResourceWithPublicNetworkAccessProperty().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsDeleteSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsDeleteSample.ts new file mode 100644 index 000000000000..b5a1e484b5ab --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsDeleteSample.ts @@ -0,0 +1,60 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete a DigitalTwinsInstance. + * + * @summary Delete a DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsDelete_example.json + */ +async function deleteADigitalTwinsInstanceResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginDeleteAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +deleteADigitalTwinsInstanceResource().catch(console.error); + +/** + * This sample demonstrates how to Delete a DigitalTwinsInstance. + * + * @summary Delete a DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsDelete_WithIdentity_example.json + */ +async function deleteADigitalTwinsInstanceResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginDeleteAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +deleteADigitalTwinsInstanceResourceWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointCreateOrUpdateSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointCreateOrUpdateSample.ts new file mode 100644 index 000000000000..cc63c11efc1e --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointCreateOrUpdateSample.ts @@ -0,0 +1,87 @@ +/* + * 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 { + DigitalTwinsEndpointResource, + AzureDigitalTwinsManagementClient +} from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update DigitalTwinsInstance endpoint. + * + * @summary Create or update DigitalTwinsInstance endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointPut_example.json + */ +async function putADigitalTwinsEndpointResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myServiceBus"; + const endpointDescription: DigitalTwinsEndpointResource = { + properties: { + authenticationType: "KeyBased", + endpointType: "ServiceBus", + primaryConnectionString: + "Endpoint=sb://mysb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xyzxyzoX4=;EntityPath=abcabc", + secondaryConnectionString: + "Endpoint=sb://mysb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xyzxyzoX4=;EntityPath=abcabc" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwinsEndpoint.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + endpointName, + endpointDescription + ); + console.log(result); +} + +putADigitalTwinsEndpointResource().catch(console.error); + +/** + * This sample demonstrates how to Create or update DigitalTwinsInstance endpoint. + * + * @summary Create or update DigitalTwinsInstance endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointPut_WithIdentity_example.json + */ +async function putADigitalTwinsEndpointResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myServiceBus"; + const endpointDescription: DigitalTwinsEndpointResource = { + properties: { + authenticationType: "IdentityBased", + endpointType: "ServiceBus", + endpointUri: "sb://mysb.servicebus.windows.net/", + entityPath: "mysbtopic" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwinsEndpoint.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + endpointName, + endpointDescription + ); + console.log(result); +} + +putADigitalTwinsEndpointResourceWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointDeleteSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointDeleteSample.ts new file mode 100644 index 000000000000..8ff3640b4085 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointDeleteSample.ts @@ -0,0 +1,64 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete a DigitalTwinsInstance endpoint. + * + * @summary Delete a DigitalTwinsInstance endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointDelete_example.json + */ +async function deleteADigitalTwinsInstanceEndpoint() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myendpoint"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwinsEndpoint.beginDeleteAndWait( + resourceGroupName, + resourceName, + endpointName + ); + console.log(result); +} + +deleteADigitalTwinsInstanceEndpoint().catch(console.error); + +/** + * This sample demonstrates how to Delete a DigitalTwinsInstance endpoint. + * + * @summary Delete a DigitalTwinsInstance endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointDelete_WithIdentity_example.json + */ +async function deleteADigitalTwinsInstanceEndpointWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myendpoint"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwinsEndpoint.beginDeleteAndWait( + resourceGroupName, + resourceName, + endpointName + ); + console.log(result); +} + +deleteADigitalTwinsInstanceEndpointWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointGetSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointGetSample.ts new file mode 100644 index 000000000000..3e71d8f47ac3 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointGetSample.ts @@ -0,0 +1,64 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get DigitalTwinsInstances Endpoint. + * + * @summary Get DigitalTwinsInstances Endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointGet_example.json + */ +async function getADigitalTwinsInstanceEndpoint() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myServiceBus"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwinsEndpoint.get( + resourceGroupName, + resourceName, + endpointName + ); + console.log(result); +} + +getADigitalTwinsInstanceEndpoint().catch(console.error); + +/** + * This sample demonstrates how to Get DigitalTwinsInstances Endpoint. + * + * @summary Get DigitalTwinsInstances Endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointGet_WithIdentity_example.json + */ +async function getADigitalTwinsInstanceEndpointWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const endpointName = "myServiceBus"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwinsEndpoint.get( + resourceGroupName, + resourceName, + endpointName + ); + console.log(result); +} + +getADigitalTwinsInstanceEndpointWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointListSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointListSample.ts new file mode 100644 index 000000000000..b90b153e5f6e --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsEndpointListSample.ts @@ -0,0 +1,66 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get DigitalTwinsInstance Endpoints. + * + * @summary Get DigitalTwinsInstance Endpoints. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointsGet_example.json + */ +async function getADigitalTwinsInstanceEndpoints() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.digitalTwinsEndpoint.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +getADigitalTwinsInstanceEndpoints().catch(console.error); + +/** + * This sample demonstrates how to Get DigitalTwinsInstance Endpoints. + * + * @summary Get DigitalTwinsInstance Endpoints. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsEndpointsGet_WithIdentity_example.json + */ +async function getADigitalTwinsInstanceEndpointsWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.digitalTwinsEndpoint.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +getADigitalTwinsInstanceEndpointsWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsGetSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsGetSample.ts new file mode 100644 index 000000000000..8efb0602720c --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsGetSample.ts @@ -0,0 +1,77 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get DigitalTwinsInstances resource. + * + * @summary Get DigitalTwinsInstances resource. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsGet_example.json + */ +async function getADigitalTwinsInstanceResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.get(resourceGroupName, resourceName); + console.log(result); +} + +getADigitalTwinsInstanceResource().catch(console.error); + +/** + * This sample demonstrates how to Get DigitalTwinsInstances resource. + * + * @summary Get DigitalTwinsInstances resource. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsGet_WithPrivateEndpointConnection_example.json + */ +async function getADigitalTwinsInstanceResourceWithAPrivateEndpointConnection() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.get(resourceGroupName, resourceName); + console.log(result); +} + +getADigitalTwinsInstanceResourceWithAPrivateEndpointConnection().catch( + console.error +); + +/** + * This sample demonstrates how to Get DigitalTwinsInstances resource. + * + * @summary Get DigitalTwinsInstances resource. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsGet_WithIdentity_example.json + */ +async function getADigitalTwinsInstanceResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.get(resourceGroupName, resourceName); + console.log(result); +} + +getADigitalTwinsInstanceResourceWithIdentity().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsListByResourceGroupSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsListByResourceGroupSample.ts new file mode 100644 index 000000000000..7c31fc561d4a --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsListByResourceGroupSample.ts @@ -0,0 +1,37 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get all the DigitalTwinsInstances in a resource group. + * + * @summary Get all the DigitalTwinsInstances in a resource group. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsListByResourceGroup_example.json + */ +async function getDigitalTwinsInstanceResourcesByResourceGroup() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.digitalTwins.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +getDigitalTwinsInstanceResourcesByResourceGroup().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsListSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsListSample.ts new file mode 100644 index 000000000000..74d809274b5f --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsListSample.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get all the DigitalTwinsInstances in a subscription. + * + * @summary Get all the DigitalTwinsInstances in a subscription. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsList_example.json + */ +async function getDigitalTwinsInstanceResourcesBySubscription() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.digitalTwins.list()) { + resArray.push(item); + } + console.log(resArray); +} + +getDigitalTwinsInstanceResourcesBySubscription().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsUpdateSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsUpdateSample.ts new file mode 100644 index 000000000000..ea53963d9efa --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/digitalTwinsUpdateSample.ts @@ -0,0 +1,101 @@ +/* + * 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 { + DigitalTwinsPatchDescription, + AzureDigitalTwinsManagementClient +} from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update metadata of DigitalTwinsInstance. + * + * @summary Update metadata of DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPatch_example.json + */ +async function patchADigitalTwinsInstanceResource() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsPatchDescription: DigitalTwinsPatchDescription = { + tags: { purpose: "dev" } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsPatchDescription + ); + console.log(result); +} + +patchADigitalTwinsInstanceResource().catch(console.error); + +/** + * This sample demonstrates how to Update metadata of DigitalTwinsInstance. + * + * @summary Update metadata of DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPatch_WithIdentity_example.json + */ +async function patchADigitalTwinsInstanceResourceWithIdentity() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsPatchDescription: DigitalTwinsPatchDescription = { + identity: { type: "None" } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsPatchDescription + ); + console.log(result); +} + +patchADigitalTwinsInstanceResourceWithIdentity().catch(console.error); + +/** + * This sample demonstrates how to Update metadata of DigitalTwinsInstance. + * + * @summary Update metadata of DigitalTwinsInstance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsPatch_WithPublicNetworkAccess.json + */ +async function patchADigitalTwinsInstanceResourceWithPublicNetworkAccessProperty() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const digitalTwinsPatchDescription: DigitalTwinsPatchDescription = { + properties: { publicNetworkAccess: "Disabled" } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.digitalTwins.beginUpdateAndWait( + resourceGroupName, + resourceName, + digitalTwinsPatchDescription + ); + console.log(result); +} + +patchADigitalTwinsInstanceResourceWithPublicNetworkAccessProperty().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..49b1f158a27f --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/operationsListSample.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Lists all of the available DigitalTwins service REST API operations. + * + * @summary Lists all of the available DigitalTwins service REST API operations. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/DigitalTwinsOperationsList_example.json + */ +async function getAvailableOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +getAvailableOperations().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateOrUpdateSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..3863682e6e8c --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsCreateOrUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { + PrivateEndpointConnection, + AzureDigitalTwinsManagementClient +} from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update the status of a private endpoint connection with the given name. + * + * @summary Update the status of a private endpoint connection with the given name. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionPut_example.json + */ +async function updateTheStatusOfAPrivateEndpointConnectionWithTheGivenName() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const privateEndpointConnectionName = "myPrivateConnection"; + const privateEndpointConnection: PrivateEndpointConnection = { + properties: { + privateLinkServiceConnectionState: { + description: "Approved by johndoe@company.com.", + status: "Approved" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.privateEndpointConnections.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName, + privateEndpointConnection + ); + console.log(result); +} + +updateTheStatusOfAPrivateEndpointConnectionWithTheGivenName().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts new file mode 100644 index 000000000000..8af9de6d22a1 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsDeleteSample.ts @@ -0,0 +1,38 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete private endpoint connection with the specified name. + * + * @summary Delete private endpoint connection with the specified name. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionDelete_example.json + */ +async function deletePrivateEndpointConnectionWithTheSpecifiedName() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const privateEndpointConnectionName = "myPrivateConnection"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.privateEndpointConnections.beginDeleteAndWait( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +deletePrivateEndpointConnectionWithTheSpecifiedName().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts new file mode 100644 index 000000000000..472e1b30c1ec --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsGetSample.ts @@ -0,0 +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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get private endpoint connection properties for the given private endpoint. + * + * @summary Get private endpoint connection properties for the given private endpoint. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionByConnectionName_example.json + */ +async function getPrivateEndpointConnectionPropertiesForTheGivenPrivateEndpoint() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const privateEndpointConnectionName = "myPrivateConnection"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + resourceName, + privateEndpointConnectionName + ); + console.log(result); +} + +getPrivateEndpointConnectionPropertiesForTheGivenPrivateEndpoint().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsListSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsListSample.ts new file mode 100644 index 000000000000..19b4e4a9410e --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateEndpointConnectionsListSample.ts @@ -0,0 +1,36 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List private endpoint connection properties. + * + * @summary List private endpoint connection properties. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateEndpointConnectionsList_example.json + */ +async function listPrivateEndpointConnectionProperties() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.privateEndpointConnections.list( + resourceGroupName, + resourceName + ); + console.log(result); +} + +listPrivateEndpointConnectionProperties().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateLinkResourcesGetSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateLinkResourcesGetSample.ts new file mode 100644 index 000000000000..2a26c1a3d724 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateLinkResourcesGetSample.ts @@ -0,0 +1,38 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the specified private link resource for the given Digital Twin. + * + * @summary Get the specified private link resource for the given Digital Twin. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateLinkResourcesByGroupId_example.json + */ +async function getTheSpecifiedPrivateLinkResourceForTheGivenDigitalTwin() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const resourceId = "subResource"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.privateLinkResources.get( + resourceGroupName, + resourceName, + resourceId + ); + console.log(result); +} + +getTheSpecifiedPrivateLinkResourceForTheGivenDigitalTwin().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateLinkResourcesListSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateLinkResourcesListSample.ts new file mode 100644 index 000000000000..29fcefb69c8b --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/privateLinkResourcesListSample.ts @@ -0,0 +1,36 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List private link resources for given Digital Twin. + * + * @summary List private link resources for given Digital Twin. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/PrivateLinkResourcesList_example.json + */ +async function listPrivateLinkResourcesForGivenDigitalTwin() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.privateLinkResources.list( + resourceGroupName, + resourceName + ); + console.log(result); +} + +listPrivateLinkResourcesForGivenDigitalTwin().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsCreateOrUpdateSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..459fb9556b02 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsCreateOrUpdateSample.ts @@ -0,0 +1,58 @@ +/* + * 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 { + TimeSeriesDatabaseConnection, + AzureDigitalTwinsManagementClient +} from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or update a time series database connection. + * + * @summary Create or update a time series database connection. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsPut_example.json + */ +async function createOrReplaceATimeSeriesDatabaseConnectionForADigitalTwinsInstance() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const timeSeriesDatabaseConnectionName = "myConnection"; + const timeSeriesDatabaseConnectionDescription: TimeSeriesDatabaseConnection = { + properties: { + adxDatabaseName: "myDatabase", + adxEndpointUri: "https://mycluster.kusto.windows.net", + adxResourceId: + "/subscriptions/c493073e-2460-45ba-a403-f3e0df1e9feg/resourceGroups/testrg/providers/Microsoft.Kusto/clusters/mycluster", + adxTableName: "myTable", + connectionType: "AzureDataExplorer", + eventHubEndpointUri: "sb://myeh.servicebus.windows.net/", + eventHubEntityPath: "myeh", + eventHubNamespaceResourceId: + "/subscriptions/c493073e-2460-45ba-a403-f3e0df1e9feg/resourceGroups/testrg/providers/Microsoft.EventHub/namespaces/myeh" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.timeSeriesDatabaseConnections.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName, + timeSeriesDatabaseConnectionDescription + ); + console.log(result); +} + +createOrReplaceATimeSeriesDatabaseConnectionForADigitalTwinsInstance().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsDeleteSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsDeleteSample.ts new file mode 100644 index 000000000000..7e5f84191724 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsDeleteSample.ts @@ -0,0 +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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete a time series database connection. + * + * @summary Delete a time series database connection. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsDelete_example.json + */ +async function deleteATimeSeriesDatabaseConnectionForADigitalTwinsInstance() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const timeSeriesDatabaseConnectionName = "myConnection"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.timeSeriesDatabaseConnections.beginDeleteAndWait( + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName + ); + console.log(result); +} + +deleteATimeSeriesDatabaseConnectionForADigitalTwinsInstance().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsGetSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsGetSample.ts new file mode 100644 index 000000000000..6d3b8538ad65 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsGetSample.ts @@ -0,0 +1,38 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get the description of an existing time series database connection. + * + * @summary Get the description of an existing time series database connection. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsGet_example.json + */ +async function getTimeSeriesDatabaseConnectionForADigitalTwinsInstance() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const timeSeriesDatabaseConnectionName = "myConnection"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const result = await client.timeSeriesDatabaseConnections.get( + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName + ); + console.log(result); +} + +getTimeSeriesDatabaseConnectionForADigitalTwinsInstance().catch(console.error); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsListSample.ts b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsListSample.ts new file mode 100644 index 000000000000..45771366c0b0 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/src/timeSeriesDatabaseConnectionsListSample.ts @@ -0,0 +1,41 @@ +/* + * 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 { AzureDigitalTwinsManagementClient } from "@azure/arm-digitaltwins"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get all existing time series database connections for this DigitalTwins instance. + * + * @summary Get all existing time series database connections for this DigitalTwins instance. + * x-ms-original-file: specification/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2021-06-30-preview/examples/TimeSeriesDatabaseConnectionsList_example.json + */ +async function listTimeSeriesDatabaseConnectionsForADigitalTwinsInstance() { + const subscriptionId = "50016170-c839-41ba-a724-51e9df440b9e"; + const resourceGroupName = "resRg"; + const resourceName = "myDigitalTwinsService"; + const credential = new DefaultAzureCredential(); + const client = new AzureDigitalTwinsManagementClient( + credential, + subscriptionId + ); + const resArray = new Array(); + for await (let item of client.timeSeriesDatabaseConnections.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listTimeSeriesDatabaseConnectionsForADigitalTwinsInstance().catch( + console.error +); diff --git a/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/tsconfig.json b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..416c2dd82e00 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/samples/v1-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/digitaltwins/arm-digitaltwins/src/azureDigitalTwinsManagementClient.ts b/sdk/digitaltwins/arm-digitaltwins/src/azureDigitalTwinsManagementClient.ts index 5ea1ccd6bb1b..9d3b0a0d8922 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/azureDigitalTwinsManagementClient.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/azureDigitalTwinsManagementClient.ts @@ -13,14 +13,16 @@ import { DigitalTwinsEndpointImpl, OperationsImpl, PrivateLinkResourcesImpl, - PrivateEndpointConnectionsImpl + PrivateEndpointConnectionsImpl, + TimeSeriesDatabaseConnectionsImpl } from "./operations"; import { DigitalTwins, DigitalTwinsEndpoint, Operations, PrivateLinkResources, - PrivateEndpointConnections + PrivateEndpointConnections, + TimeSeriesDatabaseConnections } from "./operationsInterfaces"; import { AzureDigitalTwinsManagementClientOptionalParams } from "./models"; @@ -56,7 +58,7 @@ export class AzureDigitalTwinsManagementClient extends coreClient.ServiceClient credential: credentials }; - const packageDetails = `azsdk-js-arm-digitaltwins/3.0.0`; + const packageDetails = `azsdk-js-arm-digitaltwins/3.1.0-beta.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -79,12 +81,15 @@ export class AzureDigitalTwinsManagementClient extends coreClient.ServiceClient // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2020-12-01"; + this.apiVersion = options.apiVersion || "2021-06-30-preview"; this.digitalTwins = new DigitalTwinsImpl(this); this.digitalTwinsEndpoint = new DigitalTwinsEndpointImpl(this); this.operations = new OperationsImpl(this); this.privateLinkResources = new PrivateLinkResourcesImpl(this); this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this); + this.timeSeriesDatabaseConnections = new TimeSeriesDatabaseConnectionsImpl( + this + ); } digitalTwins: DigitalTwins; @@ -92,4 +97,5 @@ export class AzureDigitalTwinsManagementClient extends coreClient.ServiceClient operations: Operations; privateLinkResources: PrivateLinkResources; privateEndpointConnections: PrivateEndpointConnections; + timeSeriesDatabaseConnections: TimeSeriesDatabaseConnections; } diff --git a/sdk/digitaltwins/arm-digitaltwins/src/models/index.ts b/sdk/digitaltwins/arm-digitaltwins/src/models/index.ts index 5b24b4e7d3c2..e9ae5b36d9c3 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/models/index.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/models/index.ts @@ -13,6 +13,9 @@ export type DigitalTwinsEndpointResourcePropertiesUnion = | ServiceBus | EventHub | EventGrid; +export type TimeSeriesDatabaseConnectionPropertiesUnion = + | TimeSeriesDatabaseConnectionProperties + | AzureDataExplorerConnectionProperties; /** The private endpoint connection of a Digital Twin. */ export interface PrivateEndpointConnection { @@ -31,7 +34,13 @@ export interface PrivateEndpointConnection { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; - properties: PrivateEndpointConnectionProperties; + /** The connection properties. */ + properties: ConnectionProperties; + /** + * Metadata pertaining to creation and last modification of the private endpoint connection. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; } /** The properties of a private endpoint connection. */ @@ -41,9 +50,11 @@ export interface ConnectionProperties { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly provisioningState?: ConnectionPropertiesProvisioningState; - privateEndpoint?: ConnectionPropertiesPrivateEndpoint; + /** The private endpoint. */ + privateEndpoint?: PrivateEndpoint; /** The list of group ids for the private endpoint connection. */ groupIds?: string[]; + /** The connection state. */ privateLinkServiceConnectionState?: ConnectionPropertiesPrivateLinkServiceConnectionState; } @@ -66,6 +77,22 @@ export interface ConnectionState { actionsRequired?: string; } +/** 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 common properties of a DigitalTwinsInstance. */ export interface DigitalTwinsResource { /** @@ -89,6 +116,11 @@ export interface DigitalTwinsResource { tags?: { [propertyName: string]: string }; /** The managed identity for the DigitalTwinsInstance. */ identity?: DigitalTwinsIdentity; + /** + * Metadata pertaining to creation and last modification of the DigitalTwinsInstance. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; } /** The managed identity for the DigitalTwinsInstance. */ @@ -170,7 +202,7 @@ export interface DigitalTwinsEndpointResourceProperties { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly createdTime?: Date; - /** Specifies the authentication type being used for connecting to the endpoint. */ + /** Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be specified (at least the primary connection string). If 'IdentityBased' is select, the endpointUri and entityPath properties must be specified. */ authenticationType?: AuthenticationType; /** Dead letter storage secret for key-based authentication. Will be obfuscated during read. */ deadLetterSecret?: string; @@ -195,6 +227,11 @@ export interface ExternalResource { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; } /** A list of DigitalTwins description objects with a next link. */ @@ -235,27 +272,32 @@ export interface Operation { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly isDataAction?: boolean; + /** + * Operation properties. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly properties?: { [propertyName: string]: Record }; } /** The object that represents the operation. */ export interface OperationDisplay { /** - * Service provider: Microsoft DigitalTwins + * Service provider: Microsoft DigitalTwins. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly provider?: string; /** - * Resource Type: DigitalTwinsInstances + * Resource Type: DigitalTwinsInstances. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly resource?: string; /** - * Name of the operation + * Name of the operation. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly operation?: string; /** - * Friendly description for the operation, + * Friendly description for the operation. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly description?: string; @@ -287,6 +329,7 @@ export interface GroupIdInformationResponse { /** The group information for creating a private endpoint on Digital Twin. */ export interface GroupIdInformation { + /** The group information properties. */ properties: GroupIdInformationProperties; /** The resource identifier. */ id?: string; @@ -303,8 +346,8 @@ export interface GroupIdInformation { } /** The properties for a group information object. */ -export interface GroupIdInformationPropertiesAutoGenerated { - /** The group id */ +export interface GroupIdInformationProperties { + /** The group id. */ groupId?: string; /** The required members for a specific group id. */ requiredMembers?: string[]; @@ -318,10 +361,26 @@ export interface PrivateEndpointConnectionsResponse { value?: PrivateEndpointConnection[]; } -export type PrivateEndpointConnectionProperties = ConnectionProperties & {}; +/** A pageable list of time series database connection resources. */ +export interface TimeSeriesDatabaseConnectionListResult { + /** The link used to get the next page of results. */ + nextLink?: string; + /** A list of time series database connection resources. */ + value?: TimeSeriesDatabaseConnection[]; +} -export type ConnectionPropertiesPrivateEndpoint = PrivateEndpoint & {}; +/** Properties of a time series database connection resource. */ +export interface TimeSeriesDatabaseConnectionProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + connectionType: "AzureDataExplorer"; + /** + * The provisioning state. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: TimeSeriesDatabaseConnectionState; +} +/** The connection state. */ export type ConnectionPropertiesPrivateLinkServiceConnectionState = ConnectionState & {}; /** The description of the DigitalTwins service. */ @@ -346,6 +405,7 @@ export type DigitalTwinsDescription = DigitalTwinsResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly hostName?: string; + /** The private endpoint connections. */ privateEndpointConnections?: PrivateEndpointConnection[]; /** Public network access for the DigitalTwinsInstance. */ publicNetworkAccess?: PublicNetworkAccess; @@ -359,9 +419,9 @@ export type ServiceBus = DigitalTwinsEndpointResourceProperties & { primaryConnectionString?: string; /** SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. */ secondaryConnectionString?: string; - /** The URL of the ServiceBus namespace for identity-based authentication. It must include the protocol sb:// */ + /** The URL of the ServiceBus namespace for identity-based authentication. It must include the protocol 'sb://'. */ endpointUri?: string; - /** The ServiceBus Topic name for identity-based authentication */ + /** The ServiceBus Topic name for identity-based authentication. */ entityPath?: string; }; @@ -373,7 +433,7 @@ export type EventHub = DigitalTwinsEndpointResourceProperties & { connectionStringPrimaryKey?: string; /** SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. */ connectionStringSecondaryKey?: string; - /** The URL of the EventHub namespace for identity-based authentication. It must include the protocol sb:// */ + /** The URL of the EventHub namespace for identity-based authentication. It must include the protocol 'sb://'. */ endpointUri?: string; /** The EventHub name in the EventHub namespace for identity-based authentication. */ entityPath?: string; @@ -383,7 +443,7 @@ export type EventHub = DigitalTwinsEndpointResourceProperties & { export type EventGrid = DigitalTwinsEndpointResourceProperties & { /** Polymorphic discriminator, which specifies the different types this object can be */ endpointType: "EventGrid"; - /** EventGrid Topic Endpoint */ + /** EventGrid Topic Endpoint. */ topicEndpoint: string; /** EventGrid secondary accesskey. Will be obfuscated during read. */ accessKey1: string | null; @@ -397,7 +457,33 @@ export type DigitalTwinsEndpointResource = ExternalResource & { properties: DigitalTwinsEndpointResourcePropertiesUnion; }; -export type GroupIdInformationProperties = GroupIdInformationPropertiesAutoGenerated & {}; +/** Describes a time series database connection resource. */ +export type TimeSeriesDatabaseConnection = ExternalResource & { + /** Properties of a specific time series database connection. */ + properties?: TimeSeriesDatabaseConnectionPropertiesUnion; +}; + +/** Properties of a time series database connection to Azure Data Explorer with data being sent via an EventHub. */ +export type AzureDataExplorerConnectionProperties = TimeSeriesDatabaseConnectionProperties & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + connectionType: "AzureDataExplorer"; + /** The resource ID of the Azure Data Explorer cluster. */ + adxResourceId: string; + /** The URI of the Azure Data Explorer endpoint. */ + adxEndpointUri: string; + /** The name of the Azure Data Explorer database. */ + adxDatabaseName: string; + /** The name of the Azure Data Explorer table. */ + adxTableName?: string; + /** The URL of the EventHub namespace for identity-based authentication. It must include the protocol sb:// */ + eventHubEndpointUri: string; + /** The EventHub name in the EventHub namespace for identity-based authentication. */ + eventHubEntityPath: string; + /** The resource ID of the EventHub namespace. */ + eventHubNamespaceResourceId: string; + /** The EventHub consumer group to use when ADX reads from EventHub. Defaults to $Default. */ + eventHubConsumerGroup?: string; +}; /** Known values of {@link ProvisioningState} that the service accepts. */ export enum KnownProvisioningState { @@ -473,6 +559,26 @@ export enum KnownPrivateLinkServiceConnectionStatus { */ export type PrivateLinkServiceConnectionStatus = string; +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + 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 PublicNetworkAccess} that the service accepts. */ export enum KnownPublicNetworkAccess { Enabled = "Enabled", @@ -589,6 +695,54 @@ export enum KnownReason { */ export type Reason = string; +/** Known values of {@link ConnectionType} that the service accepts. */ +export enum KnownConnectionType { + AzureDataExplorer = "AzureDataExplorer" +} + +/** + * Defines values for ConnectionType. \ + * {@link KnownConnectionType} can be used interchangeably with ConnectionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AzureDataExplorer** + */ +export type ConnectionType = string; + +/** Known values of {@link TimeSeriesDatabaseConnectionState} that the service accepts. */ +export enum KnownTimeSeriesDatabaseConnectionState { + Provisioning = "Provisioning", + Deleting = "Deleting", + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", + Deleted = "Deleted", + Warning = "Warning", + Suspending = "Suspending", + Restoring = "Restoring", + Moving = "Moving", + Disabled = "Disabled" +} + +/** + * Defines values for TimeSeriesDatabaseConnectionState. \ + * {@link KnownTimeSeriesDatabaseConnectionState} can be used interchangeably with TimeSeriesDatabaseConnectionState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Provisioning** \ + * **Deleting** \ + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Deleted** \ + * **Warning** \ + * **Suspending** \ + * **Restoring** \ + * **Moving** \ + * **Disabled** + */ +export type TimeSeriesDatabaseConnectionState = string; + /** Optional parameters. */ export interface DigitalTwinsGetOptionalParams extends coreClient.OperationOptions {} @@ -775,6 +929,51 @@ export interface PrivateEndpointConnectionsCreateOrUpdateOptionalParams /** Contains response data for the createOrUpdate operation. */ export type PrivateEndpointConnectionsCreateOrUpdateResponse = PrivateEndpointConnection; +/** Optional parameters. */ +export interface TimeSeriesDatabaseConnectionsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type TimeSeriesDatabaseConnectionsListResponse = TimeSeriesDatabaseConnectionListResult; + +/** Optional parameters. */ +export interface TimeSeriesDatabaseConnectionsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type TimeSeriesDatabaseConnectionsGetResponse = TimeSeriesDatabaseConnection; + +/** Optional parameters. */ +export interface TimeSeriesDatabaseConnectionsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type TimeSeriesDatabaseConnectionsCreateOrUpdateResponse = TimeSeriesDatabaseConnection; + +/** Optional parameters. */ +export interface TimeSeriesDatabaseConnectionsDeleteOptionalParams + 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 TimeSeriesDatabaseConnectionsDeleteResponse = TimeSeriesDatabaseConnection; + +/** Optional parameters. */ +export interface TimeSeriesDatabaseConnectionsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type TimeSeriesDatabaseConnectionsListNextResponse = TimeSeriesDatabaseConnectionListResult; + /** Optional parameters. */ export interface AzureDigitalTwinsManagementClientOptionalParams extends coreClient.ServiceClientOptions { diff --git a/sdk/digitaltwins/arm-digitaltwins/src/models/mappers.ts b/sdk/digitaltwins/arm-digitaltwins/src/models/mappers.ts index b54dec313f00..9b067f959d5d 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/models/mappers.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/models/mappers.ts @@ -41,7 +41,14 @@ export const PrivateEndpointConnection: coreClient.CompositeMapper = { serializedName: "properties", type: { name: "Composite", - className: "PrivateEndpointConnectionProperties" + className: "ConnectionProperties" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" } } } @@ -65,7 +72,7 @@ export const ConnectionProperties: coreClient.CompositeMapper = { serializedName: "privateEndpoint", type: { name: "Composite", - className: "ConnectionPropertiesPrivateEndpoint" + className: "PrivateEndpoint" } }, groupIds: { @@ -135,6 +142,57 @@ export const ConnectionState: coreClient.CompositeMapper = { } }; +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + nullable: true, + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + nullable: true, + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + nullable: true, + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + nullable: true, + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + nullable: true, + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + nullable: true, + type: { + name: "DateTime" + } + } + } + } +}; + export const DigitalTwinsResource: coreClient.CompositeMapper = { type: { name: "Composite", @@ -185,6 +243,13 @@ export const DigitalTwinsResource: coreClient.CompositeMapper = { name: "Composite", className: "DigitalTwinsIdentity" } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } } } } @@ -312,6 +377,7 @@ export const DigitalTwinsPatchProperties: coreClient.CompositeMapper = { modelProperties: { publicNetworkAccess: { serializedName: "publicNetworkAccess", + nullable: true, type: { name: "String" } @@ -433,6 +499,13 @@ export const ExternalResource: coreClient.CompositeMapper = { type: { name: "String" } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } } } } @@ -528,6 +601,17 @@ export const Operation: coreClient.CompositeMapper = { type: { name: "Boolean" } + }, + properties: { + serializedName: "properties", + readOnly: true, + nullable: true, + type: { + name: "Dictionary", + value: { + type: { name: "Dictionary", value: { type: { name: "any" } } } + } + } } } } @@ -683,10 +767,10 @@ export const GroupIdInformation: coreClient.CompositeMapper = { } }; -export const GroupIdInformationPropertiesAutoGenerated: coreClient.CompositeMapper = { +export const GroupIdInformationProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "GroupIdInformationPropertiesAutoGenerated", + className: "GroupIdInformationProperties", modelProperties: { groupId: { serializedName: "groupId", @@ -741,22 +825,58 @@ export const PrivateEndpointConnectionsResponse: coreClient.CompositeMapper = { } }; -export const PrivateEndpointConnectionProperties: coreClient.CompositeMapper = { +export const TimeSeriesDatabaseConnectionListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "PrivateEndpointConnectionProperties", + className: "TimeSeriesDatabaseConnectionListResult", modelProperties: { - ...ConnectionProperties.type.modelProperties + nextLink: { + serializedName: "nextLink", + nullable: true, + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TimeSeriesDatabaseConnection" + } + } + } + } } } }; -export const ConnectionPropertiesPrivateEndpoint: coreClient.CompositeMapper = { +export const TimeSeriesDatabaseConnectionProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ConnectionPropertiesPrivateEndpoint", + className: "TimeSeriesDatabaseConnectionProperties", + uberParent: "TimeSeriesDatabaseConnectionProperties", + polymorphicDiscriminator: { + serializedName: "connectionType", + clientName: "connectionType" + }, modelProperties: { - ...PrivateEndpoint.type.modelProperties + connectionType: { + serializedName: "connectionType", + required: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + } } } }; @@ -808,6 +928,7 @@ export const DigitalTwinsDescription: coreClient.CompositeMapper = { }, privateEndpointConnections: { serializedName: "properties.privateEndpointConnections", + nullable: true, type: { name: "Sequence", element: { @@ -820,6 +941,7 @@ export const DigitalTwinsDescription: coreClient.CompositeMapper = { }, publicNetworkAccess: { serializedName: "properties.publicNetworkAccess", + nullable: true, type: { name: "String" } @@ -965,19 +1087,98 @@ export const DigitalTwinsEndpointResource: coreClient.CompositeMapper = { } }; -export const GroupIdInformationProperties: coreClient.CompositeMapper = { +export const TimeSeriesDatabaseConnection: coreClient.CompositeMapper = { type: { name: "Composite", - className: "GroupIdInformationProperties", + className: "TimeSeriesDatabaseConnection", modelProperties: { - ...GroupIdInformationPropertiesAutoGenerated.type.modelProperties + ...ExternalResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "TimeSeriesDatabaseConnectionProperties" + } + } + } + } +}; + +export const AzureDataExplorerConnectionProperties: coreClient.CompositeMapper = { + serializedName: "AzureDataExplorer", + type: { + name: "Composite", + className: "AzureDataExplorerConnectionProperties", + uberParent: "TimeSeriesDatabaseConnectionProperties", + polymorphicDiscriminator: + TimeSeriesDatabaseConnectionProperties.type.polymorphicDiscriminator, + modelProperties: { + ...TimeSeriesDatabaseConnectionProperties.type.modelProperties, + adxResourceId: { + serializedName: "adxResourceId", + required: true, + type: { + name: "String" + } + }, + adxEndpointUri: { + serializedName: "adxEndpointUri", + required: true, + type: { + name: "String" + } + }, + adxDatabaseName: { + serializedName: "adxDatabaseName", + required: true, + type: { + name: "String" + } + }, + adxTableName: { + serializedName: "adxTableName", + nullable: true, + type: { + name: "String" + } + }, + eventHubEndpointUri: { + serializedName: "eventHubEndpointUri", + required: true, + type: { + name: "String" + } + }, + eventHubEntityPath: { + serializedName: "eventHubEntityPath", + required: true, + type: { + name: "String" + } + }, + eventHubNamespaceResourceId: { + serializedName: "eventHubNamespaceResourceId", + required: true, + type: { + name: "String" + } + }, + eventHubConsumerGroup: { + serializedName: "eventHubConsumerGroup", + nullable: true, + type: { + name: "String" + } + } } } }; export let discriminators = { DigitalTwinsEndpointResourceProperties: DigitalTwinsEndpointResourceProperties, + TimeSeriesDatabaseConnectionProperties: TimeSeriesDatabaseConnectionProperties, "DigitalTwinsEndpointResourceProperties.ServiceBus": ServiceBus, "DigitalTwinsEndpointResourceProperties.EventHub": EventHub, - "DigitalTwinsEndpointResourceProperties.EventGrid": EventGrid + "DigitalTwinsEndpointResourceProperties.EventGrid": EventGrid, + "TimeSeriesDatabaseConnectionProperties.AzureDataExplorer": AzureDataExplorerConnectionProperties }; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/models/parameters.ts b/sdk/digitaltwins/arm-digitaltwins/src/models/parameters.ts index e205ac1b1dd0..3bd51d67a54a 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/models/parameters.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/models/parameters.ts @@ -16,7 +16,8 @@ import { DigitalTwinsPatchDescription as DigitalTwinsPatchDescriptionMapper, CheckNameRequest as CheckNameRequestMapper, DigitalTwinsEndpointResource as DigitalTwinsEndpointResourceMapper, - PrivateEndpointConnection as PrivateEndpointConnectionMapper + PrivateEndpointConnection as PrivateEndpointConnectionMapper, + TimeSeriesDatabaseConnection as TimeSeriesDatabaseConnectionMapper } from "../models/mappers"; export const accept: OperationParameter = { @@ -46,7 +47,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2020-12-01", + defaultValue: "2021-06-30-preview", isConstant: true, serializedName: "api-version", type: { @@ -197,3 +198,24 @@ export const privateEndpointConnection: OperationParameter = { parameterPath: "privateEndpointConnection", mapper: PrivateEndpointConnectionMapper }; + +export const timeSeriesDatabaseConnectionName: OperationURLParameter = { + parameterPath: "timeSeriesDatabaseConnectionName", + mapper: { + constraints: { + Pattern: new RegExp("^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$"), + MaxLength: 49, + MinLength: 2 + }, + serializedName: "timeSeriesDatabaseConnectionName", + required: true, + type: { + name: "String" + } + } +}; + +export const timeSeriesDatabaseConnectionDescription: OperationParameter = { + parameterPath: "timeSeriesDatabaseConnectionDescription", + mapper: TimeSeriesDatabaseConnectionMapper +}; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operations/index.ts b/sdk/digitaltwins/arm-digitaltwins/src/operations/index.ts index 05c151b730f3..741138123ea0 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/operations/index.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/operations/index.ts @@ -11,3 +11,4 @@ export * from "./digitalTwinsEndpoint"; export * from "./operations"; export * from "./privateLinkResources"; export * from "./privateEndpointConnections"; +export * from "./timeSeriesDatabaseConnections"; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operations/timeSeriesDatabaseConnections.ts b/sdk/digitaltwins/arm-digitaltwins/src/operations/timeSeriesDatabaseConnections.ts new file mode 100644 index 000000000000..90a8ca2fff1a --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/src/operations/timeSeriesDatabaseConnections.ts @@ -0,0 +1,495 @@ +/* + * 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 { TimeSeriesDatabaseConnections } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureDigitalTwinsManagementClient } from "../azureDigitalTwinsManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + TimeSeriesDatabaseConnection, + TimeSeriesDatabaseConnectionsListNextOptionalParams, + TimeSeriesDatabaseConnectionsListOptionalParams, + TimeSeriesDatabaseConnectionsListResponse, + TimeSeriesDatabaseConnectionsGetOptionalParams, + TimeSeriesDatabaseConnectionsGetResponse, + TimeSeriesDatabaseConnectionsCreateOrUpdateOptionalParams, + TimeSeriesDatabaseConnectionsCreateOrUpdateResponse, + TimeSeriesDatabaseConnectionsDeleteOptionalParams, + TimeSeriesDatabaseConnectionsDeleteResponse, + TimeSeriesDatabaseConnectionsListNextResponse +} from "../models"; + +/// +/** Class containing TimeSeriesDatabaseConnections operations. */ +export class TimeSeriesDatabaseConnectionsImpl + implements TimeSeriesDatabaseConnections { + private readonly client: AzureDigitalTwinsManagementClient; + + /** + * Initialize a new instance of the class TimeSeriesDatabaseConnections class. + * @param client Reference to the service client + */ + constructor(client: AzureDigitalTwinsManagementClient) { + this.client = client; + } + + /** + * Get all existing time series database connections for this DigitalTwins instance. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + resourceName: string, + options?: TimeSeriesDatabaseConnectionsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, resourceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(resourceGroupName, resourceName, options); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + resourceName: string, + options?: TimeSeriesDatabaseConnectionsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(resourceGroupName, resourceName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + resourceName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + resourceGroupName: string, + resourceName: string, + options?: TimeSeriesDatabaseConnectionsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + resourceName, + options + )) { + yield* page; + } + } + + /** + * Get all existing time series database connections for this DigitalTwins instance. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + resourceName: string, + options?: TimeSeriesDatabaseConnectionsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + listOperationSpec + ); + } + + /** + * Get the description of an existing time series database connection. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param timeSeriesDatabaseConnectionName Name of time series database connection. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + timeSeriesDatabaseConnectionName: string, + options?: TimeSeriesDatabaseConnectionsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName, + options + }, + getOperationSpec + ); + } + + /** + * Create or update a time series database connection. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param timeSeriesDatabaseConnectionName Name of time series database connection. + * @param timeSeriesDatabaseConnectionDescription The time series database connection description. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + timeSeriesDatabaseConnectionName: string, + timeSeriesDatabaseConnectionDescription: TimeSeriesDatabaseConnection, + options?: TimeSeriesDatabaseConnectionsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + TimeSeriesDatabaseConnectionsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName, + timeSeriesDatabaseConnectionDescription, + options + }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Create or update a time series database connection. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param timeSeriesDatabaseConnectionName Name of time series database connection. + * @param timeSeriesDatabaseConnectionDescription The time series database connection description. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + timeSeriesDatabaseConnectionName: string, + timeSeriesDatabaseConnectionDescription: TimeSeriesDatabaseConnection, + options?: TimeSeriesDatabaseConnectionsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName, + timeSeriesDatabaseConnectionDescription, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete a time series database connection. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param timeSeriesDatabaseConnectionName Name of time series database connection. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + resourceName: string, + timeSeriesDatabaseConnectionName: string, + options?: TimeSeriesDatabaseConnectionsDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + TimeSeriesDatabaseConnectionsDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName, + options + }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Delete a time series database connection. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param timeSeriesDatabaseConnectionName Name of time series database connection. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + timeSeriesDatabaseConnectionName: string, + options?: TimeSeriesDatabaseConnectionsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + resourceName, + timeSeriesDatabaseConnectionName, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + resourceName: string, + nextLink: string, + options?: TimeSeriesDatabaseConnectionsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/timeSeriesDatabaseConnections", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.TimeSeriesDatabaseConnectionListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/timeSeriesDatabaseConnections/{timeSeriesDatabaseConnectionName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.TimeSeriesDatabaseConnection + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.timeSeriesDatabaseConnectionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/timeSeriesDatabaseConnections/{timeSeriesDatabaseConnectionName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.TimeSeriesDatabaseConnection + }, + 201: { + bodyMapper: Mappers.TimeSeriesDatabaseConnection + }, + 202: { + bodyMapper: Mappers.TimeSeriesDatabaseConnection + }, + 204: { + bodyMapper: Mappers.TimeSeriesDatabaseConnection + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.timeSeriesDatabaseConnectionDescription, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.timeSeriesDatabaseConnectionName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/timeSeriesDatabaseConnections/{timeSeriesDatabaseConnectionName}", + httpMethod: "DELETE", + responses: { + 200: { + bodyMapper: Mappers.TimeSeriesDatabaseConnection + }, + 201: { + bodyMapper: Mappers.TimeSeriesDatabaseConnection + }, + 202: { + bodyMapper: Mappers.TimeSeriesDatabaseConnection + }, + 204: { + bodyMapper: Mappers.TimeSeriesDatabaseConnection + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.timeSeriesDatabaseConnectionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.TimeSeriesDatabaseConnectionListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/index.ts b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/index.ts index 05c151b730f3..741138123ea0 100644 --- a/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/index.ts +++ b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/index.ts @@ -11,3 +11,4 @@ export * from "./digitalTwinsEndpoint"; export * from "./operations"; export * from "./privateLinkResources"; export * from "./privateEndpointConnections"; +export * from "./timeSeriesDatabaseConnections"; diff --git a/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/timeSeriesDatabaseConnections.ts b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/timeSeriesDatabaseConnections.ts new file mode 100644 index 000000000000..53a937839e25 --- /dev/null +++ b/sdk/digitaltwins/arm-digitaltwins/src/operationsInterfaces/timeSeriesDatabaseConnections.ts @@ -0,0 +1,115 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + TimeSeriesDatabaseConnection, + TimeSeriesDatabaseConnectionsListOptionalParams, + TimeSeriesDatabaseConnectionsGetOptionalParams, + TimeSeriesDatabaseConnectionsGetResponse, + TimeSeriesDatabaseConnectionsCreateOrUpdateOptionalParams, + TimeSeriesDatabaseConnectionsCreateOrUpdateResponse, + TimeSeriesDatabaseConnectionsDeleteOptionalParams, + TimeSeriesDatabaseConnectionsDeleteResponse +} from "../models"; + +/// +/** Interface representing a TimeSeriesDatabaseConnections. */ +export interface TimeSeriesDatabaseConnections { + /** + * Get all existing time series database connections for this DigitalTwins instance. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + resourceName: string, + options?: TimeSeriesDatabaseConnectionsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get the description of an existing time series database connection. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param timeSeriesDatabaseConnectionName Name of time series database connection. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + timeSeriesDatabaseConnectionName: string, + options?: TimeSeriesDatabaseConnectionsGetOptionalParams + ): Promise; + /** + * Create or update a time series database connection. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param timeSeriesDatabaseConnectionName Name of time series database connection. + * @param timeSeriesDatabaseConnectionDescription The time series database connection description. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + timeSeriesDatabaseConnectionName: string, + timeSeriesDatabaseConnectionDescription: TimeSeriesDatabaseConnection, + options?: TimeSeriesDatabaseConnectionsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + TimeSeriesDatabaseConnectionsCreateOrUpdateResponse + > + >; + /** + * Create or update a time series database connection. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param timeSeriesDatabaseConnectionName Name of time series database connection. + * @param timeSeriesDatabaseConnectionDescription The time series database connection description. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + timeSeriesDatabaseConnectionName: string, + timeSeriesDatabaseConnectionDescription: TimeSeriesDatabaseConnection, + options?: TimeSeriesDatabaseConnectionsCreateOrUpdateOptionalParams + ): Promise; + /** + * Delete a time series database connection. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param timeSeriesDatabaseConnectionName Name of time series database connection. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + resourceName: string, + timeSeriesDatabaseConnectionName: string, + options?: TimeSeriesDatabaseConnectionsDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + TimeSeriesDatabaseConnectionsDeleteResponse + > + >; + /** + * Delete a time series database connection. + * @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance. + * @param resourceName The name of the DigitalTwinsInstance. + * @param timeSeriesDatabaseConnectionName Name of time series database connection. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + timeSeriesDatabaseConnectionName: string, + options?: TimeSeriesDatabaseConnectionsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/digitaltwins/arm-digitaltwins/tsconfig.json b/sdk/digitaltwins/arm-digitaltwins/tsconfig.json index 6e3251194117..15e8d9a4ecc7 100644 --- a/sdk/digitaltwins/arm-digitaltwins/tsconfig.json +++ b/sdk/digitaltwins/arm-digitaltwins/tsconfig.json @@ -9,11 +9,25 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true + "importHelpers": true, + "paths": { + "@azure/arm-digitaltwins": [ + "./src/index" + ] + } }, - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "exclude": ["node_modules"] -} + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/digitaltwins/ci.mgmt.yml b/sdk/digitaltwins/ci.mgmt.yml index 3155329af1fb..a712524a2407 100644 --- a/sdk/digitaltwins/ci.mgmt.yml +++ b/sdk/digitaltwins/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: @@ -9,7 +9,7 @@ trigger: paths: include: - sdk/digitaltwins/ci.mgmt.yml - - sdk/digitaltwins/arm-digitaltwins/ + - sdk/digitaltwins/arm-digitaltwins pr: branches: include: @@ -22,12 +22,11 @@ pr: paths: include: - sdk/digitaltwins/ci.mgmt.yml - - sdk/digitaltwins/arm-digitaltwins/ - + - sdk/digitaltwins/arm-digitaltwins extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: digitaltwins Artifacts: - name: azure-arm-digitaltwins - safeName: azurearmdigitaltwins \ No newline at end of file + safeName: azurearmdigitaltwins diff --git a/sdk/digitaltwins/ci.yml b/sdk/digitaltwins/ci.yml index 64931d07f546..bbe631fa47c8 100644 --- a/sdk/digitaltwins/ci.yml +++ b/sdk/digitaltwins/ci.yml @@ -1,4 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + trigger: branches: include: @@ -11,6 +12,7 @@ trigger: exclude: - sdk/digitaltwins/ci.mgmt.yml - sdk/digitaltwins/arm-digitaltwins/ + - sdk/digitaltwins/arm-digitaltwins pr: branches: include: @@ -26,6 +28,7 @@ pr: exclude: - sdk/digitaltwins/ci.mgmt.yml - sdk/digitaltwins/arm-digitaltwins/ + - sdk/digitaltwins/arm-digitaltwins extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: