ZiWei Chen 2024-04-26 13:07:27 +08:00 коммит произвёл GitHub
Родитель 4d300c4319
Коммит 7291119826
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
81 изменённых файлов: 8585 добавлений и 1 удалений

4
.github/CODEOWNERS поставляемый
Просмотреть файл

@ -452,6 +452,10 @@
# PRLabel: %Mgmt
/sdk/devspaces/arm-devspaces/ @qiaozha @MaryGao
# PRLabel: %Mgmt
/sdk/deviceregistry/arm-deviceregistry/ @qiaozha @MaryGao
# PRLabel: %Mgmt
/sdk/defendereasm/arm-defendereasm/ @qiaozha @MaryGao

Просмотреть файл

@ -266,6 +266,9 @@ dependencies:
'@rush-temp/arm-deviceprovisioningservices':
specifier: file:./projects/arm-deviceprovisioningservices.tgz
version: file:projects/arm-deviceprovisioningservices.tgz
'@rush-temp/arm-deviceregistry':
specifier: file:./projects/arm-deviceregistry.tgz
version: file:projects/arm-deviceregistry.tgz
'@rush-temp/arm-deviceupdate':
specifier: file:./projects/arm-deviceupdate.tgz
version: file:projects/arm-deviceupdate.tgz
@ -13551,6 +13554,36 @@ packages:
- supports-color
dev: false
file:projects/arm-deviceregistry.tgz:
resolution: {integrity: sha512-rt9bG8kZpBqqAJx2+WpHHznBcszYbbrbgwOh6QtXtYUzcIzNEHeS85cKBMweOdRUZ2I42SPvNcobolcwZ0xOTg==, tarball: file:projects/arm-deviceregistry.tgz}
name: '@rush-temp/arm-deviceregistry'
version: 0.0.0
dependencies:
'@azure-tools/test-credential': 1.0.4
'@azure-tools/test-recorder': 3.2.0
'@azure/abort-controller': 1.1.0
'@azure/identity': 4.1.0
'@microsoft/api-extractor': 7.43.1(@types/node@18.19.31)
'@types/chai': 4.3.14
'@types/mocha': 10.0.6
'@types/node': 18.19.31
chai: 4.3.10
cross-env: 7.0.3
dotenv: 16.4.5
esm: 3.2.25
mkdirp: 3.0.1
mocha: 10.4.0
rimraf: 5.0.5
ts-node: 10.9.2(@types/node@18.19.31)(typescript@5.4.5)
tslib: 2.6.2
typescript: 5.4.5
uglify-js: 3.17.4
transitivePeerDependencies:
- '@swc/core'
- '@swc/wasm'
- supports-color
dev: false
file:projects/arm-deviceupdate.tgz:
resolution: {integrity: sha512-/GOmyZHmi8uzev8p6qzKMw29K7fOpgpNYojS9dQhBdZyCcFK4h43WWihz3bWiIrXGurJGeHNcOaPVBKjWC2jYQ==, tarball: file:projects/arm-deviceupdate.tgz}
name: '@rush-temp/arm-deviceupdate'

Просмотреть файл

@ -20,4 +20,8 @@ https://docs.microsoft.com/javascript/api/@azure-rest/purview-datamap?view=azure
https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/purview/purview-datamap-rest/samples
https://docs.microsoft.com/javascript/api/@azure/arm-migrationdiscoverysap?view=azure-node-preview
https://docs.microsoft.com/javascript/api/@azure/arm-storageactions?view=azure-node-preview
<<<<<<< HEAD
https://docs.microsoft.com/javascript/api/@azure/arm-deviceregistry?view=azure-node-preview
=======
https://docs.microsoft.com/javascript/api/@azure/arm-standbypool?view=azure-node-preview
>>>>>>> main

Просмотреть файл

@ -1,7 +1,7 @@
/**
* This is the main configuration file for Rush.
* For full documentation, please see https://rushjs.io
*/{
*/ {
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json",
/**
* (Required) This specifies the version of the Rush engine to be used in this repo.
@ -2213,6 +2213,11 @@
"projectFolder": "sdk/storageactions/arm-storageactions",
"versionPolicyName": "management"
},
{
"packageName": "@azure/arm-deviceregistry",
"projectFolder": "sdk/deviceregistry/arm-deviceregistry",
"versionPolicyName": "management"
},
{
"packageName": "@azure/arm-standbypool",
"projectFolder": "sdk/standbypool/arm-standbypool",

Просмотреть файл

@ -0,0 +1,5 @@
# Release History
## 1.0.0-beta.1 (2024-04-15)
The package of @azure/arm-deviceregistry is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart).

Просмотреть файл

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2024 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Просмотреть файл

@ -0,0 +1,109 @@
# Azure DeviceRegistryManagement client library for JavaScript
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure DeviceRegistryManagement client.
Microsoft.DeviceRegistry Resource Provider management API.
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceregistry/arm-deviceregistry) |
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-deviceregistry) |
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-deviceregistry?view=azure-node-preview) |
[Samples](https://github.com/Azure-Samples/azure-samples-js-management)
## Getting started
### Currently supported environments
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
- 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].
### Install the `@azure/arm-deviceregistry` package
Install the Azure DeviceRegistryManagement client library for JavaScript with `npm`:
```bash
npm install @azure/arm-deviceregistry
```
### Create and authenticate a `DeviceRegistryManagementClient`
To create a client object to access the Azure DeviceRegistryManagement API, you will need the `endpoint` of your Azure DeviceRegistryManagement resource and a `credential`. The Azure DeviceRegistryManagement client can use Azure Active Directory credentials to authenticate.
You can find the endpoint for your Azure DeviceRegistryManagement resource in the [Azure Portal][azure_portal].
You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).
To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
```bash
npm install @azure/identity
```
You will also need to **register a new AAD application and grant access to Azure DeviceRegistryManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.
For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).
```javascript
const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
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 DeviceRegistryManagementClient(new DefaultAzureCredential(), subscriptionId);
// For client-side applications running in the browser, use this code instead:
// const credential = new InteractiveBrowserCredential({
// tenantId: "<YOUR_TENANT_ID>",
// clientId: "<YOUR_CLIENT_ID>"
// });
// const client = new DeviceRegistryManagementClient(credential, subscriptionId);
```
### JavaScript Bundle
To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).
## Key concepts
### DeviceRegistryManagementClient
`DeviceRegistryManagementClient` is the primary interface for developers using the Azure DeviceRegistryManagement client library. Explore the methods on this client object to understand the different features of the Azure DeviceRegistryManagement service that you can access.
## Troubleshooting
### Logging
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
```javascript
const { setLogLevel } = require("@azure/logger");
setLogLevel("info");
```
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
## Next steps
Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library.
## Contributing
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
## Related projects
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fdeviceregistry%2Farm-deviceregistry%2FREADME.png)
[azure_cli]: https://docs.microsoft.com/cli/azure
[azure_sub]: https://azure.microsoft.com/free/
[azure_sub]: https://azure.microsoft.com/free/
[azure_portal]: https://portal.azure.com
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential

Просмотреть файл

@ -0,0 +1,8 @@
{
"commit": "59c04c61a355af4b56dd91a4b9b5eefe76e2f0cd",
"readme": "specification/deviceregistry/resource-manager/readme.md",
"autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\deviceregistry\\resource-manager\\readme.md --use=@autorest/typescript@6.0.20 --generate-sample=true",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/js-sdk-release-tools@2.7.5",
"use": "@autorest/typescript@6.0.20"
}

Просмотреть файл

@ -0,0 +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"
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "./types/arm-deviceregistry.d.ts"
},
"messages": {
"tsdocMessageReporting": {
"default": {
"logLevel": "none"
}
},
"extractorMessageReporting": {
"ae-missing-release-tag": {
"logLevel": "none"
},
"ae-unresolved-link": {
"logLevel": "none"
}
}
}
}

Просмотреть файл

@ -0,0 +1,118 @@
{
"name": "@azure/arm-deviceregistry",
"sdk-type": "mgmt",
"author": "Microsoft Corporation",
"description": "A generated SDK for DeviceRegistryManagementClient.",
"version": "1.0.0-beta.1",
"engines": {
"node": ">=18.0.0"
},
"dependencies": {
"@azure/core-lro": "^2.5.4",
"@azure/abort-controller": "^1.0.0",
"@azure/core-paging": "^1.2.0",
"@azure/core-client": "^1.7.0",
"@azure/core-auth": "^1.6.0",
"@azure/core-rest-pipeline": "^1.14.0",
"tslib": "^2.2.0"
},
"keywords": [
"node",
"azure",
"typescript",
"browser",
"isomorphic"
],
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist-esm/src/index.js",
"types": "./types/arm-deviceregistry.d.ts",
"devDependencies": {
"@microsoft/api-extractor": "^7.31.1",
"mkdirp": "^3.0.1",
"typescript": "~5.4.5",
"uglify-js": "^3.4.9",
"rimraf": "^5.0.0",
"dotenv": "^16.0.0",
"@azure/dev-tool": "^1.0.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"@azure-tools/test-credential": "^1.0.0",
"mocha": "^10.0.0",
"@types/mocha": "^10.0.0",
"esm": "^3.2.18",
"@types/chai": "^4.2.8",
"chai": "^4.2.0",
"cross-env": "^7.0.2",
"@types/node": "^18.0.0",
"ts-node": "^10.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-sdk-for-js.git"
},
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"files": [
"dist/**/*.js",
"dist/**/*.js.map",
"dist/**/*.d.ts",
"dist/**/*.d.ts.map",
"dist-esm/**/*.js",
"dist-esm/**/*.js.map",
"dist-esm/**/*.d.ts",
"dist-esm/**/*.d.ts.map",
"src/**/*.ts",
"README.md",
"LICENSE",
"tsconfig.json",
"review/*",
"CHANGELOG.md",
"types/*"
],
"scripts": {
"build": "npm run clean && tsc && dev-tool run bundle && npm run minify && mkdirp ./review && npm run extract-api",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js",
"prepack": "npm run build",
"pack": "npm pack 2>&1",
"extract-api": "api-extractor run --local",
"lint": "echo skipped",
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"build:node": "echo skipped",
"build:browser": "echo skipped",
"build:test": "echo skipped",
"build:samples": "echo skipped.",
"check-format": "echo skipped",
"execute:samples": "echo skipped",
"format": "echo skipped",
"test": "npm run integration-test",
"test:node": "echo skipped",
"test:browser": "echo skipped",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
"unit-test:browser": "echo skipped",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
"integration-test:browser": "echo skipped"
},
"sideEffects": false,
"//metadata": {
"constantPaths": [
{
"path": "src/deviceRegistryManagementClient.ts",
"prefix": "packageDetails"
}
]
},
"autoPublish": true,
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceregistry/arm-deviceregistry",
"//sampleConfiguration": {
"productName": "",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-deviceregistry?view=azure-node-preview"
}
}

Просмотреть файл

@ -0,0 +1,611 @@
## API Report File for "@azure/arm-deviceregistry"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import * as coreAuth from '@azure/core-auth';
import * as coreClient from '@azure/core-client';
import { OperationState } from '@azure/core-lro';
import { PagedAsyncIterableIterator } from '@azure/core-paging';
import { SimplePollerLike } from '@azure/core-lro';
// @public
export type ActionType = string;
// @public
export interface Asset extends TrackedResource {
extendedLocation: ExtendedLocation;
properties?: AssetProperties;
}
// @public
export interface AssetEndpointProfile extends TrackedResource {
extendedLocation: ExtendedLocation;
properties?: AssetEndpointProfileProperties;
}
// @public
export interface AssetEndpointProfileListResult {
nextLink?: string;
value: AssetEndpointProfile[];
}
// @public
export interface AssetEndpointProfileProperties {
additionalConfiguration?: string;
readonly provisioningState?: ProvisioningState;
targetAddress: string;
transportAuthentication?: TransportAuthentication;
userAuthentication?: UserAuthentication;
readonly uuid?: string;
}
// @public
export interface AssetEndpointProfiles {
beginCreateOrReplace(resourceGroupName: string, assetEndpointProfileName: string, resource: AssetEndpointProfile, options?: AssetEndpointProfilesCreateOrReplaceOptionalParams): Promise<SimplePollerLike<OperationState<AssetEndpointProfilesCreateOrReplaceResponse>, AssetEndpointProfilesCreateOrReplaceResponse>>;
beginCreateOrReplaceAndWait(resourceGroupName: string, assetEndpointProfileName: string, resource: AssetEndpointProfile, options?: AssetEndpointProfilesCreateOrReplaceOptionalParams): Promise<AssetEndpointProfilesCreateOrReplaceResponse>;
beginDelete(resourceGroupName: string, assetEndpointProfileName: string, options?: AssetEndpointProfilesDeleteOptionalParams): Promise<SimplePollerLike<OperationState<AssetEndpointProfilesDeleteResponse>, AssetEndpointProfilesDeleteResponse>>;
beginDeleteAndWait(resourceGroupName: string, assetEndpointProfileName: string, options?: AssetEndpointProfilesDeleteOptionalParams): Promise<AssetEndpointProfilesDeleteResponse>;
beginUpdate(resourceGroupName: string, assetEndpointProfileName: string, properties: AssetEndpointProfileUpdate, options?: AssetEndpointProfilesUpdateOptionalParams): Promise<SimplePollerLike<OperationState<AssetEndpointProfilesUpdateResponse>, AssetEndpointProfilesUpdateResponse>>;
beginUpdateAndWait(resourceGroupName: string, assetEndpointProfileName: string, properties: AssetEndpointProfileUpdate, options?: AssetEndpointProfilesUpdateOptionalParams): Promise<AssetEndpointProfilesUpdateResponse>;
get(resourceGroupName: string, assetEndpointProfileName: string, options?: AssetEndpointProfilesGetOptionalParams): Promise<AssetEndpointProfilesGetResponse>;
listByResourceGroup(resourceGroupName: string, options?: AssetEndpointProfilesListByResourceGroupOptionalParams): PagedAsyncIterableIterator<AssetEndpointProfile>;
listBySubscription(options?: AssetEndpointProfilesListBySubscriptionOptionalParams): PagedAsyncIterableIterator<AssetEndpointProfile>;
}
// @public
export interface AssetEndpointProfilesCreateOrReplaceHeaders {
retryAfter?: number;
}
// @public
export interface AssetEndpointProfilesCreateOrReplaceOptionalParams extends coreClient.OperationOptions {
resumeFrom?: string;
updateIntervalInMs?: number;
}
// @public
export type AssetEndpointProfilesCreateOrReplaceResponse = AssetEndpointProfile;
// @public
export interface AssetEndpointProfilesDeleteHeaders {
location?: string;
retryAfter?: number;
}
// @public
export interface AssetEndpointProfilesDeleteOptionalParams extends coreClient.OperationOptions {
resumeFrom?: string;
updateIntervalInMs?: number;
}
// @public
export type AssetEndpointProfilesDeleteResponse = AssetEndpointProfilesDeleteHeaders;
// @public
export interface AssetEndpointProfilesGetOptionalParams extends coreClient.OperationOptions {
}
// @public
export type AssetEndpointProfilesGetResponse = AssetEndpointProfile;
// @public
export interface AssetEndpointProfilesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions {
}
// @public
export type AssetEndpointProfilesListByResourceGroupNextResponse = AssetEndpointProfileListResult;
// @public
export interface AssetEndpointProfilesListByResourceGroupOptionalParams extends coreClient.OperationOptions {
}
// @public
export type AssetEndpointProfilesListByResourceGroupResponse = AssetEndpointProfileListResult;
// @public
export interface AssetEndpointProfilesListBySubscriptionNextOptionalParams extends coreClient.OperationOptions {
}
// @public
export type AssetEndpointProfilesListBySubscriptionNextResponse = AssetEndpointProfileListResult;
// @public
export interface AssetEndpointProfilesListBySubscriptionOptionalParams extends coreClient.OperationOptions {
}
// @public
export type AssetEndpointProfilesListBySubscriptionResponse = AssetEndpointProfileListResult;
// @public
export interface AssetEndpointProfilesUpdateHeaders {
location?: string;
retryAfter?: number;
}
// @public
export interface AssetEndpointProfilesUpdateOptionalParams extends coreClient.OperationOptions {
resumeFrom?: string;
updateIntervalInMs?: number;
}
// @public
export type AssetEndpointProfilesUpdateResponse = AssetEndpointProfile;
// @public
export interface AssetEndpointProfileUpdate {
properties?: AssetEndpointProfileUpdateProperties;
tags?: {
[propertyName: string]: string;
};
}
// @public
export interface AssetEndpointProfileUpdateProperties {
additionalConfiguration?: string;
targetAddress?: string;
transportAuthentication?: TransportAuthenticationUpdate;
userAuthentication?: UserAuthenticationUpdate;
}
// @public
export interface AssetListResult {
nextLink?: string;
value: Asset[];
}
// @public
export interface AssetProperties {
assetEndpointProfileUri: string;
assetType?: string;
attributes?: {
[propertyName: string]: any;
};
dataPoints?: DataPoint[];
defaultDataPointsConfiguration?: string;
defaultEventsConfiguration?: string;
description?: string;
displayName?: string;
documentationUri?: string;
enabled?: boolean;
events?: Event_2[];
externalAssetId?: string;
hardwareRevision?: string;
manufacturer?: string;
manufacturerUri?: string;
model?: string;
productCode?: string;
readonly provisioningState?: ProvisioningState;
serialNumber?: string;
softwareRevision?: string;
readonly status?: AssetStatus;
readonly uuid?: string;
readonly version?: number;
}
// @public
export interface Assets {
beginCreateOrReplace(resourceGroupName: string, assetName: string, resource: Asset, options?: AssetsCreateOrReplaceOptionalParams): Promise<SimplePollerLike<OperationState<AssetsCreateOrReplaceResponse>, AssetsCreateOrReplaceResponse>>;
beginCreateOrReplaceAndWait(resourceGroupName: string, assetName: string, resource: Asset, options?: AssetsCreateOrReplaceOptionalParams): Promise<AssetsCreateOrReplaceResponse>;
beginDelete(resourceGroupName: string, assetName: string, options?: AssetsDeleteOptionalParams): Promise<SimplePollerLike<OperationState<AssetsDeleteResponse>, AssetsDeleteResponse>>;
beginDeleteAndWait(resourceGroupName: string, assetName: string, options?: AssetsDeleteOptionalParams): Promise<AssetsDeleteResponse>;
beginUpdate(resourceGroupName: string, assetName: string, properties: AssetUpdate, options?: AssetsUpdateOptionalParams): Promise<SimplePollerLike<OperationState<AssetsUpdateResponse>, AssetsUpdateResponse>>;
beginUpdateAndWait(resourceGroupName: string, assetName: string, properties: AssetUpdate, options?: AssetsUpdateOptionalParams): Promise<AssetsUpdateResponse>;
get(resourceGroupName: string, assetName: string, options?: AssetsGetOptionalParams): Promise<AssetsGetResponse>;
listByResourceGroup(resourceGroupName: string, options?: AssetsListByResourceGroupOptionalParams): PagedAsyncIterableIterator<Asset>;
listBySubscription(options?: AssetsListBySubscriptionOptionalParams): PagedAsyncIterableIterator<Asset>;
}
// @public
export interface AssetsCreateOrReplaceHeaders {
retryAfter?: number;
}
// @public
export interface AssetsCreateOrReplaceOptionalParams extends coreClient.OperationOptions {
resumeFrom?: string;
updateIntervalInMs?: number;
}
// @public
export type AssetsCreateOrReplaceResponse = Asset;
// @public
export interface AssetsDeleteHeaders {
location?: string;
retryAfter?: number;
}
// @public
export interface AssetsDeleteOptionalParams extends coreClient.OperationOptions {
resumeFrom?: string;
updateIntervalInMs?: number;
}
// @public
export type AssetsDeleteResponse = AssetsDeleteHeaders;
// @public
export interface AssetsGetOptionalParams extends coreClient.OperationOptions {
}
// @public
export type AssetsGetResponse = Asset;
// @public
export interface AssetsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions {
}
// @public
export type AssetsListByResourceGroupNextResponse = AssetListResult;
// @public
export interface AssetsListByResourceGroupOptionalParams extends coreClient.OperationOptions {
}
// @public
export type AssetsListByResourceGroupResponse = AssetListResult;
// @public
export interface AssetsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions {
}
// @public
export type AssetsListBySubscriptionNextResponse = AssetListResult;
// @public
export interface AssetsListBySubscriptionOptionalParams extends coreClient.OperationOptions {
}
// @public
export type AssetsListBySubscriptionResponse = AssetListResult;
// @public
export interface AssetStatus {
errors?: AssetStatusError[];
version?: number;
}
// @public
export interface AssetStatusError {
code?: number;
message?: string;
}
// @public
export interface AssetsUpdateHeaders {
location?: string;
retryAfter?: number;
}
// @public
export interface AssetsUpdateOptionalParams extends coreClient.OperationOptions {
resumeFrom?: string;
updateIntervalInMs?: number;
}
// @public
export type AssetsUpdateResponse = Asset;
// @public
export interface AssetUpdate {
properties?: AssetUpdateProperties;
tags?: {
[propertyName: string]: string;
};
}
// @public
export interface AssetUpdateProperties {
assetType?: string;
attributes?: {
[propertyName: string]: any;
};
dataPoints?: DataPoint[];
defaultDataPointsConfiguration?: string;
defaultEventsConfiguration?: string;
description?: string;
displayName?: string;
documentationUri?: string;
enabled?: boolean;
events?: Event_2[];
hardwareRevision?: string;
manufacturer?: string;
manufacturerUri?: string;
model?: string;
productCode?: string;
serialNumber?: string;
softwareRevision?: string;
}
// @public
export type CreatedByType = string;
// @public
export interface DataPoint {
capabilityId?: string;
dataPointConfiguration?: string;
dataSource: string;
name?: string;
observabilityMode?: DataPointsObservabilityMode;
}
// @public
export type DataPointsObservabilityMode = string;
// @public (undocumented)
export class DeviceRegistryManagementClient extends coreClient.ServiceClient {
// (undocumented)
$host: string;
constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: DeviceRegistryManagementClientOptionalParams);
// (undocumented)
apiVersion: string;
// (undocumented)
assetEndpointProfiles: AssetEndpointProfiles;
// (undocumented)
assets: Assets;
// (undocumented)
operations: Operations;
// (undocumented)
operationStatus: OperationStatus;
// (undocumented)
subscriptionId: string;
}
// @public
export interface DeviceRegistryManagementClientOptionalParams extends coreClient.ServiceClientOptions {
$host?: string;
apiVersion?: string;
endpoint?: string;
}
// @public
export interface ErrorAdditionalInfo {
readonly info?: Record<string, unknown>;
readonly type?: string;
}
// @public
export interface ErrorDetail {
readonly additionalInfo?: ErrorAdditionalInfo[];
readonly code?: string;
readonly details?: ErrorDetail[];
readonly message?: string;
readonly target?: string;
}
// @public
export interface ErrorResponse {
error?: ErrorDetail;
}
// @public
interface Event_2 {
capabilityId?: string;
eventConfiguration?: string;
eventNotifier: string;
name?: string;
observabilityMode?: EventsObservabilityMode;
}
export { Event_2 as Event }
// @public
export type EventsObservabilityMode = string;
// @public
export interface ExtendedLocation {
name: string;
type: string;
}
// @public
export function getContinuationToken(page: unknown): string | undefined;
// @public
export enum KnownActionType {
Internal = "Internal"
}
// @public
export enum KnownCreatedByType {
Application = "Application",
Key = "Key",
ManagedIdentity = "ManagedIdentity",
User = "User"
}
// @public
export enum KnownDataPointsObservabilityMode {
Counter = "counter",
Gauge = "gauge",
Histogram = "histogram",
Log = "log",
None = "none"
}
// @public
export enum KnownEventsObservabilityMode {
Log = "log",
None = "none"
}
// @public
export enum KnownOrigin {
System = "system",
User = "user",
UserSystem = "user,system"
}
// @public
export enum KnownProvisioningState {
Accepted = "Accepted",
Canceled = "Canceled",
Failed = "Failed",
Succeeded = "Succeeded"
}
// @public
export enum KnownUserAuthenticationMode {
Anonymous = "Anonymous",
Certificate = "Certificate",
UsernamePassword = "UsernamePassword"
}
// @public
export interface Operation {
readonly actionType?: ActionType;
display?: OperationDisplay;
readonly isDataAction?: boolean;
readonly name?: string;
readonly origin?: Origin;
}
// @public
export interface OperationDisplay {
readonly description?: string;
readonly operation?: string;
readonly provider?: string;
readonly resource?: string;
}
// @public
export interface OperationListResult {
readonly nextLink?: string;
readonly value?: Operation[];
}
// @public
export interface Operations {
list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator<Operation>;
}
// @public
export interface OperationsListNextOptionalParams extends coreClient.OperationOptions {
}
// @public
export type OperationsListNextResponse = OperationListResult;
// @public
export interface OperationsListOptionalParams extends coreClient.OperationOptions {
}
// @public
export type OperationsListResponse = OperationListResult;
// @public
export interface OperationStatus {
get(location: string, operationId: string, options?: OperationStatusGetOptionalParams): Promise<OperationStatusGetResponse>;
}
// @public
export interface OperationStatusGetOptionalParams extends coreClient.OperationOptions {
}
// @public
export type OperationStatusGetResponse = OperationStatusResult;
// @public
export interface OperationStatusResult {
endTime?: Date;
error?: ErrorDetail;
id?: string;
name?: string;
operations?: OperationStatusResult[];
percentComplete?: number;
startTime?: Date;
status: string;
}
// @public
export type Origin = string;
// @public
export interface OwnCertificate {
certPasswordReference?: string;
certSecretReference?: string;
certThumbprint?: string;
}
// @public
export type ProvisioningState = string;
// @public
export interface Resource {
readonly id?: string;
readonly name?: string;
readonly systemData?: SystemData;
readonly type?: string;
}
// @public
export interface SystemData {
createdAt?: Date;
createdBy?: string;
createdByType?: CreatedByType;
lastModifiedAt?: Date;
lastModifiedBy?: string;
lastModifiedByType?: CreatedByType;
}
// @public
export interface TrackedResource extends Resource {
location: string;
tags?: {
[propertyName: string]: string;
};
}
// @public
export interface TransportAuthentication {
ownCertificates: OwnCertificate[];
}
// @public
export interface TransportAuthenticationUpdate {
ownCertificates?: OwnCertificate[];
}
// @public
export interface UserAuthentication {
mode: UserAuthenticationMode;
usernamePasswordCredentials?: UsernamePasswordCredentials;
x509Credentials?: X509Credentials;
}
// @public
export type UserAuthenticationMode = string;
// @public
export interface UserAuthenticationUpdate {
mode?: UserAuthenticationMode;
usernamePasswordCredentials?: UsernamePasswordCredentialsUpdate;
x509Credentials?: X509CredentialsUpdate;
}
// @public
export interface UsernamePasswordCredentials {
passwordReference: string;
usernameReference: string;
}
// @public
export interface UsernamePasswordCredentialsUpdate {
passwordReference?: string;
usernameReference?: string;
}
// @public
export interface X509Credentials {
certificateReference: string;
}
// @public
export interface X509CredentialsUpdate {
certificateReference?: string;
}
// (No @packageDocumentation comment for this package)
```

Просмотреть файл

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,59 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
AssetEndpointProfile,
DeviceRegistryManagementClient,
} from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Create a AssetEndpointProfile
*
* @summary Create a AssetEndpointProfile
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_AssetEndpointProfile.json
*/
async function createAnAssetEndpointProfile() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetEndpointProfileName = "my-assetendpointprofile";
const resource: AssetEndpointProfile = {
extendedLocation: {
name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1",
type: "CustomLocation",
},
location: "West Europe",
properties: {
targetAddress: "https://www.example.com/myTargetAddress",
userAuthentication: { mode: "Anonymous" },
},
tags: { site: "building-1" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assetEndpointProfiles.beginCreateOrReplaceAndWait(
resourceGroupName,
assetEndpointProfileName,
resource,
);
console.log(result);
}
async function main() {
createAnAssetEndpointProfile();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Delete a AssetEndpointProfile
*
* @summary Delete a AssetEndpointProfile
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_AssetEndpointProfile.json
*/
async function deleteAnAssetEndpointProfile() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetEndpointProfileName = "my-assetendpointprofile";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assetEndpointProfiles.beginDeleteAndWait(
resourceGroupName,
assetEndpointProfileName,
);
console.log(result);
}
async function main() {
deleteAnAssetEndpointProfile();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get a AssetEndpointProfile
*
* @summary Get a AssetEndpointProfile
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json
*/
async function getAnAssetEndpointProfile() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetEndpointProfileName = "my-assetendpointprofile";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assetEndpointProfiles.get(
resourceGroupName,
assetEndpointProfileName,
);
console.log(result);
}
async function main() {
getAnAssetEndpointProfile();
}
main().catch(console.error);

Просмотреть файл

@ -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.
import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to List AssetEndpointProfile resources by resource group
*
* @summary List AssetEndpointProfile resources by resource group
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_ResourceGroup.json
*/
async function listAssetEndpointProfilesInAResourceGroup() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.assetEndpointProfiles.listByResourceGroup(
resourceGroupName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAssetEndpointProfilesInAResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to List AssetEndpointProfile resources by subscription ID
*
* @summary List AssetEndpointProfile resources by subscription ID
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_Subscription.json
*/
async function listAssetEndpointProfilesInASubscription() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.assetEndpointProfiles.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAssetEndpointProfilesInASubscription();
}
main().catch(console.error);

Просмотреть файл

@ -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.
import {
AssetEndpointProfileUpdate,
DeviceRegistryManagementClient,
} from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Update a AssetEndpointProfile
*
* @summary Update a AssetEndpointProfile
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json
*/
async function patchAnAssetEndpointProfile() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetEndpointProfileName = "my-assetendpointprofile";
const properties: AssetEndpointProfileUpdate = {
properties: { targetAddress: "https://www.example.com/myTargetAddress" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assetEndpointProfiles.beginUpdateAndWait(
resourceGroupName,
assetEndpointProfileName,
properties,
);
console.log(result);
}
async function main() {
patchAnAssetEndpointProfile();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,273 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
Asset,
DeviceRegistryManagementClient,
} from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Create a Asset
*
* @summary Create a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_With_ExternalAssetId.json
*/
async function createAnAssetWithExternalAssetId() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const resource: Asset = {
extendedLocation: {
name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1",
type: "CustomLocation",
},
location: "West Europe",
properties: {
description: "This is a sample Asset",
assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile",
assetType: "MyAssetType",
dataPoints: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
dataPointConfiguration:
'{"publishingInterval":8,"samplingInterval":8,"queueSize":4}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1",
observabilityMode: "counter",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
dataPointConfiguration:
'{"publishingInterval":4,"samplingInterval":4,"queueSize":7}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2",
observabilityMode: "none",
},
],
defaultDataPointsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
defaultEventsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
displayName: "AssetDisplayName",
documentationUri: "https://www.example.com/manual",
enabled: true,
events: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
eventConfiguration:
'{"publishingInterval":7,"samplingInterval":1,"queueSize":8}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3",
observabilityMode: "none",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
eventConfiguration:
'{"publishingInterval":7,"samplingInterval":8,"queueSize":4}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4",
observabilityMode: "log",
},
],
externalAssetId: "8ZBA6LRHU0A458969",
hardwareRevision: "1.0",
manufacturer: "Contoso",
manufacturerUri: "https://www.contoso.com/manufacturerUri",
model: "ContosoModel",
productCode: "SA34VDG",
serialNumber: "64-103816-519918-8",
softwareRevision: "2.0",
},
tags: { site: "building-1" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginCreateOrReplaceAndWait(
resourceGroupName,
assetName,
resource,
);
console.log(result);
}
/**
* This sample demonstrates how to Create a Asset
*
* @summary Create a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_DisplayName.json
*/
async function createAnAssetWithoutDisplayName() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const resource: Asset = {
extendedLocation: {
name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1",
type: "CustomLocation",
},
location: "West Europe",
properties: {
description: "This is a sample Asset",
assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile",
assetType: "MyAssetType",
dataPoints: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
dataPointConfiguration:
'{"publishingInterval":8,"samplingInterval":8,"queueSize":4}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1",
observabilityMode: "counter",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
dataPointConfiguration:
'{"publishingInterval":4,"samplingInterval":4,"queueSize":7}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2",
observabilityMode: "none",
},
],
defaultDataPointsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
defaultEventsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
documentationUri: "https://www.example.com/manual",
enabled: true,
events: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
eventConfiguration:
'{"publishingInterval":7,"samplingInterval":1,"queueSize":8}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3",
observabilityMode: "none",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
eventConfiguration:
'{"publishingInterval":7,"samplingInterval":8,"queueSize":4}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4",
observabilityMode: "log",
},
],
externalAssetId: "8ZBA6LRHU0A458969",
hardwareRevision: "1.0",
manufacturer: "Contoso",
manufacturerUri: "https://www.contoso.com/manufacturerUri",
model: "ContosoModel",
productCode: "SA34VDG",
serialNumber: "64-103816-519918-8",
softwareRevision: "2.0",
},
tags: { site: "building-1" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginCreateOrReplaceAndWait(
resourceGroupName,
assetName,
resource,
);
console.log(result);
}
/**
* This sample demonstrates how to Create a Asset
*
* @summary Create a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_ExternalAssetId.json
*/
async function createAnAssetWithoutExternalAssetId() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const resource: Asset = {
extendedLocation: {
name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1",
type: "CustomLocation",
},
location: "West Europe",
properties: {
description: "This is a sample Asset",
assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile",
assetType: "MyAssetType",
dataPoints: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
dataPointConfiguration:
'{"publishingInterval":8,"samplingInterval":8,"queueSize":4}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1",
observabilityMode: "counter",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
dataPointConfiguration:
'{"publishingInterval":4,"samplingInterval":4,"queueSize":7}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2",
observabilityMode: "none",
},
],
defaultDataPointsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
defaultEventsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
displayName: "AssetDisplayName",
documentationUri: "https://www.example.com/manual",
enabled: true,
events: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
eventConfiguration:
'{"publishingInterval":7,"samplingInterval":1,"queueSize":8}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3",
observabilityMode: "none",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
eventConfiguration:
'{"publishingInterval":7,"samplingInterval":8,"queueSize":4}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4",
observabilityMode: "log",
},
],
hardwareRevision: "1.0",
manufacturer: "Contoso",
manufacturerUri: "https://www.contoso.com/manufacturerUri",
model: "ContosoModel",
productCode: "SA34VDG",
serialNumber: "64-103816-519918-8",
softwareRevision: "2.0",
},
tags: { site: "building-1" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginCreateOrReplaceAndWait(
resourceGroupName,
assetName,
resource,
);
console.log(result);
}
async function main() {
createAnAssetWithExternalAssetId();
createAnAssetWithoutDisplayName();
createAnAssetWithoutExternalAssetId();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Delete a Asset
*
* @summary Delete a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_Asset.json
*/
async function deleteAnAsset() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginDeleteAndWait(
resourceGroupName,
assetName,
);
console.log(result);
}
async function main() {
deleteAnAsset();
}
main().catch(console.error);

Просмотреть файл

@ -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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get a Asset
*
* @summary Get a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json
*/
async function getAnAsset() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.get(resourceGroupName, assetName);
console.log(result);
}
/**
* This sample demonstrates how to Get a Asset
*
* @summary Get a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset_With_SyncStatus.json
*/
async function getAnAssetWithSyncStatus() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.get(resourceGroupName, assetName);
console.log(result);
}
async function main() {
getAnAsset();
getAnAssetWithSyncStatus();
}
main().catch(console.error);

Просмотреть файл

@ -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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to List Asset resources by resource group
*
* @summary List Asset resources by resource group
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_ResourceGroup.json
*/
async function listAssetsInAResourceGroup() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.assets.listByResourceGroup(resourceGroupName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAssetsInAResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to List Asset resources by subscription ID
*
* @summary List Asset resources by subscription ID
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_Subscription.json
*/
async function listAssetsInASubscription() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.assets.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAssetsInASubscription();
}
main().catch(console.error);

Просмотреть файл

@ -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.
import {
AssetUpdate,
DeviceRegistryManagementClient,
} from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Update a Asset
*
* @summary Update a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json
*/
async function patchAnAsset() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const properties: AssetUpdate = {
properties: { displayName: "NewAssetDisplayName", enabled: false },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginUpdateAndWait(
resourceGroupName,
assetName,
properties,
);
console.log(result);
}
async function main() {
patchAnAsset();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Returns the current status of an async operation.
*
* @summary Returns the current status of an async operation.
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_OperationStatus.json
*/
async function getTheStatusOfAnAsyncOperation() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const location = "testLocation";
const operationId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.operationStatus.get(location, operationId);
console.log(result);
}
async function main() {
getTheStatusOfAnAsyncOperation();
}
main().catch(console.error);

Просмотреть файл

@ -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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to List the operations for the provider
*
* @summary List the operations for the provider
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Operations.json
*/
async function returnsListOfOperations() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
returnsListOfOperations();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,76 @@
# client library samples for JavaScript (Beta)
These sample programs show how to use the JavaScript client libraries for in some common scenarios.
| **File Name** | **Description** |
| --------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [assetEndpointProfilesCreateOrReplaceSample.js][assetendpointprofilescreateorreplacesample] | Create a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_AssetEndpointProfile.json |
| [assetEndpointProfilesDeleteSample.js][assetendpointprofilesdeletesample] | Delete a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_AssetEndpointProfile.json |
| [assetEndpointProfilesGetSample.js][assetendpointprofilesgetsample] | Get a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json |
| [assetEndpointProfilesListByResourceGroupSample.js][assetendpointprofileslistbyresourcegroupsample] | List AssetEndpointProfile resources by resource group x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_ResourceGroup.json |
| [assetEndpointProfilesListBySubscriptionSample.js][assetendpointprofileslistbysubscriptionsample] | List AssetEndpointProfile resources by subscription ID x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_Subscription.json |
| [assetEndpointProfilesUpdateSample.js][assetendpointprofilesupdatesample] | Update a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json |
| [assetsCreateOrReplaceSample.js][assetscreateorreplacesample] | Create a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_With_ExternalAssetId.json |
| [assetsDeleteSample.js][assetsdeletesample] | Delete a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_Asset.json |
| [assetsGetSample.js][assetsgetsample] | Get a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json |
| [assetsListByResourceGroupSample.js][assetslistbyresourcegroupsample] | List Asset resources by resource group x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_ResourceGroup.json |
| [assetsListBySubscriptionSample.js][assetslistbysubscriptionsample] | List Asset resources by subscription ID x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_Subscription.json |
| [assetsUpdateSample.js][assetsupdatesample] | Update a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json |
| [operationStatusGetSample.js][operationstatusgetsample] | Returns the current status of an async operation. x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_OperationStatus.json |
| [operationsListSample.js][operationslistsample] | List the operations for the provider x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Operations.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
3. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node assetEndpointProfilesCreateOrReplaceSample.js
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env DEVICEREGISTRY_SUBSCRIPTION_ID="<deviceregistry subscription id>" DEVICEREGISTRY_RESOURCE_GROUP="<deviceregistry resource group>" node assetEndpointProfilesCreateOrReplaceSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[assetendpointprofilescreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesCreateOrReplaceSample.js
[assetendpointprofilesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesDeleteSample.js
[assetendpointprofilesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesGetSample.js
[assetendpointprofileslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesListByResourceGroupSample.js
[assetendpointprofileslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesListBySubscriptionSample.js
[assetendpointprofilesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetEndpointProfilesUpdateSample.js
[assetscreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsCreateOrReplaceSample.js
[assetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsDeleteSample.js
[assetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsGetSample.js
[assetslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsListByResourceGroupSample.js
[assetslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsListBySubscriptionSample.js
[assetsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/assetsUpdateSample.js
[operationstatusgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/operationStatusGetSample.js
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/javascript/operationsListSample.js
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-deviceregistry?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceregistry/arm-deviceregistry/README.md

Просмотреть файл

@ -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.
const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Create a AssetEndpointProfile
*
* @summary Create a AssetEndpointProfile
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_AssetEndpointProfile.json
*/
async function createAnAssetEndpointProfile() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetEndpointProfileName = "my-assetendpointprofile";
const resource = {
extendedLocation: {
name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1",
type: "CustomLocation",
},
location: "West Europe",
properties: {
targetAddress: "https://www.example.com/myTargetAddress",
userAuthentication: { mode: "Anonymous" },
},
tags: { site: "building-1" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assetEndpointProfiles.beginCreateOrReplaceAndWait(
resourceGroupName,
assetEndpointProfileName,
resource,
);
console.log(result);
}
async function main() {
createAnAssetEndpointProfile();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Delete a AssetEndpointProfile
*
* @summary Delete a AssetEndpointProfile
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_AssetEndpointProfile.json
*/
async function deleteAnAssetEndpointProfile() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetEndpointProfileName = "my-assetendpointprofile";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assetEndpointProfiles.beginDeleteAndWait(
resourceGroupName,
assetEndpointProfileName,
);
console.log(result);
}
async function main() {
deleteAnAssetEndpointProfile();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Get a AssetEndpointProfile
*
* @summary Get a AssetEndpointProfile
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json
*/
async function getAnAssetEndpointProfile() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetEndpointProfileName = "my-assetendpointprofile";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assetEndpointProfiles.get(
resourceGroupName,
assetEndpointProfileName,
);
console.log(result);
}
async function main() {
getAnAssetEndpointProfile();
}
main().catch(console.error);

Просмотреть файл

@ -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.
const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to List AssetEndpointProfile resources by resource group
*
* @summary List AssetEndpointProfile resources by resource group
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_ResourceGroup.json
*/
async function listAssetEndpointProfilesInAResourceGroup() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.assetEndpointProfiles.listByResourceGroup(resourceGroupName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAssetEndpointProfilesInAResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -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.
const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to List AssetEndpointProfile resources by subscription ID
*
* @summary List AssetEndpointProfile resources by subscription ID
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_Subscription.json
*/
async function listAssetEndpointProfilesInASubscription() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.assetEndpointProfiles.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAssetEndpointProfilesInASubscription();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Update a AssetEndpointProfile
*
* @summary Update a AssetEndpointProfile
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json
*/
async function patchAnAssetEndpointProfile() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetEndpointProfileName = "my-assetendpointprofile";
const properties = {
properties: { targetAddress: "https://www.example.com/myTargetAddress" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assetEndpointProfiles.beginUpdateAndWait(
resourceGroupName,
assetEndpointProfileName,
properties,
);
console.log(result);
}
async function main() {
patchAnAssetEndpointProfile();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,247 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Create a Asset
*
* @summary Create a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_With_ExternalAssetId.json
*/
async function createAnAssetWithExternalAssetId() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const resource = {
extendedLocation: {
name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1",
type: "CustomLocation",
},
location: "West Europe",
properties: {
description: "This is a sample Asset",
assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile",
assetType: "MyAssetType",
dataPoints: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1",
observabilityMode: "counter",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2",
observabilityMode: "none",
},
],
defaultDataPointsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
displayName: "AssetDisplayName",
documentationUri: "https://www.example.com/manual",
enabled: true,
events: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3",
observabilityMode: "none",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4",
observabilityMode: "log",
},
],
externalAssetId: "8ZBA6LRHU0A458969",
hardwareRevision: "1.0",
manufacturer: "Contoso",
manufacturerUri: "https://www.contoso.com/manufacturerUri",
model: "ContosoModel",
productCode: "SA34VDG",
serialNumber: "64-103816-519918-8",
softwareRevision: "2.0",
},
tags: { site: "building-1" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginCreateOrReplaceAndWait(
resourceGroupName,
assetName,
resource,
);
console.log(result);
}
/**
* This sample demonstrates how to Create a Asset
*
* @summary Create a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_DisplayName.json
*/
async function createAnAssetWithoutDisplayName() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const resource = {
extendedLocation: {
name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1",
type: "CustomLocation",
},
location: "West Europe",
properties: {
description: "This is a sample Asset",
assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile",
assetType: "MyAssetType",
dataPoints: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1",
observabilityMode: "counter",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2",
observabilityMode: "none",
},
],
defaultDataPointsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
documentationUri: "https://www.example.com/manual",
enabled: true,
events: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3",
observabilityMode: "none",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4",
observabilityMode: "log",
},
],
externalAssetId: "8ZBA6LRHU0A458969",
hardwareRevision: "1.0",
manufacturer: "Contoso",
manufacturerUri: "https://www.contoso.com/manufacturerUri",
model: "ContosoModel",
productCode: "SA34VDG",
serialNumber: "64-103816-519918-8",
softwareRevision: "2.0",
},
tags: { site: "building-1" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginCreateOrReplaceAndWait(
resourceGroupName,
assetName,
resource,
);
console.log(result);
}
/**
* This sample demonstrates how to Create a Asset
*
* @summary Create a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_ExternalAssetId.json
*/
async function createAnAssetWithoutExternalAssetId() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const resource = {
extendedLocation: {
name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1",
type: "CustomLocation",
},
location: "West Europe",
properties: {
description: "This is a sample Asset",
assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile",
assetType: "MyAssetType",
dataPoints: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
dataPointConfiguration: '{"publishingInterval":8,"samplingInterval":8,"queueSize":4}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1",
observabilityMode: "counter",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
dataPointConfiguration: '{"publishingInterval":4,"samplingInterval":4,"queueSize":7}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2",
observabilityMode: "none",
},
],
defaultDataPointsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
defaultEventsConfiguration: '{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
displayName: "AssetDisplayName",
documentationUri: "https://www.example.com/manual",
enabled: true,
events: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
eventConfiguration: '{"publishingInterval":7,"samplingInterval":1,"queueSize":8}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3",
observabilityMode: "none",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
eventConfiguration: '{"publishingInterval":7,"samplingInterval":8,"queueSize":4}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4",
observabilityMode: "log",
},
],
hardwareRevision: "1.0",
manufacturer: "Contoso",
manufacturerUri: "https://www.contoso.com/manufacturerUri",
model: "ContosoModel",
productCode: "SA34VDG",
serialNumber: "64-103816-519918-8",
softwareRevision: "2.0",
},
tags: { site: "building-1" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginCreateOrReplaceAndWait(
resourceGroupName,
assetName,
resource,
);
console.log(result);
}
async function main() {
createAnAssetWithExternalAssetId();
createAnAssetWithoutDisplayName();
createAnAssetWithoutExternalAssetId();
}
main().catch(console.error);

Просмотреть файл

@ -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 { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Delete a Asset
*
* @summary Delete a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_Asset.json
*/
async function deleteAnAsset() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginDeleteAndWait(resourceGroupName, assetName);
console.log(result);
}
async function main() {
deleteAnAsset();
}
main().catch(console.error);

Просмотреть файл

@ -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 { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Get a Asset
*
* @summary Get a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json
*/
async function getAnAsset() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.get(resourceGroupName, assetName);
console.log(result);
}
/**
* This sample demonstrates how to Get a Asset
*
* @summary Get a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset_With_SyncStatus.json
*/
async function getAnAssetWithSyncStatus() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.get(resourceGroupName, assetName);
console.log(result);
}
async function main() {
getAnAsset();
getAnAssetWithSyncStatus();
}
main().catch(console.error);

Просмотреть файл

@ -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.
const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to List Asset resources by resource group
*
* @summary List Asset resources by resource group
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_ResourceGroup.json
*/
async function listAssetsInAResourceGroup() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.assets.listByResourceGroup(resourceGroupName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAssetsInAResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -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.
const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to List Asset resources by subscription ID
*
* @summary List Asset resources by subscription ID
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_Subscription.json
*/
async function listAssetsInASubscription() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.assets.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAssetsInASubscription();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Update a Asset
*
* @summary Update a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json
*/
async function patchAnAsset() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const properties = {
properties: { displayName: "NewAssetDisplayName", enabled: false },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginUpdateAndWait(resourceGroupName, assetName, properties);
console.log(result);
}
async function main() {
patchAnAsset();
}
main().catch(console.error);

Просмотреть файл

@ -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 { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Returns the current status of an async operation.
*
* @summary Returns the current status of an async operation.
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_OperationStatus.json
*/
async function getTheStatusOfAnAsyncOperation() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const location = "testLocation";
const operationId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.operationStatus.get(location, operationId);
console.log(result);
}
async function main() {
getTheStatusOfAnAsyncOperation();
}
main().catch(console.error);

Просмотреть файл

@ -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.
const { DeviceRegistryManagementClient } = require("@azure/arm-deviceregistry");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to List the operations for the provider
*
* @summary List the operations for the provider
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Operations.json
*/
async function returnsListOfOperations() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
returnsListOfOperations();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,32 @@
{
"name": "@azure-samples/arm-deviceregistry-js-beta",
"private": true,
"version": "1.0.0",
"description": " client library samples for JavaScript (Beta)",
"engines": {
"node": ">=18.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/deviceregistry/arm-deviceregistry"
},
"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/deviceregistry/arm-deviceregistry",
"dependencies": {
"@azure/arm-deviceregistry": "next",
"dotenv": "latest",
"@azure/identity": "^4.0.1"
}
}

Просмотреть файл

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,89 @@
# client library samples for TypeScript (Beta)
These sample programs show how to use the TypeScript client libraries for in some common scenarios.
| **File Name** | **Description** |
| --------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [assetEndpointProfilesCreateOrReplaceSample.ts][assetendpointprofilescreateorreplacesample] | Create a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_AssetEndpointProfile.json |
| [assetEndpointProfilesDeleteSample.ts][assetendpointprofilesdeletesample] | Delete a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_AssetEndpointProfile.json |
| [assetEndpointProfilesGetSample.ts][assetendpointprofilesgetsample] | Get a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json |
| [assetEndpointProfilesListByResourceGroupSample.ts][assetendpointprofileslistbyresourcegroupsample] | List AssetEndpointProfile resources by resource group x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_ResourceGroup.json |
| [assetEndpointProfilesListBySubscriptionSample.ts][assetendpointprofileslistbysubscriptionsample] | List AssetEndpointProfile resources by subscription ID x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_Subscription.json |
| [assetEndpointProfilesUpdateSample.ts][assetendpointprofilesupdatesample] | Update a AssetEndpointProfile x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json |
| [assetsCreateOrReplaceSample.ts][assetscreateorreplacesample] | Create a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_With_ExternalAssetId.json |
| [assetsDeleteSample.ts][assetsdeletesample] | Delete a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_Asset.json |
| [assetsGetSample.ts][assetsgetsample] | Get a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json |
| [assetsListByResourceGroupSample.ts][assetslistbyresourcegroupsample] | List Asset resources by resource group x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_ResourceGroup.json |
| [assetsListBySubscriptionSample.ts][assetslistbysubscriptionsample] | List Asset resources by subscription ID x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_Subscription.json |
| [assetsUpdateSample.ts][assetsupdatesample] | Update a Asset x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json |
| [operationStatusGetSample.ts][operationstatusgetsample] | Returns the current status of an async operation. x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_OperationStatus.json |
| [operationsListSample.ts][operationslistsample] | List the operations for the provider x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Operations.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using:
```bash
npm install -g typescript
```
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Compile the samples:
```bash
npm run build
```
3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
4. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node dist/assetEndpointProfilesCreateOrReplaceSample.js
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env DEVICEREGISTRY_SUBSCRIPTION_ID="<deviceregistry subscription id>" DEVICEREGISTRY_RESOURCE_GROUP="<deviceregistry resource group>" node dist/assetEndpointProfilesCreateOrReplaceSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[assetendpointprofilescreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesCreateOrReplaceSample.ts
[assetendpointprofilesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesDeleteSample.ts
[assetendpointprofilesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesGetSample.ts
[assetendpointprofileslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesListByResourceGroupSample.ts
[assetendpointprofileslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesListBySubscriptionSample.ts
[assetendpointprofilesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetEndpointProfilesUpdateSample.ts
[assetscreateorreplacesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsCreateOrReplaceSample.ts
[assetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsDeleteSample.ts
[assetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsGetSample.ts
[assetslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsListByResourceGroupSample.ts
[assetslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsListBySubscriptionSample.ts
[assetsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/assetsUpdateSample.ts
[operationstatusgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/operationStatusGetSample.ts
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/deviceregistry/arm-deviceregistry/samples/v1-beta/typescript/src/operationsListSample.ts
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-deviceregistry?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceregistry/arm-deviceregistry/README.md
[typescript]: https://www.typescriptlang.org/docs/home.html

Просмотреть файл

@ -0,0 +1,41 @@
{
"name": "@azure-samples/arm-deviceregistry-ts-beta",
"private": true,
"version": "1.0.0",
"description": " client library samples for TypeScript (Beta)",
"engines": {
"node": ">=18.0.0"
},
"scripts": {
"build": "tsc",
"prebuild": "rimraf dist/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/deviceregistry/arm-deviceregistry"
},
"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/deviceregistry/arm-deviceregistry",
"dependencies": {
"@azure/arm-deviceregistry": "next",
"dotenv": "latest",
"@azure/identity": "^4.0.1"
},
"devDependencies": {
"@types/node": "^18.0.0",
"typescript": "~5.4.5",
"rimraf": "latest"
}
}

Просмотреть файл

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,59 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
AssetEndpointProfile,
DeviceRegistryManagementClient,
} from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Create a AssetEndpointProfile
*
* @summary Create a AssetEndpointProfile
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_AssetEndpointProfile.json
*/
async function createAnAssetEndpointProfile() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetEndpointProfileName = "my-assetendpointprofile";
const resource: AssetEndpointProfile = {
extendedLocation: {
name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1",
type: "CustomLocation",
},
location: "West Europe",
properties: {
targetAddress: "https://www.example.com/myTargetAddress",
userAuthentication: { mode: "Anonymous" },
},
tags: { site: "building-1" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assetEndpointProfiles.beginCreateOrReplaceAndWait(
resourceGroupName,
assetEndpointProfileName,
resource,
);
console.log(result);
}
async function main() {
createAnAssetEndpointProfile();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Delete a AssetEndpointProfile
*
* @summary Delete a AssetEndpointProfile
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_AssetEndpointProfile.json
*/
async function deleteAnAssetEndpointProfile() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetEndpointProfileName = "my-assetendpointprofile";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assetEndpointProfiles.beginDeleteAndWait(
resourceGroupName,
assetEndpointProfileName,
);
console.log(result);
}
async function main() {
deleteAnAssetEndpointProfile();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get a AssetEndpointProfile
*
* @summary Get a AssetEndpointProfile
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json
*/
async function getAnAssetEndpointProfile() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetEndpointProfileName = "my-assetendpointprofile";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assetEndpointProfiles.get(
resourceGroupName,
assetEndpointProfileName,
);
console.log(result);
}
async function main() {
getAnAssetEndpointProfile();
}
main().catch(console.error);

Просмотреть файл

@ -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.
import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to List AssetEndpointProfile resources by resource group
*
* @summary List AssetEndpointProfile resources by resource group
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_ResourceGroup.json
*/
async function listAssetEndpointProfilesInAResourceGroup() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.assetEndpointProfiles.listByResourceGroup(
resourceGroupName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAssetEndpointProfilesInAResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to List AssetEndpointProfile resources by subscription ID
*
* @summary List AssetEndpointProfile resources by subscription ID
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_Subscription.json
*/
async function listAssetEndpointProfilesInASubscription() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.assetEndpointProfiles.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAssetEndpointProfilesInASubscription();
}
main().catch(console.error);

Просмотреть файл

@ -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.
import {
AssetEndpointProfileUpdate,
DeviceRegistryManagementClient,
} from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Update a AssetEndpointProfile
*
* @summary Update a AssetEndpointProfile
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json
*/
async function patchAnAssetEndpointProfile() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetEndpointProfileName = "my-assetendpointprofile";
const properties: AssetEndpointProfileUpdate = {
properties: { targetAddress: "https://www.example.com/myTargetAddress" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assetEndpointProfiles.beginUpdateAndWait(
resourceGroupName,
assetEndpointProfileName,
properties,
);
console.log(result);
}
async function main() {
patchAnAssetEndpointProfile();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,273 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
Asset,
DeviceRegistryManagementClient,
} from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Create a Asset
*
* @summary Create a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_With_ExternalAssetId.json
*/
async function createAnAssetWithExternalAssetId() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const resource: Asset = {
extendedLocation: {
name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1",
type: "CustomLocation",
},
location: "West Europe",
properties: {
description: "This is a sample Asset",
assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile",
assetType: "MyAssetType",
dataPoints: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
dataPointConfiguration:
'{"publishingInterval":8,"samplingInterval":8,"queueSize":4}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1",
observabilityMode: "counter",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
dataPointConfiguration:
'{"publishingInterval":4,"samplingInterval":4,"queueSize":7}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2",
observabilityMode: "none",
},
],
defaultDataPointsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
defaultEventsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
displayName: "AssetDisplayName",
documentationUri: "https://www.example.com/manual",
enabled: true,
events: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
eventConfiguration:
'{"publishingInterval":7,"samplingInterval":1,"queueSize":8}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3",
observabilityMode: "none",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
eventConfiguration:
'{"publishingInterval":7,"samplingInterval":8,"queueSize":4}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4",
observabilityMode: "log",
},
],
externalAssetId: "8ZBA6LRHU0A458969",
hardwareRevision: "1.0",
manufacturer: "Contoso",
manufacturerUri: "https://www.contoso.com/manufacturerUri",
model: "ContosoModel",
productCode: "SA34VDG",
serialNumber: "64-103816-519918-8",
softwareRevision: "2.0",
},
tags: { site: "building-1" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginCreateOrReplaceAndWait(
resourceGroupName,
assetName,
resource,
);
console.log(result);
}
/**
* This sample demonstrates how to Create a Asset
*
* @summary Create a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_DisplayName.json
*/
async function createAnAssetWithoutDisplayName() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const resource: Asset = {
extendedLocation: {
name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1",
type: "CustomLocation",
},
location: "West Europe",
properties: {
description: "This is a sample Asset",
assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile",
assetType: "MyAssetType",
dataPoints: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
dataPointConfiguration:
'{"publishingInterval":8,"samplingInterval":8,"queueSize":4}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1",
observabilityMode: "counter",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
dataPointConfiguration:
'{"publishingInterval":4,"samplingInterval":4,"queueSize":7}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2",
observabilityMode: "none",
},
],
defaultDataPointsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
defaultEventsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
documentationUri: "https://www.example.com/manual",
enabled: true,
events: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
eventConfiguration:
'{"publishingInterval":7,"samplingInterval":1,"queueSize":8}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3",
observabilityMode: "none",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
eventConfiguration:
'{"publishingInterval":7,"samplingInterval":8,"queueSize":4}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4",
observabilityMode: "log",
},
],
externalAssetId: "8ZBA6LRHU0A458969",
hardwareRevision: "1.0",
manufacturer: "Contoso",
manufacturerUri: "https://www.contoso.com/manufacturerUri",
model: "ContosoModel",
productCode: "SA34VDG",
serialNumber: "64-103816-519918-8",
softwareRevision: "2.0",
},
tags: { site: "building-1" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginCreateOrReplaceAndWait(
resourceGroupName,
assetName,
resource,
);
console.log(result);
}
/**
* This sample demonstrates how to Create a Asset
*
* @summary Create a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_ExternalAssetId.json
*/
async function createAnAssetWithoutExternalAssetId() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const resource: Asset = {
extendedLocation: {
name: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1",
type: "CustomLocation",
},
location: "West Europe",
properties: {
description: "This is a sample Asset",
assetEndpointProfileUri: "https://www.example.com/myAssetEndpointProfile",
assetType: "MyAssetType",
dataPoints: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
dataPointConfiguration:
'{"publishingInterval":8,"samplingInterval":8,"queueSize":4}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1",
observabilityMode: "counter",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
dataPointConfiguration:
'{"publishingInterval":4,"samplingInterval":4,"queueSize":7}',
dataSource: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2",
observabilityMode: "none",
},
],
defaultDataPointsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
defaultEventsConfiguration:
'{"publishingInterval":10,"samplingInterval":15,"queueSize":20}',
displayName: "AssetDisplayName",
documentationUri: "https://www.example.com/manual",
enabled: true,
events: [
{
capabilityId: "dtmi:com:example:Thermostat:__temperature;1",
eventConfiguration:
'{"publishingInterval":7,"samplingInterval":1,"queueSize":8}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3",
observabilityMode: "none",
},
{
capabilityId: "dtmi:com:example:Thermostat:__pressure;1",
eventConfiguration:
'{"publishingInterval":7,"samplingInterval":8,"queueSize":4}',
eventNotifier: "nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4",
observabilityMode: "log",
},
],
hardwareRevision: "1.0",
manufacturer: "Contoso",
manufacturerUri: "https://www.contoso.com/manufacturerUri",
model: "ContosoModel",
productCode: "SA34VDG",
serialNumber: "64-103816-519918-8",
softwareRevision: "2.0",
},
tags: { site: "building-1" },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginCreateOrReplaceAndWait(
resourceGroupName,
assetName,
resource,
);
console.log(result);
}
async function main() {
createAnAssetWithExternalAssetId();
createAnAssetWithoutDisplayName();
createAnAssetWithoutExternalAssetId();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Delete a Asset
*
* @summary Delete a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_Asset.json
*/
async function deleteAnAsset() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginDeleteAndWait(
resourceGroupName,
assetName,
);
console.log(result);
}
async function main() {
deleteAnAsset();
}
main().catch(console.error);

Просмотреть файл

@ -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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get a Asset
*
* @summary Get a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json
*/
async function getAnAsset() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.get(resourceGroupName, assetName);
console.log(result);
}
/**
* This sample demonstrates how to Get a Asset
*
* @summary Get a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset_With_SyncStatus.json
*/
async function getAnAssetWithSyncStatus() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.get(resourceGroupName, assetName);
console.log(result);
}
async function main() {
getAnAsset();
getAnAssetWithSyncStatus();
}
main().catch(console.error);

Просмотреть файл

@ -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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to List Asset resources by resource group
*
* @summary List Asset resources by resource group
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_ResourceGroup.json
*/
async function listAssetsInAResourceGroup() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.assets.listByResourceGroup(resourceGroupName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAssetsInAResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to List Asset resources by subscription ID
*
* @summary List Asset resources by subscription ID
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_Subscription.json
*/
async function listAssetsInASubscription() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.assets.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listAssetsInASubscription();
}
main().catch(console.error);

Просмотреть файл

@ -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.
import {
AssetUpdate,
DeviceRegistryManagementClient,
} from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Update a Asset
*
* @summary Update a Asset
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json
*/
async function patchAnAsset() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const resourceGroupName =
process.env["DEVICEREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const assetName = "my-asset";
const properties: AssetUpdate = {
properties: { displayName: "NewAssetDisplayName", enabled: false },
};
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.assets.beginUpdateAndWait(
resourceGroupName,
assetName,
properties,
);
console.log(result);
}
async function main() {
patchAnAsset();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Returns the current status of an async operation.
*
* @summary Returns the current status of an async operation.
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_OperationStatus.json
*/
async function getTheStatusOfAnAsyncOperation() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const location = "testLocation";
const operationId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const result = await client.operationStatus.get(location, operationId);
console.log(result);
}
async function main() {
getTheStatusOfAnAsyncOperation();
}
main().catch(console.error);

Просмотреть файл

@ -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 { DeviceRegistryManagementClient } from "@azure/arm-deviceregistry";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to List the operations for the provider
*
* @summary List the operations for the provider
* x-ms-original-file: specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Operations.json
*/
async function returnsListOfOperations() {
const subscriptionId =
process.env["DEVICEREGISTRY_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new DeviceRegistryManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
returnsListOfOperations();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"alwaysStrict": true,
"outDir": "dist",
"rootDir": "src"
},
"include": [
"src/**.ts"
]
}

Просмотреть файл

@ -0,0 +1,157 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import * as coreClient from "@azure/core-client";
import * as coreRestPipeline from "@azure/core-rest-pipeline";
import {
PipelineRequest,
PipelineResponse,
SendRequest,
} from "@azure/core-rest-pipeline";
import * as coreAuth from "@azure/core-auth";
import {
OperationsImpl,
AssetEndpointProfilesImpl,
AssetsImpl,
OperationStatusImpl,
} from "./operations";
import {
Operations,
AssetEndpointProfiles,
Assets,
OperationStatus,
} from "./operationsInterfaces";
import { DeviceRegistryManagementClientOptionalParams } from "./models";
export class DeviceRegistryManagementClient extends coreClient.ServiceClient {
$host: string;
apiVersion: string;
subscriptionId: string;
/**
* Initializes a new instance of the DeviceRegistryManagementClient class.
* @param credentials Subscription credentials which uniquely identify client subscription.
* @param subscriptionId The ID of the target subscription.
* @param options The parameter options
*/
constructor(
credentials: coreAuth.TokenCredential,
subscriptionId: string,
options?: DeviceRegistryManagementClientOptionalParams,
) {
if (credentials === undefined) {
throw new Error("'credentials' cannot be null");
}
if (subscriptionId === undefined) {
throw new Error("'subscriptionId' cannot be null");
}
// Initializing default values for options
if (!options) {
options = {};
}
const defaults: DeviceRegistryManagementClientOptionalParams = {
requestContentType: "application/json; charset=utf-8",
credential: credentials,
};
const packageDetails = `azsdk-js-arm-deviceregistry/1.0.0-beta.1`;
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
: `${packageDetails}`;
const optionsWithDefaults = {
...defaults,
...options,
userAgentOptions: {
userAgentPrefix,
},
endpoint:
options.endpoint ?? options.baseUri ?? "https://management.azure.com",
};
super(optionsWithDefaults);
let bearerTokenAuthenticationPolicyFound: boolean = false;
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] =
options.pipeline.getOrderedPolicies();
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
(pipelinePolicy) =>
pipelinePolicy.name ===
coreRestPipeline.bearerTokenAuthenticationPolicyName,
);
}
if (
!options ||
!options.pipeline ||
options.pipeline.getOrderedPolicies().length == 0 ||
!bearerTokenAuthenticationPolicyFound
) {
this.pipeline.removePolicy({
name: coreRestPipeline.bearerTokenAuthenticationPolicyName,
});
this.pipeline.addPolicy(
coreRestPipeline.bearerTokenAuthenticationPolicy({
credential: credentials,
scopes:
optionsWithDefaults.credentialScopes ??
`${optionsWithDefaults.endpoint}/.default`,
challengeCallbacks: {
authorizeRequestOnChallenge:
coreClient.authorizeRequestOnClaimChallenge,
},
}),
);
}
// Parameter assignments
this.subscriptionId = subscriptionId;
// Assigning values to Constant parameters
this.$host = options.$host || "https://management.azure.com";
this.apiVersion = options.apiVersion || "2023-11-01-preview";
this.operations = new OperationsImpl(this);
this.assetEndpointProfiles = new AssetEndpointProfilesImpl(this);
this.assets = new AssetsImpl(this);
this.operationStatus = new OperationStatusImpl(this);
this.addCustomApiVersionPolicy(options.apiVersion);
}
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
private addCustomApiVersionPolicy(apiVersion?: string) {
if (!apiVersion) {
return;
}
const apiVersionPolicy = {
name: "CustomApiVersionPolicy",
async sendRequest(
request: PipelineRequest,
next: SendRequest,
): Promise<PipelineResponse> {
const param = request.url.split("?");
if (param.length > 1) {
const newParams = param[1].split("&").map((item) => {
if (item.indexOf("api-version") > -1) {
return "api-version=" + apiVersion;
} else {
return item;
}
});
request.url = param[0] + "?" + newParams.join("&");
}
return next(request);
},
};
this.pipeline.addPolicy(apiVersionPolicy);
}
operations: Operations;
assetEndpointProfiles: AssetEndpointProfiles;
assets: Assets;
operationStatus: OperationStatus;
}

Просмотреть файл

@ -0,0 +1,13 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
/// <reference lib="esnext.asynciterable" />
export { getContinuationToken } from "./pagingHelper";
export * from "./models";
export { DeviceRegistryManagementClient } from "./deviceRegistryManagementClient";
export * from "./operationsInterfaces";

Просмотреть файл

@ -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 { AbortSignalLike } from "@azure/abort-controller";
import { LongRunningOperation, LroResponse } from "@azure/core-lro";
export function createLroSpec<T>(inputs: {
sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;
args: Record<string, unknown>;
spec: {
readonly requestBody?: unknown;
readonly path?: string;
readonly httpMethod: string;
} & Record<string, any>;
}): LongRunningOperation<T> {
const { args, spec, sendOperationFn } = inputs;
return {
requestMethod: spec.httpMethod,
requestPath: spec.path!,
sendInitialRequest: () => sendOperationFn(args, spec),
sendPollRequest: (
path: string,
options?: { abortSignal?: AbortSignalLike },
) => {
const { requestBody, ...restSpec } = spec;
return sendOperationFn(args, {
...restSpec,
httpMethod: "GET",
path,
abortSignal: options?.abortSignal,
});
},
};
}

Просмотреть файл

@ -0,0 +1,866 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import * as coreClient from "@azure/core-client";
/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */
export interface OperationListResult {
/**
* List of operations supported by the resource provider
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly value?: Operation[];
/**
* URL to get the next set of operation list results (if there are any).
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly nextLink?: string;
}
/** Details of a REST API operation, returned from the Resource Provider Operations API */
export interface Operation {
/**
* The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action"
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly name?: string;
/**
* Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly isDataAction?: boolean;
/** Localized display information for this particular operation. */
display?: OperationDisplay;
/**
* The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system"
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly origin?: Origin;
/**
* Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly actionType?: ActionType;
}
/** Localized display information for this particular operation. */
export interface OperationDisplay {
/**
* The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute".
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly provider?: string;
/**
* The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections".
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly resource?: string;
/**
* The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine".
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly operation?: string;
/**
* The short, localized friendly description of the operation; suitable for tool tips and detailed views.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly description?: string;
}
/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */
export interface ErrorResponse {
/** The error object. */
error?: ErrorDetail;
}
/** The error detail. */
export interface ErrorDetail {
/**
* The error code.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly code?: string;
/**
* The error message.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly message?: string;
/**
* The error target.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly target?: string;
/**
* The error details.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly details?: ErrorDetail[];
/**
* The error additional info.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly additionalInfo?: ErrorAdditionalInfo[];
}
/** The resource management error additional info. */
export interface ErrorAdditionalInfo {
/**
* The additional info type.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly type?: string;
/**
* The additional info.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly info?: Record<string, unknown>;
}
/** The response of a AssetEndpointProfile list operation. */
export interface AssetEndpointProfileListResult {
/** The AssetEndpointProfile items on this page */
value: AssetEndpointProfile[];
/** The link to the next page of items */
nextLink?: string;
}
/** Defines the Asset Endpoint Profile properties. */
export interface AssetEndpointProfileProperties {
/**
* Globally unique, immutable, non-reusable id.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly uuid?: string;
/** The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. */
targetAddress: string;
/** Defines the client authentication mechanism to the server. */
userAuthentication?: UserAuthentication;
/** Defines the authentication mechanism for the southbound connector connecting to the shop floor/OT device. */
transportAuthentication?: TransportAuthentication;
/** Contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). */
additionalConfiguration?: string;
/**
* Provisioning state of the resource.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly provisioningState?: ProvisioningState;
}
/** Definition of the client authentication mechanism to the server. */
export interface UserAuthentication {
/** Defines the mode to authenticate the user of the client at the server. */
mode: UserAuthenticationMode;
/** Defines the username and password references when UsernamePassword user authentication mode is selected. */
usernamePasswordCredentials?: UsernamePasswordCredentials;
/** Defines the certificate reference when Certificate user authentication mode is selected. */
x509Credentials?: X509Credentials;
}
/** The credentials for authentication mode UsernamePassword. */
export interface UsernamePasswordCredentials {
/** A reference to secret containing the username. */
usernameReference: string;
/** A reference to secret containing the password. */
passwordReference: string;
}
/** The x509 certificate for authentication mode Certificate. */
export interface X509Credentials {
/** A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). */
certificateReference: string;
}
/** Definition of the authentication mechanism for the southbound connector. */
export interface TransportAuthentication {
/** Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. */
ownCertificates: OwnCertificate[];
}
/** Certificate or private key that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. */
export interface OwnCertificate {
/** Certificate thumbprint. */
certThumbprint?: string;
/** Secret Reference name (cert and private key). */
certSecretReference?: string;
/** Secret Reference Name (Pfx or Pem password). */
certPasswordReference?: string;
}
/** The extended location. */
export interface ExtendedLocation {
/** The extended location type. */
type: string;
/** The extended location name. */
name: string;
}
/** Common fields that are returned in the response for all Azure Resource Manager resources */
export interface Resource {
/**
* Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly id?: string;
/**
* The name of the resource
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly name?: string;
/**
* The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly type?: string;
/**
* Azure Resource Manager metadata containing createdBy and modifiedBy information.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly systemData?: SystemData;
}
/** Metadata pertaining to creation and last modification of the resource. */
export interface SystemData {
/** The identity that created the resource. */
createdBy?: string;
/** The type of identity that created the resource. */
createdByType?: CreatedByType;
/** The timestamp of resource creation (UTC). */
createdAt?: Date;
/** The identity that last modified the resource. */
lastModifiedBy?: string;
/** The type of identity that last modified the resource. */
lastModifiedByType?: CreatedByType;
/** The timestamp of resource last modification (UTC) */
lastModifiedAt?: Date;
}
/** The response of a Asset list operation. */
export interface AssetListResult {
/** The Asset items on this page */
value: Asset[];
/** The link to the next page of items */
nextLink?: string;
}
/** Defines the asset properties. */
export interface AssetProperties {
/**
* Globally unique, immutable, non-reusable id.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly uuid?: string;
/** Resource path to asset type (model) definition. */
assetType?: string;
/** Enabled/Disabled status of the asset. */
enabled?: boolean;
/** Asset id provided by the customer. */
externalAssetId?: string;
/** Human-readable display name. */
displayName?: string;
/** Human-readable description of the asset. */
description?: string;
/** A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must have the format <ModuleCR.metadata.namespace>/<ModuleCR.metadata.name>. */
assetEndpointProfileUri: string;
/**
* An integer that is incremented each time the resource is modified.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly version?: number;
/** Asset manufacturer name. */
manufacturer?: string;
/** Asset manufacturer URI. */
manufacturerUri?: string;
/** Asset model name. */
model?: string;
/** Asset product code. */
productCode?: string;
/** Revision number of the hardware. */
hardwareRevision?: string;
/** Revision number of the software. */
softwareRevision?: string;
/** Reference to the documentation. */
documentationUri?: string;
/** Asset serial number. */
serialNumber?: string;
/** A set of key-value pairs that contain custom attributes set by the customer. */
attributes?: { [propertyName: string]: any };
/** Protocol-specific default configuration for all data points. Each data point can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. */
defaultDataPointsConfiguration?: string;
/** Protocol-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. */
defaultEventsConfiguration?: string;
/** Array of data points that are part of the asset. Each data point can reference an asset type capability and have per-data point configuration. See below for more details for the definition of the dataPoints element. */
dataPoints?: DataPoint[];
/** Array of events that are part of the asset. Each event can reference an asset type capability and have per-event configuration. See below for more details about the definition of the events element. */
events?: Event[];
/**
* Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes status property for custom resources.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly status?: AssetStatus;
/**
* Provisioning state of the resource.
* NOTE: This property will not be serialized. It can only be populated by the server.
*/
readonly provisioningState?: ProvisioningState;
}
/** Defines the data point properties. */
export interface DataPoint {
/** The name of the data point. */
name?: string;
/** The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the asset. */
dataSource: string;
/** The path to the type definition of the capability (e.g. DTMI, OPC UA information model node id, etc.), for example dtmi:com:example:Robot:_contents:__prop1;1. */
capabilityId?: string;
/** An indication of how the data point should be mapped to OpenTelemetry. */
observabilityMode?: DataPointsObservabilityMode;
/** Protocol-specific configuration for the data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. */
dataPointConfiguration?: string;
}
/** Defines the event properties. */
export interface Event {
/** The name of the event. */
name?: string;
/** The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the asset. */
eventNotifier: string;
/** The path to the type definition of the capability (e.g. DTMI, OPC UA information model node id, etc.), for example dtmi:com:example:Robot:_contents:__prop1;1. */
capabilityId?: string;
/** An indication of how the event should be mapped to OpenTelemetry. */
observabilityMode?: EventsObservabilityMode;
/** Protocol-specific configuration for the event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. */
eventConfiguration?: string;
}
/** Defines the asset status properties. */
export interface AssetStatus {
/** Array object to transfer and persist errors that originate from the Edge. */
errors?: AssetStatusError[];
/** A read only incremental counter indicating the number of times the configuration has been modified from the perspective of the current actual (Edge) state of the Asset. Edge would be the only writer of this value and would sync back up to the cloud. In steady state, this should equal version. */
version?: number;
}
/** Defines the asset status error properties. */
export interface AssetStatusError {
/** Error code for classification of errors (ex: 400, 404, 500, etc.). */
code?: number;
/** Human readable helpful error message to provide additional context for error (ex: “capability Id 'foo' does not exist”). */
message?: string;
}
/** The current status of an async operation. */
export interface OperationStatusResult {
/** Fully qualified ID for the async operation. */
id?: string;
/** Name of the async operation. */
name?: string;
/** Operation status. */
status: string;
/** Percent of the operation that is complete. */
percentComplete?: number;
/** The start time of the operation. */
startTime?: Date;
/** The end time of the operation. */
endTime?: Date;
/** The operations list. */
operations?: OperationStatusResult[];
/** If present, details of the operation error. */
error?: ErrorDetail;
}
/** The type used for update operations of the AssetEndpointProfile. */
export interface AssetEndpointProfileUpdate {
/** Resource tags. */
tags?: { [propertyName: string]: string };
/** The updatable properties of the AssetEndpointProfile. */
properties?: AssetEndpointProfileUpdateProperties;
}
/** The updatable properties of the AssetEndpointProfile. */
export interface AssetEndpointProfileUpdateProperties {
/** The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. */
targetAddress?: string;
/** Defines the client authentication mechanism to the server. */
userAuthentication?: UserAuthenticationUpdate;
/** Defines the authentication mechanism for the southbound connector connecting to the shop floor/OT device. */
transportAuthentication?: TransportAuthenticationUpdate;
/** Contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). */
additionalConfiguration?: string;
}
/** Definition of the client authentication mechanism to the server. */
export interface UserAuthenticationUpdate {
/** Defines the mode to authenticate the user of the client at the server. */
mode?: UserAuthenticationMode;
/** Defines the username and password references when UsernamePassword user authentication mode is selected. */
usernamePasswordCredentials?: UsernamePasswordCredentialsUpdate;
/** Defines the certificate reference when Certificate user authentication mode is selected. */
x509Credentials?: X509CredentialsUpdate;
}
/** The credentials for authentication mode UsernamePassword. */
export interface UsernamePasswordCredentialsUpdate {
/** A reference to secret containing the username. */
usernameReference?: string;
/** A reference to secret containing the password. */
passwordReference?: string;
}
/** The x509 certificate for authentication mode Certificate. */
export interface X509CredentialsUpdate {
/** A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). */
certificateReference?: string;
}
/** Definition of the authentication mechanism for the southbound connector. */
export interface TransportAuthenticationUpdate {
/** Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. */
ownCertificates?: OwnCertificate[];
}
/** The type used for update operations of the Asset. */
export interface AssetUpdate {
/** Resource tags. */
tags?: { [propertyName: string]: string };
/** The updatable properties of the Asset. */
properties?: AssetUpdateProperties;
}
/** The updatable properties of the Asset. */
export interface AssetUpdateProperties {
/** Resource path to asset type (model) definition. */
assetType?: string;
/** Enabled/Disabled status of the asset. */
enabled?: boolean;
/** Human-readable display name. */
displayName?: string;
/** Human-readable description of the asset. */
description?: string;
/** Asset manufacturer name. */
manufacturer?: string;
/** Asset manufacturer URI. */
manufacturerUri?: string;
/** Asset model name. */
model?: string;
/** Asset product code. */
productCode?: string;
/** Revision number of the hardware. */
hardwareRevision?: string;
/** Revision number of the software. */
softwareRevision?: string;
/** Reference to the documentation. */
documentationUri?: string;
/** Asset serial number. */
serialNumber?: string;
/** A set of key-value pairs that contain custom attributes set by the customer. */
attributes?: { [propertyName: string]: any };
/** Protocol-specific default configuration for all data points. Each data point can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. */
defaultDataPointsConfiguration?: string;
/** Protocol-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol. */
defaultEventsConfiguration?: string;
/** Array of data points that are part of the asset. Each data point can reference an asset type capability and have per-data point configuration. See below for more details for the definition of the dataPoints element. */
dataPoints?: DataPoint[];
/** Array of events that are part of the asset. Each event can reference an asset type capability and have per-event configuration. See below for more details about the definition of the events element. */
events?: Event[];
}
/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */
export interface TrackedResource extends Resource {
/** Resource tags. */
tags?: { [propertyName: string]: string };
/** The geo-location where the resource lives */
location: string;
}
/** Asset Endpoint Profile definition. */
export interface AssetEndpointProfile extends TrackedResource {
/** The resource-specific properties for this resource. */
properties?: AssetEndpointProfileProperties;
/** The extended location. */
extendedLocation: ExtendedLocation;
}
/** Asset definition. */
export interface Asset extends TrackedResource {
/** The resource-specific properties for this resource. */
properties?: AssetProperties;
/** The extended location. */
extendedLocation: ExtendedLocation;
}
/** Defines headers for AssetEndpointProfiles_createOrReplace operation. */
export interface AssetEndpointProfilesCreateOrReplaceHeaders {
/** The Retry-After header can indicate how long the client should wait before polling the operation status. */
retryAfter?: number;
}
/** Defines headers for AssetEndpointProfiles_update operation. */
export interface AssetEndpointProfilesUpdateHeaders {
/** The Location header contains the URL where the status of the long running operation can be checked. */
location?: string;
/** The Retry-After header can indicate how long the client should wait before polling the operation status. */
retryAfter?: number;
}
/** Defines headers for AssetEndpointProfiles_delete operation. */
export interface AssetEndpointProfilesDeleteHeaders {
/** The Location header contains the URL where the status of the long running operation can be checked. */
location?: string;
/** The Retry-After header can indicate how long the client should wait before polling the operation status. */
retryAfter?: number;
}
/** Defines headers for Assets_createOrReplace operation. */
export interface AssetsCreateOrReplaceHeaders {
/** The Retry-After header can indicate how long the client should wait before polling the operation status. */
retryAfter?: number;
}
/** Defines headers for Assets_update operation. */
export interface AssetsUpdateHeaders {
/** The Location header contains the URL where the status of the long running operation can be checked. */
location?: string;
/** The Retry-After header can indicate how long the client should wait before polling the operation status. */
retryAfter?: number;
}
/** Defines headers for Assets_delete operation. */
export interface AssetsDeleteHeaders {
/** The Location header contains the URL where the status of the long running operation can be checked. */
location?: string;
/** The Retry-After header can indicate how long the client should wait before polling the operation status. */
retryAfter?: number;
}
/** Known values of {@link Origin} that the service accepts. */
export enum KnownOrigin {
/** User */
User = "user",
/** System */
System = "system",
/** UserSystem */
UserSystem = "user,system",
}
/**
* Defines values for Origin. \
* {@link KnownOrigin} can be used interchangeably with Origin,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **user** \
* **system** \
* **user,system**
*/
export type Origin = string;
/** Known values of {@link ActionType} that the service accepts. */
export enum KnownActionType {
/** Internal */
Internal = "Internal",
}
/**
* Defines values for ActionType. \
* {@link KnownActionType} can be used interchangeably with ActionType,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **Internal**
*/
export type ActionType = string;
/** Known values of {@link UserAuthenticationMode} that the service accepts. */
export enum KnownUserAuthenticationMode {
/** The user authentication mode is anonymous. */
Anonymous = "Anonymous",
/** The user authentication mode is an x509 certificate. */
Certificate = "Certificate",
/** The user authentication mode is a username and password. */
UsernamePassword = "UsernamePassword",
}
/**
* Defines values for UserAuthenticationMode. \
* {@link KnownUserAuthenticationMode} can be used interchangeably with UserAuthenticationMode,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **Anonymous**: The user authentication mode is anonymous. \
* **Certificate**: The user authentication mode is an x509 certificate. \
* **UsernamePassword**: The user authentication mode is a username and password.
*/
export type UserAuthenticationMode = string;
/** Known values of {@link ProvisioningState} that the service accepts. */
export enum KnownProvisioningState {
/** Resource has been created. */
Succeeded = "Succeeded",
/** Resource creation failed. */
Failed = "Failed",
/** Resource creation was canceled. */
Canceled = "Canceled",
/** Resource has been accepted by the server. */
Accepted = "Accepted",
}
/**
* Defines values for ProvisioningState. \
* {@link KnownProvisioningState} can be used interchangeably with ProvisioningState,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **Succeeded**: Resource has been created. \
* **Failed**: Resource creation failed. \
* **Canceled**: Resource creation was canceled. \
* **Accepted**: Resource has been accepted by the server.
*/
export type ProvisioningState = string;
/** Known values of {@link CreatedByType} that the service accepts. */
export enum KnownCreatedByType {
/** User */
User = "User",
/** Application */
Application = "Application",
/** ManagedIdentity */
ManagedIdentity = "ManagedIdentity",
/** Key */
Key = "Key",
}
/**
* Defines values for CreatedByType. \
* {@link KnownCreatedByType} can be used interchangeably with CreatedByType,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **User** \
* **Application** \
* **ManagedIdentity** \
* **Key**
*/
export type CreatedByType = string;
/** Known values of {@link DataPointsObservabilityMode} that the service accepts. */
export enum KnownDataPointsObservabilityMode {
/** No mapping to OpenTelemetry. */
None = "none",
/** Map as counter to OpenTelemetry. */
Counter = "counter",
/** Map as gauge to OpenTelemetry. */
Gauge = "gauge",
/** Map as histogram to OpenTelemetry. */
Histogram = "histogram",
/** Map as log to OpenTelemetry. */
Log = "log",
}
/**
* Defines values for DataPointsObservabilityMode. \
* {@link KnownDataPointsObservabilityMode} can be used interchangeably with DataPointsObservabilityMode,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **none**: No mapping to OpenTelemetry. \
* **counter**: Map as counter to OpenTelemetry. \
* **gauge**: Map as gauge to OpenTelemetry. \
* **histogram**: Map as histogram to OpenTelemetry. \
* **log**: Map as log to OpenTelemetry.
*/
export type DataPointsObservabilityMode = string;
/** Known values of {@link EventsObservabilityMode} that the service accepts. */
export enum KnownEventsObservabilityMode {
/** No mapping to OpenTelemetry. */
None = "none",
/** Map as log to OpenTelemetry. */
Log = "log",
}
/**
* Defines values for EventsObservabilityMode. \
* {@link KnownEventsObservabilityMode} can be used interchangeably with EventsObservabilityMode,
* this enum contains the known values that the service supports.
* ### Known values supported by the service
* **none**: No mapping to OpenTelemetry. \
* **log**: Map as log to OpenTelemetry.
*/
export type EventsObservabilityMode = string;
/** Optional parameters. */
export interface OperationsListOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the list operation. */
export type OperationsListResponse = OperationListResult;
/** Optional parameters. */
export interface OperationsListNextOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listNext operation. */
export type OperationsListNextResponse = OperationListResult;
/** Optional parameters. */
export interface AssetEndpointProfilesListBySubscriptionOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listBySubscription operation. */
export type AssetEndpointProfilesListBySubscriptionResponse =
AssetEndpointProfileListResult;
/** Optional parameters. */
export interface AssetEndpointProfilesListByResourceGroupOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listByResourceGroup operation. */
export type AssetEndpointProfilesListByResourceGroupResponse =
AssetEndpointProfileListResult;
/** Optional parameters. */
export interface AssetEndpointProfilesGetOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the get operation. */
export type AssetEndpointProfilesGetResponse = AssetEndpointProfile;
/** Optional parameters. */
export interface AssetEndpointProfilesCreateOrReplaceOptionalParams
extends coreClient.OperationOptions {
/** Delay to wait until next poll, in milliseconds. */
updateIntervalInMs?: number;
/** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */
resumeFrom?: string;
}
/** Contains response data for the createOrReplace operation. */
export type AssetEndpointProfilesCreateOrReplaceResponse = AssetEndpointProfile;
/** Optional parameters. */
export interface AssetEndpointProfilesUpdateOptionalParams
extends coreClient.OperationOptions {
/** Delay to wait until next poll, in milliseconds. */
updateIntervalInMs?: number;
/** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */
resumeFrom?: string;
}
/** Contains response data for the update operation. */
export type AssetEndpointProfilesUpdateResponse = AssetEndpointProfile;
/** Optional parameters. */
export interface AssetEndpointProfilesDeleteOptionalParams
extends coreClient.OperationOptions {
/** Delay to wait until next poll, in milliseconds. */
updateIntervalInMs?: number;
/** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */
resumeFrom?: string;
}
/** Contains response data for the delete operation. */
export type AssetEndpointProfilesDeleteResponse =
AssetEndpointProfilesDeleteHeaders;
/** Optional parameters. */
export interface AssetEndpointProfilesListBySubscriptionNextOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listBySubscriptionNext operation. */
export type AssetEndpointProfilesListBySubscriptionNextResponse =
AssetEndpointProfileListResult;
/** Optional parameters. */
export interface AssetEndpointProfilesListByResourceGroupNextOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listByResourceGroupNext operation. */
export type AssetEndpointProfilesListByResourceGroupNextResponse =
AssetEndpointProfileListResult;
/** Optional parameters. */
export interface AssetsListBySubscriptionOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listBySubscription operation. */
export type AssetsListBySubscriptionResponse = AssetListResult;
/** Optional parameters. */
export interface AssetsListByResourceGroupOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listByResourceGroup operation. */
export type AssetsListByResourceGroupResponse = AssetListResult;
/** Optional parameters. */
export interface AssetsGetOptionalParams extends coreClient.OperationOptions {}
/** Contains response data for the get operation. */
export type AssetsGetResponse = Asset;
/** Optional parameters. */
export interface AssetsCreateOrReplaceOptionalParams
extends coreClient.OperationOptions {
/** Delay to wait until next poll, in milliseconds. */
updateIntervalInMs?: number;
/** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */
resumeFrom?: string;
}
/** Contains response data for the createOrReplace operation. */
export type AssetsCreateOrReplaceResponse = Asset;
/** Optional parameters. */
export interface AssetsUpdateOptionalParams
extends coreClient.OperationOptions {
/** Delay to wait until next poll, in milliseconds. */
updateIntervalInMs?: number;
/** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */
resumeFrom?: string;
}
/** Contains response data for the update operation. */
export type AssetsUpdateResponse = Asset;
/** Optional parameters. */
export interface AssetsDeleteOptionalParams
extends coreClient.OperationOptions {
/** Delay to wait until next poll, in milliseconds. */
updateIntervalInMs?: number;
/** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */
resumeFrom?: string;
}
/** Contains response data for the delete operation. */
export type AssetsDeleteResponse = AssetsDeleteHeaders;
/** Optional parameters. */
export interface AssetsListBySubscriptionNextOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listBySubscriptionNext operation. */
export type AssetsListBySubscriptionNextResponse = AssetListResult;
/** Optional parameters. */
export interface AssetsListByResourceGroupNextOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the listByResourceGroupNext operation. */
export type AssetsListByResourceGroupNextResponse = AssetListResult;
/** Optional parameters. */
export interface OperationStatusGetOptionalParams
extends coreClient.OperationOptions {}
/** Contains response data for the get operation. */
export type OperationStatusGetResponse = OperationStatusResult;
/** Optional parameters. */
export interface DeviceRegistryManagementClientOptionalParams
extends coreClient.ServiceClientOptions {
/** server parameter */
$host?: string;
/** Api Version */
apiVersion?: string;
/** Overrides client endpoint. */
endpoint?: string;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,188 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import {
OperationParameter,
OperationURLParameter,
OperationQueryParameter,
} from "@azure/core-client";
import {
AssetEndpointProfile as AssetEndpointProfileMapper,
AssetEndpointProfileUpdate as AssetEndpointProfileUpdateMapper,
Asset as AssetMapper,
AssetUpdate as AssetUpdateMapper,
} from "../models/mappers";
export const accept: OperationParameter = {
parameterPath: "accept",
mapper: {
defaultValue: "application/json",
isConstant: true,
serializedName: "Accept",
type: {
name: "String",
},
},
};
export const $host: OperationURLParameter = {
parameterPath: "$host",
mapper: {
serializedName: "$host",
required: true,
type: {
name: "String",
},
},
skipEncoding: true,
};
export const apiVersion: OperationQueryParameter = {
parameterPath: "apiVersion",
mapper: {
defaultValue: "2023-11-01-preview",
isConstant: true,
serializedName: "api-version",
type: {
name: "String",
},
},
};
export const nextLink: OperationURLParameter = {
parameterPath: "nextLink",
mapper: {
serializedName: "nextLink",
required: true,
type: {
name: "String",
},
},
skipEncoding: true,
};
export const subscriptionId: OperationURLParameter = {
parameterPath: "subscriptionId",
mapper: {
constraints: {
MinLength: 1,
},
serializedName: "subscriptionId",
required: true,
type: {
name: "String",
},
},
};
export const resourceGroupName: OperationURLParameter = {
parameterPath: "resourceGroupName",
mapper: {
constraints: {
MaxLength: 90,
MinLength: 1,
},
serializedName: "resourceGroupName",
required: true,
type: {
name: "String",
},
},
};
export const assetEndpointProfileName: OperationURLParameter = {
parameterPath: "assetEndpointProfileName",
mapper: {
constraints: {
Pattern: new RegExp("^[a-z0-9][a-z0-9-]*[a-z0-9]$"),
MaxLength: 63,
MinLength: 3,
},
serializedName: "assetEndpointProfileName",
required: true,
type: {
name: "String",
},
},
};
export const contentType: OperationParameter = {
parameterPath: ["options", "contentType"],
mapper: {
defaultValue: "application/json",
isConstant: true,
serializedName: "Content-Type",
type: {
name: "String",
},
},
};
export const resource: OperationParameter = {
parameterPath: "resource",
mapper: AssetEndpointProfileMapper,
};
export const properties: OperationParameter = {
parameterPath: "properties",
mapper: AssetEndpointProfileUpdateMapper,
};
export const assetName: OperationURLParameter = {
parameterPath: "assetName",
mapper: {
constraints: {
Pattern: new RegExp("^[a-z0-9][a-z0-9-]*[a-z0-9]$"),
MaxLength: 63,
MinLength: 3,
},
serializedName: "assetName",
required: true,
type: {
name: "String",
},
},
};
export const resource1: OperationParameter = {
parameterPath: "resource",
mapper: AssetMapper,
};
export const properties1: OperationParameter = {
parameterPath: "properties",
mapper: AssetUpdateMapper,
};
export const location: OperationURLParameter = {
parameterPath: "location",
mapper: {
constraints: {
MinLength: 1,
},
serializedName: "location",
required: true,
type: {
name: "String",
},
},
};
export const operationId: OperationURLParameter = {
parameterPath: "operationId",
mapper: {
constraints: {
MinLength: 1,
},
serializedName: "operationId",
required: true,
type: {
name: "String",
},
},
};

Просмотреть файл

@ -0,0 +1,733 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { AssetEndpointProfiles } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { DeviceRegistryManagementClient } from "../deviceRegistryManagementClient";
import {
SimplePollerLike,
OperationState,
createHttpPoller,
} from "@azure/core-lro";
import { createLroSpec } from "../lroImpl";
import {
AssetEndpointProfile,
AssetEndpointProfilesListBySubscriptionNextOptionalParams,
AssetEndpointProfilesListBySubscriptionOptionalParams,
AssetEndpointProfilesListBySubscriptionResponse,
AssetEndpointProfilesListByResourceGroupNextOptionalParams,
AssetEndpointProfilesListByResourceGroupOptionalParams,
AssetEndpointProfilesListByResourceGroupResponse,
AssetEndpointProfilesGetOptionalParams,
AssetEndpointProfilesGetResponse,
AssetEndpointProfilesCreateOrReplaceOptionalParams,
AssetEndpointProfilesCreateOrReplaceResponse,
AssetEndpointProfileUpdate,
AssetEndpointProfilesUpdateOptionalParams,
AssetEndpointProfilesUpdateResponse,
AssetEndpointProfilesDeleteOptionalParams,
AssetEndpointProfilesDeleteResponse,
AssetEndpointProfilesListBySubscriptionNextResponse,
AssetEndpointProfilesListByResourceGroupNextResponse,
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing AssetEndpointProfiles operations. */
export class AssetEndpointProfilesImpl implements AssetEndpointProfiles {
private readonly client: DeviceRegistryManagementClient;
/**
* Initialize a new instance of the class AssetEndpointProfiles class.
* @param client Reference to the service client
*/
constructor(client: DeviceRegistryManagementClient) {
this.client = client;
}
/**
* List AssetEndpointProfile resources by subscription ID
* @param options The options parameters.
*/
public listBySubscription(
options?: AssetEndpointProfilesListBySubscriptionOptionalParams,
): PagedAsyncIterableIterator<AssetEndpointProfile> {
const iter = this.listBySubscriptionPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listBySubscriptionPagingPage(options, settings);
},
};
}
private async *listBySubscriptionPagingPage(
options?: AssetEndpointProfilesListBySubscriptionOptionalParams,
settings?: PageSettings,
): AsyncIterableIterator<AssetEndpointProfile[]> {
let result: AssetEndpointProfilesListBySubscriptionResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listBySubscription(options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listBySubscriptionNext(continuationToken, options);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listBySubscriptionPagingAll(
options?: AssetEndpointProfilesListBySubscriptionOptionalParams,
): AsyncIterableIterator<AssetEndpointProfile> {
for await (const page of this.listBySubscriptionPagingPage(options)) {
yield* page;
}
}
/**
* List AssetEndpointProfile resources by resource group
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param options The options parameters.
*/
public listByResourceGroup(
resourceGroupName: string,
options?: AssetEndpointProfilesListByResourceGroupOptionalParams,
): PagedAsyncIterableIterator<AssetEndpointProfile> {
const iter = this.listByResourceGroupPagingAll(resourceGroupName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByResourceGroupPagingPage(
resourceGroupName,
options,
settings,
);
},
};
}
private async *listByResourceGroupPagingPage(
resourceGroupName: string,
options?: AssetEndpointProfilesListByResourceGroupOptionalParams,
settings?: PageSettings,
): AsyncIterableIterator<AssetEndpointProfile[]> {
let result: AssetEndpointProfilesListByResourceGroupResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByResourceGroup(resourceGroupName, options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByResourceGroupNext(
resourceGroupName,
continuationToken,
options,
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listByResourceGroupPagingAll(
resourceGroupName: string,
options?: AssetEndpointProfilesListByResourceGroupOptionalParams,
): AsyncIterableIterator<AssetEndpointProfile> {
for await (const page of this.listByResourceGroupPagingPage(
resourceGroupName,
options,
)) {
yield* page;
}
}
/**
* List AssetEndpointProfile resources by subscription ID
* @param options The options parameters.
*/
private _listBySubscription(
options?: AssetEndpointProfilesListBySubscriptionOptionalParams,
): Promise<AssetEndpointProfilesListBySubscriptionResponse> {
return this.client.sendOperationRequest(
{ options },
listBySubscriptionOperationSpec,
);
}
/**
* List AssetEndpointProfile resources by resource group
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param options The options parameters.
*/
private _listByResourceGroup(
resourceGroupName: string,
options?: AssetEndpointProfilesListByResourceGroupOptionalParams,
): Promise<AssetEndpointProfilesListByResourceGroupResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, options },
listByResourceGroupOperationSpec,
);
}
/**
* Get a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param options The options parameters.
*/
get(
resourceGroupName: string,
assetEndpointProfileName: string,
options?: AssetEndpointProfilesGetOptionalParams,
): Promise<AssetEndpointProfilesGetResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, assetEndpointProfileName, options },
getOperationSpec,
);
}
/**
* Create a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param resource Resource create parameters.
* @param options The options parameters.
*/
async beginCreateOrReplace(
resourceGroupName: string,
assetEndpointProfileName: string,
resource: AssetEndpointProfile,
options?: AssetEndpointProfilesCreateOrReplaceOptionalParams,
): Promise<
SimplePollerLike<
OperationState<AssetEndpointProfilesCreateOrReplaceResponse>,
AssetEndpointProfilesCreateOrReplaceResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
): Promise<AssetEndpointProfilesCreateOrReplaceResponse> => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
) => {
let currentRawResponse: coreClient.FullOperationResponse | undefined =
undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown,
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback,
},
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON(),
},
};
};
const lro = createLroSpec({
sendOperationFn,
args: { resourceGroupName, assetEndpointProfileName, resource, options },
spec: createOrReplaceOperationSpec,
});
const poller = await createHttpPoller<
AssetEndpointProfilesCreateOrReplaceResponse,
OperationState<AssetEndpointProfilesCreateOrReplaceResponse>
>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
resourceLocationConfig: "azure-async-operation",
});
await poller.poll();
return poller;
}
/**
* Create a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param resource Resource create parameters.
* @param options The options parameters.
*/
async beginCreateOrReplaceAndWait(
resourceGroupName: string,
assetEndpointProfileName: string,
resource: AssetEndpointProfile,
options?: AssetEndpointProfilesCreateOrReplaceOptionalParams,
): Promise<AssetEndpointProfilesCreateOrReplaceResponse> {
const poller = await this.beginCreateOrReplace(
resourceGroupName,
assetEndpointProfileName,
resource,
options,
);
return poller.pollUntilDone();
}
/**
* Update a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param properties The resource properties to be updated.
* @param options The options parameters.
*/
async beginUpdate(
resourceGroupName: string,
assetEndpointProfileName: string,
properties: AssetEndpointProfileUpdate,
options?: AssetEndpointProfilesUpdateOptionalParams,
): Promise<
SimplePollerLike<
OperationState<AssetEndpointProfilesUpdateResponse>,
AssetEndpointProfilesUpdateResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
): Promise<AssetEndpointProfilesUpdateResponse> => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
) => {
let currentRawResponse: coreClient.FullOperationResponse | undefined =
undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown,
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback,
},
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON(),
},
};
};
const lro = createLroSpec({
sendOperationFn,
args: {
resourceGroupName,
assetEndpointProfileName,
properties,
options,
},
spec: updateOperationSpec,
});
const poller = await createHttpPoller<
AssetEndpointProfilesUpdateResponse,
OperationState<AssetEndpointProfilesUpdateResponse>
>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
resourceLocationConfig: "location",
});
await poller.poll();
return poller;
}
/**
* Update a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param properties The resource properties to be updated.
* @param options The options parameters.
*/
async beginUpdateAndWait(
resourceGroupName: string,
assetEndpointProfileName: string,
properties: AssetEndpointProfileUpdate,
options?: AssetEndpointProfilesUpdateOptionalParams,
): Promise<AssetEndpointProfilesUpdateResponse> {
const poller = await this.beginUpdate(
resourceGroupName,
assetEndpointProfileName,
properties,
options,
);
return poller.pollUntilDone();
}
/**
* Delete a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param options The options parameters.
*/
async beginDelete(
resourceGroupName: string,
assetEndpointProfileName: string,
options?: AssetEndpointProfilesDeleteOptionalParams,
): Promise<
SimplePollerLike<
OperationState<AssetEndpointProfilesDeleteResponse>,
AssetEndpointProfilesDeleteResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
): Promise<AssetEndpointProfilesDeleteResponse> => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
) => {
let currentRawResponse: coreClient.FullOperationResponse | undefined =
undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown,
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback,
},
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON(),
},
};
};
const lro = createLroSpec({
sendOperationFn,
args: { resourceGroupName, assetEndpointProfileName, options },
spec: deleteOperationSpec,
});
const poller = await createHttpPoller<
AssetEndpointProfilesDeleteResponse,
OperationState<AssetEndpointProfilesDeleteResponse>
>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
resourceLocationConfig: "location",
});
await poller.poll();
return poller;
}
/**
* Delete a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param options The options parameters.
*/
async beginDeleteAndWait(
resourceGroupName: string,
assetEndpointProfileName: string,
options?: AssetEndpointProfilesDeleteOptionalParams,
): Promise<AssetEndpointProfilesDeleteResponse> {
const poller = await this.beginDelete(
resourceGroupName,
assetEndpointProfileName,
options,
);
return poller.pollUntilDone();
}
/**
* ListBySubscriptionNext
* @param nextLink The nextLink from the previous successful call to the ListBySubscription method.
* @param options The options parameters.
*/
private _listBySubscriptionNext(
nextLink: string,
options?: AssetEndpointProfilesListBySubscriptionNextOptionalParams,
): Promise<AssetEndpointProfilesListBySubscriptionNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listBySubscriptionNextOperationSpec,
);
}
/**
* ListByResourceGroupNext
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method.
* @param options The options parameters.
*/
private _listByResourceGroupNext(
resourceGroupName: string,
nextLink: string,
options?: AssetEndpointProfilesListByResourceGroupNextOptionalParams,
): Promise<AssetEndpointProfilesListByResourceGroupNextResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, nextLink, options },
listByResourceGroupNextOperationSpec,
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listBySubscriptionOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.AssetEndpointProfileListResult,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer,
};
const listByResourceGroupOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.AssetEndpointProfileListResult,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
],
headerParameters: [Parameters.accept],
serializer,
};
const getOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.AssetEndpointProfile,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.assetEndpointProfileName,
],
headerParameters: [Parameters.accept],
serializer,
};
const createOrReplaceOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.AssetEndpointProfile,
},
201: {
bodyMapper: Mappers.AssetEndpointProfile,
},
202: {
bodyMapper: Mappers.AssetEndpointProfile,
},
204: {
bodyMapper: Mappers.AssetEndpointProfile,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
requestBody: Parameters.resource,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.assetEndpointProfileName,
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer,
};
const updateOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}",
httpMethod: "PATCH",
responses: {
200: {
bodyMapper: Mappers.AssetEndpointProfile,
},
201: {
bodyMapper: Mappers.AssetEndpointProfile,
},
202: {
bodyMapper: Mappers.AssetEndpointProfile,
},
204: {
bodyMapper: Mappers.AssetEndpointProfile,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
requestBody: Parameters.properties,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.assetEndpointProfileName,
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer,
};
const deleteOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}",
httpMethod: "DELETE",
responses: {
200: {
headersMapper: Mappers.AssetEndpointProfilesDeleteHeaders,
},
201: {
headersMapper: Mappers.AssetEndpointProfilesDeleteHeaders,
},
202: {
headersMapper: Mappers.AssetEndpointProfilesDeleteHeaders,
},
204: {
headersMapper: Mappers.AssetEndpointProfilesDeleteHeaders,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.assetEndpointProfileName,
],
headerParameters: [Parameters.accept],
serializer,
};
const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.AssetEndpointProfileListResult,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.subscriptionId,
],
headerParameters: [Parameters.accept],
serializer,
};
const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.AssetEndpointProfileListResult,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.subscriptionId,
Parameters.resourceGroupName,
],
headerParameters: [Parameters.accept],
serializer,
};

Просмотреть файл

@ -0,0 +1,722 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { Assets } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { DeviceRegistryManagementClient } from "../deviceRegistryManagementClient";
import {
SimplePollerLike,
OperationState,
createHttpPoller,
} from "@azure/core-lro";
import { createLroSpec } from "../lroImpl";
import {
Asset,
AssetsListBySubscriptionNextOptionalParams,
AssetsListBySubscriptionOptionalParams,
AssetsListBySubscriptionResponse,
AssetsListByResourceGroupNextOptionalParams,
AssetsListByResourceGroupOptionalParams,
AssetsListByResourceGroupResponse,
AssetsGetOptionalParams,
AssetsGetResponse,
AssetsCreateOrReplaceOptionalParams,
AssetsCreateOrReplaceResponse,
AssetUpdate,
AssetsUpdateOptionalParams,
AssetsUpdateResponse,
AssetsDeleteOptionalParams,
AssetsDeleteResponse,
AssetsListBySubscriptionNextResponse,
AssetsListByResourceGroupNextResponse,
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing Assets operations. */
export class AssetsImpl implements Assets {
private readonly client: DeviceRegistryManagementClient;
/**
* Initialize a new instance of the class Assets class.
* @param client Reference to the service client
*/
constructor(client: DeviceRegistryManagementClient) {
this.client = client;
}
/**
* List Asset resources by subscription ID
* @param options The options parameters.
*/
public listBySubscription(
options?: AssetsListBySubscriptionOptionalParams,
): PagedAsyncIterableIterator<Asset> {
const iter = this.listBySubscriptionPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listBySubscriptionPagingPage(options, settings);
},
};
}
private async *listBySubscriptionPagingPage(
options?: AssetsListBySubscriptionOptionalParams,
settings?: PageSettings,
): AsyncIterableIterator<Asset[]> {
let result: AssetsListBySubscriptionResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listBySubscription(options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listBySubscriptionNext(continuationToken, options);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listBySubscriptionPagingAll(
options?: AssetsListBySubscriptionOptionalParams,
): AsyncIterableIterator<Asset> {
for await (const page of this.listBySubscriptionPagingPage(options)) {
yield* page;
}
}
/**
* List Asset resources by resource group
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param options The options parameters.
*/
public listByResourceGroup(
resourceGroupName: string,
options?: AssetsListByResourceGroupOptionalParams,
): PagedAsyncIterableIterator<Asset> {
const iter = this.listByResourceGroupPagingAll(resourceGroupName, options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listByResourceGroupPagingPage(
resourceGroupName,
options,
settings,
);
},
};
}
private async *listByResourceGroupPagingPage(
resourceGroupName: string,
options?: AssetsListByResourceGroupOptionalParams,
settings?: PageSettings,
): AsyncIterableIterator<Asset[]> {
let result: AssetsListByResourceGroupResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._listByResourceGroup(resourceGroupName, options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listByResourceGroupNext(
resourceGroupName,
continuationToken,
options,
);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listByResourceGroupPagingAll(
resourceGroupName: string,
options?: AssetsListByResourceGroupOptionalParams,
): AsyncIterableIterator<Asset> {
for await (const page of this.listByResourceGroupPagingPage(
resourceGroupName,
options,
)) {
yield* page;
}
}
/**
* List Asset resources by subscription ID
* @param options The options parameters.
*/
private _listBySubscription(
options?: AssetsListBySubscriptionOptionalParams,
): Promise<AssetsListBySubscriptionResponse> {
return this.client.sendOperationRequest(
{ options },
listBySubscriptionOperationSpec,
);
}
/**
* List Asset resources by resource group
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param options The options parameters.
*/
private _listByResourceGroup(
resourceGroupName: string,
options?: AssetsListByResourceGroupOptionalParams,
): Promise<AssetsListByResourceGroupResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, options },
listByResourceGroupOperationSpec,
);
}
/**
* Get a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param options The options parameters.
*/
get(
resourceGroupName: string,
assetName: string,
options?: AssetsGetOptionalParams,
): Promise<AssetsGetResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, assetName, options },
getOperationSpec,
);
}
/**
* Create a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param resource Resource create parameters.
* @param options The options parameters.
*/
async beginCreateOrReplace(
resourceGroupName: string,
assetName: string,
resource: Asset,
options?: AssetsCreateOrReplaceOptionalParams,
): Promise<
SimplePollerLike<
OperationState<AssetsCreateOrReplaceResponse>,
AssetsCreateOrReplaceResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
): Promise<AssetsCreateOrReplaceResponse> => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
) => {
let currentRawResponse: coreClient.FullOperationResponse | undefined =
undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown,
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback,
},
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON(),
},
};
};
const lro = createLroSpec({
sendOperationFn,
args: { resourceGroupName, assetName, resource, options },
spec: createOrReplaceOperationSpec,
});
const poller = await createHttpPoller<
AssetsCreateOrReplaceResponse,
OperationState<AssetsCreateOrReplaceResponse>
>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
resourceLocationConfig: "azure-async-operation",
});
await poller.poll();
return poller;
}
/**
* Create a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param resource Resource create parameters.
* @param options The options parameters.
*/
async beginCreateOrReplaceAndWait(
resourceGroupName: string,
assetName: string,
resource: Asset,
options?: AssetsCreateOrReplaceOptionalParams,
): Promise<AssetsCreateOrReplaceResponse> {
const poller = await this.beginCreateOrReplace(
resourceGroupName,
assetName,
resource,
options,
);
return poller.pollUntilDone();
}
/**
* Update a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param properties The resource properties to be updated.
* @param options The options parameters.
*/
async beginUpdate(
resourceGroupName: string,
assetName: string,
properties: AssetUpdate,
options?: AssetsUpdateOptionalParams,
): Promise<
SimplePollerLike<OperationState<AssetsUpdateResponse>, AssetsUpdateResponse>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
): Promise<AssetsUpdateResponse> => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
) => {
let currentRawResponse: coreClient.FullOperationResponse | undefined =
undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown,
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback,
},
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON(),
},
};
};
const lro = createLroSpec({
sendOperationFn,
args: { resourceGroupName, assetName, properties, options },
spec: updateOperationSpec,
});
const poller = await createHttpPoller<
AssetsUpdateResponse,
OperationState<AssetsUpdateResponse>
>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
resourceLocationConfig: "location",
});
await poller.poll();
return poller;
}
/**
* Update a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param properties The resource properties to be updated.
* @param options The options parameters.
*/
async beginUpdateAndWait(
resourceGroupName: string,
assetName: string,
properties: AssetUpdate,
options?: AssetsUpdateOptionalParams,
): Promise<AssetsUpdateResponse> {
const poller = await this.beginUpdate(
resourceGroupName,
assetName,
properties,
options,
);
return poller.pollUntilDone();
}
/**
* Delete a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param options The options parameters.
*/
async beginDelete(
resourceGroupName: string,
assetName: string,
options?: AssetsDeleteOptionalParams,
): Promise<
SimplePollerLike<OperationState<AssetsDeleteResponse>, AssetsDeleteResponse>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
): Promise<AssetsDeleteResponse> => {
return this.client.sendOperationRequest(args, spec);
};
const sendOperationFn = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
) => {
let currentRawResponse: coreClient.FullOperationResponse | undefined =
undefined;
const providedCallback = args.options?.onResponse;
const callback: coreClient.RawResponseCallback = (
rawResponse: coreClient.FullOperationResponse,
flatResponse: unknown,
) => {
currentRawResponse = rawResponse;
providedCallback?.(rawResponse, flatResponse);
};
const updatedArgs = {
...args,
options: {
...args.options,
onResponse: callback,
},
};
const flatResponse = await directSendOperation(updatedArgs, spec);
return {
flatResponse,
rawResponse: {
statusCode: currentRawResponse!.status,
body: currentRawResponse!.parsedBody,
headers: currentRawResponse!.headers.toJSON(),
},
};
};
const lro = createLroSpec({
sendOperationFn,
args: { resourceGroupName, assetName, options },
spec: deleteOperationSpec,
});
const poller = await createHttpPoller<
AssetsDeleteResponse,
OperationState<AssetsDeleteResponse>
>(lro, {
restoreFrom: options?.resumeFrom,
intervalInMs: options?.updateIntervalInMs,
resourceLocationConfig: "location",
});
await poller.poll();
return poller;
}
/**
* Delete a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param options The options parameters.
*/
async beginDeleteAndWait(
resourceGroupName: string,
assetName: string,
options?: AssetsDeleteOptionalParams,
): Promise<AssetsDeleteResponse> {
const poller = await this.beginDelete(
resourceGroupName,
assetName,
options,
);
return poller.pollUntilDone();
}
/**
* ListBySubscriptionNext
* @param nextLink The nextLink from the previous successful call to the ListBySubscription method.
* @param options The options parameters.
*/
private _listBySubscriptionNext(
nextLink: string,
options?: AssetsListBySubscriptionNextOptionalParams,
): Promise<AssetsListBySubscriptionNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listBySubscriptionNextOperationSpec,
);
}
/**
* ListByResourceGroupNext
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method.
* @param options The options parameters.
*/
private _listByResourceGroupNext(
resourceGroupName: string,
nextLink: string,
options?: AssetsListByResourceGroupNextOptionalParams,
): Promise<AssetsListByResourceGroupNextResponse> {
return this.client.sendOperationRequest(
{ resourceGroupName, nextLink, options },
listByResourceGroupNextOperationSpec,
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listBySubscriptionOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assets",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.AssetListResult,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.subscriptionId],
headerParameters: [Parameters.accept],
serializer,
};
const listByResourceGroupOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.AssetListResult,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
],
headerParameters: [Parameters.accept],
serializer,
};
const getOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.Asset,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.assetName,
],
headerParameters: [Parameters.accept],
serializer,
};
const createOrReplaceOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}",
httpMethod: "PUT",
responses: {
200: {
bodyMapper: Mappers.Asset,
},
201: {
bodyMapper: Mappers.Asset,
},
202: {
bodyMapper: Mappers.Asset,
},
204: {
bodyMapper: Mappers.Asset,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
requestBody: Parameters.resource1,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.assetName,
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer,
};
const updateOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}",
httpMethod: "PATCH",
responses: {
200: {
bodyMapper: Mappers.Asset,
},
201: {
bodyMapper: Mappers.Asset,
},
202: {
bodyMapper: Mappers.Asset,
},
204: {
bodyMapper: Mappers.Asset,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
requestBody: Parameters.properties1,
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.assetName,
],
headerParameters: [Parameters.accept, Parameters.contentType],
mediaType: "json",
serializer,
};
const deleteOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}",
httpMethod: "DELETE",
responses: {
200: {
headersMapper: Mappers.AssetsDeleteHeaders,
},
201: {
headersMapper: Mappers.AssetsDeleteHeaders,
},
202: {
headersMapper: Mappers.AssetsDeleteHeaders,
},
204: {
headersMapper: Mappers.AssetsDeleteHeaders,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.resourceGroupName,
Parameters.assetName,
],
headerParameters: [Parameters.accept],
serializer,
};
const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.AssetListResult,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.subscriptionId,
],
headerParameters: [Parameters.accept],
serializer,
};
const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.AssetListResult,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
urlParameters: [
Parameters.$host,
Parameters.nextLink,
Parameters.subscriptionId,
Parameters.resourceGroupName,
],
headerParameters: [Parameters.accept],
serializer,
};

Просмотреть файл

@ -0,0 +1,12 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
export * from "./operations";
export * from "./assetEndpointProfiles";
export * from "./assets";
export * from "./operationStatus";

Просмотреть файл

@ -0,0 +1,71 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { OperationStatus } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { DeviceRegistryManagementClient } from "../deviceRegistryManagementClient";
import {
OperationStatusGetOptionalParams,
OperationStatusGetResponse,
} from "../models";
/** Class containing OperationStatus operations. */
export class OperationStatusImpl implements OperationStatus {
private readonly client: DeviceRegistryManagementClient;
/**
* Initialize a new instance of the class OperationStatus class.
* @param client Reference to the service client
*/
constructor(client: DeviceRegistryManagementClient) {
this.client = client;
}
/**
* Returns the current status of an async operation.
* @param location The name of Azure region.
* @param operationId The ID of an ongoing async operation.
* @param options The options parameters.
*/
get(
location: string,
operationId: string,
options?: OperationStatusGetOptionalParams,
): Promise<OperationStatusGetResponse> {
return this.client.sendOperationRequest(
{ location, operationId, options },
getOperationSpec,
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const getOperationSpec: coreClient.OperationSpec = {
path: "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/locations/{location}/operationStatuses/{operationId}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.OperationStatusResult,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [
Parameters.$host,
Parameters.subscriptionId,
Parameters.location,
Parameters.operationId,
],
headerParameters: [Parameters.accept],
serializer,
};

Просмотреть файл

@ -0,0 +1,149 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
import { setContinuationToken } from "../pagingHelper";
import { Operations } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { DeviceRegistryManagementClient } from "../deviceRegistryManagementClient";
import {
Operation,
OperationsListNextOptionalParams,
OperationsListOptionalParams,
OperationsListResponse,
OperationsListNextResponse,
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Class containing Operations operations. */
export class OperationsImpl implements Operations {
private readonly client: DeviceRegistryManagementClient;
/**
* Initialize a new instance of the class Operations class.
* @param client Reference to the service client
*/
constructor(client: DeviceRegistryManagementClient) {
this.client = client;
}
/**
* List the operations for the provider
* @param options The options parameters.
*/
public list(
options?: OperationsListOptionalParams,
): PagedAsyncIterableIterator<Operation> {
const iter = this.listPagingAll(options);
return {
next() {
return iter.next();
},
[Symbol.asyncIterator]() {
return this;
},
byPage: (settings?: PageSettings) => {
if (settings?.maxPageSize) {
throw new Error("maxPageSize is not supported by this operation.");
}
return this.listPagingPage(options, settings);
},
};
}
private async *listPagingPage(
options?: OperationsListOptionalParams,
settings?: PageSettings,
): AsyncIterableIterator<Operation[]> {
let result: OperationsListResponse;
let continuationToken = settings?.continuationToken;
if (!continuationToken) {
result = await this._list(options);
let page = result.value || [];
continuationToken = result.nextLink;
setContinuationToken(page, continuationToken);
yield page;
}
while (continuationToken) {
result = await this._listNext(continuationToken, options);
continuationToken = result.nextLink;
let page = result.value || [];
setContinuationToken(page, continuationToken);
yield page;
}
}
private async *listPagingAll(
options?: OperationsListOptionalParams,
): AsyncIterableIterator<Operation> {
for await (const page of this.listPagingPage(options)) {
yield* page;
}
}
/**
* List the operations for the provider
* @param options The options parameters.
*/
private _list(
options?: OperationsListOptionalParams,
): Promise<OperationsListResponse> {
return this.client.sendOperationRequest({ options }, listOperationSpec);
}
/**
* ListNext
* @param nextLink The nextLink from the previous successful call to the List method.
* @param options The options parameters.
*/
private _listNext(
nextLink: string,
options?: OperationsListNextOptionalParams,
): Promise<OperationsListNextResponse> {
return this.client.sendOperationRequest(
{ nextLink, options },
listNextOperationSpec,
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const listOperationSpec: coreClient.OperationSpec = {
path: "/providers/Microsoft.DeviceRegistry/operations",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.OperationListResult,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.accept],
serializer,
};
const listNextOperationSpec: coreClient.OperationSpec = {
path: "{nextLink}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.OperationListResult,
},
default: {
bodyMapper: Mappers.ErrorResponse,
},
},
urlParameters: [Parameters.$host, Parameters.nextLink],
headerParameters: [Parameters.accept],
serializer,
};

Просмотреть файл

@ -0,0 +1,145 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import { SimplePollerLike, OperationState } from "@azure/core-lro";
import {
AssetEndpointProfile,
AssetEndpointProfilesListBySubscriptionOptionalParams,
AssetEndpointProfilesListByResourceGroupOptionalParams,
AssetEndpointProfilesGetOptionalParams,
AssetEndpointProfilesGetResponse,
AssetEndpointProfilesCreateOrReplaceOptionalParams,
AssetEndpointProfilesCreateOrReplaceResponse,
AssetEndpointProfileUpdate,
AssetEndpointProfilesUpdateOptionalParams,
AssetEndpointProfilesUpdateResponse,
AssetEndpointProfilesDeleteOptionalParams,
AssetEndpointProfilesDeleteResponse,
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Interface representing a AssetEndpointProfiles. */
export interface AssetEndpointProfiles {
/**
* List AssetEndpointProfile resources by subscription ID
* @param options The options parameters.
*/
listBySubscription(
options?: AssetEndpointProfilesListBySubscriptionOptionalParams,
): PagedAsyncIterableIterator<AssetEndpointProfile>;
/**
* List AssetEndpointProfile resources by resource group
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param options The options parameters.
*/
listByResourceGroup(
resourceGroupName: string,
options?: AssetEndpointProfilesListByResourceGroupOptionalParams,
): PagedAsyncIterableIterator<AssetEndpointProfile>;
/**
* Get a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param options The options parameters.
*/
get(
resourceGroupName: string,
assetEndpointProfileName: string,
options?: AssetEndpointProfilesGetOptionalParams,
): Promise<AssetEndpointProfilesGetResponse>;
/**
* Create a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param resource Resource create parameters.
* @param options The options parameters.
*/
beginCreateOrReplace(
resourceGroupName: string,
assetEndpointProfileName: string,
resource: AssetEndpointProfile,
options?: AssetEndpointProfilesCreateOrReplaceOptionalParams,
): Promise<
SimplePollerLike<
OperationState<AssetEndpointProfilesCreateOrReplaceResponse>,
AssetEndpointProfilesCreateOrReplaceResponse
>
>;
/**
* Create a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param resource Resource create parameters.
* @param options The options parameters.
*/
beginCreateOrReplaceAndWait(
resourceGroupName: string,
assetEndpointProfileName: string,
resource: AssetEndpointProfile,
options?: AssetEndpointProfilesCreateOrReplaceOptionalParams,
): Promise<AssetEndpointProfilesCreateOrReplaceResponse>;
/**
* Update a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param properties The resource properties to be updated.
* @param options The options parameters.
*/
beginUpdate(
resourceGroupName: string,
assetEndpointProfileName: string,
properties: AssetEndpointProfileUpdate,
options?: AssetEndpointProfilesUpdateOptionalParams,
): Promise<
SimplePollerLike<
OperationState<AssetEndpointProfilesUpdateResponse>,
AssetEndpointProfilesUpdateResponse
>
>;
/**
* Update a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param properties The resource properties to be updated.
* @param options The options parameters.
*/
beginUpdateAndWait(
resourceGroupName: string,
assetEndpointProfileName: string,
properties: AssetEndpointProfileUpdate,
options?: AssetEndpointProfilesUpdateOptionalParams,
): Promise<AssetEndpointProfilesUpdateResponse>;
/**
* Delete a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param options The options parameters.
*/
beginDelete(
resourceGroupName: string,
assetEndpointProfileName: string,
options?: AssetEndpointProfilesDeleteOptionalParams,
): Promise<
SimplePollerLike<
OperationState<AssetEndpointProfilesDeleteResponse>,
AssetEndpointProfilesDeleteResponse
>
>;
/**
* Delete a AssetEndpointProfile
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetEndpointProfileName Asset Endpoint Profile name parameter.
* @param options The options parameters.
*/
beginDeleteAndWait(
resourceGroupName: string,
assetEndpointProfileName: string,
options?: AssetEndpointProfilesDeleteOptionalParams,
): Promise<AssetEndpointProfilesDeleteResponse>;
}

Просмотреть файл

@ -0,0 +1,139 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import { SimplePollerLike, OperationState } from "@azure/core-lro";
import {
Asset,
AssetsListBySubscriptionOptionalParams,
AssetsListByResourceGroupOptionalParams,
AssetsGetOptionalParams,
AssetsGetResponse,
AssetsCreateOrReplaceOptionalParams,
AssetsCreateOrReplaceResponse,
AssetUpdate,
AssetsUpdateOptionalParams,
AssetsUpdateResponse,
AssetsDeleteOptionalParams,
AssetsDeleteResponse,
} from "../models";
/// <reference lib="esnext.asynciterable" />
/** Interface representing a Assets. */
export interface Assets {
/**
* List Asset resources by subscription ID
* @param options The options parameters.
*/
listBySubscription(
options?: AssetsListBySubscriptionOptionalParams,
): PagedAsyncIterableIterator<Asset>;
/**
* List Asset resources by resource group
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param options The options parameters.
*/
listByResourceGroup(
resourceGroupName: string,
options?: AssetsListByResourceGroupOptionalParams,
): PagedAsyncIterableIterator<Asset>;
/**
* Get a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param options The options parameters.
*/
get(
resourceGroupName: string,
assetName: string,
options?: AssetsGetOptionalParams,
): Promise<AssetsGetResponse>;
/**
* Create a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param resource Resource create parameters.
* @param options The options parameters.
*/
beginCreateOrReplace(
resourceGroupName: string,
assetName: string,
resource: Asset,
options?: AssetsCreateOrReplaceOptionalParams,
): Promise<
SimplePollerLike<
OperationState<AssetsCreateOrReplaceResponse>,
AssetsCreateOrReplaceResponse
>
>;
/**
* Create a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param resource Resource create parameters.
* @param options The options parameters.
*/
beginCreateOrReplaceAndWait(
resourceGroupName: string,
assetName: string,
resource: Asset,
options?: AssetsCreateOrReplaceOptionalParams,
): Promise<AssetsCreateOrReplaceResponse>;
/**
* Update a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param properties The resource properties to be updated.
* @param options The options parameters.
*/
beginUpdate(
resourceGroupName: string,
assetName: string,
properties: AssetUpdate,
options?: AssetsUpdateOptionalParams,
): Promise<
SimplePollerLike<OperationState<AssetsUpdateResponse>, AssetsUpdateResponse>
>;
/**
* Update a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param properties The resource properties to be updated.
* @param options The options parameters.
*/
beginUpdateAndWait(
resourceGroupName: string,
assetName: string,
properties: AssetUpdate,
options?: AssetsUpdateOptionalParams,
): Promise<AssetsUpdateResponse>;
/**
* Delete a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param options The options parameters.
*/
beginDelete(
resourceGroupName: string,
assetName: string,
options?: AssetsDeleteOptionalParams,
): Promise<
SimplePollerLike<OperationState<AssetsDeleteResponse>, AssetsDeleteResponse>
>;
/**
* Delete a Asset
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param assetName Asset name parameter.
* @param options The options parameters.
*/
beginDeleteAndWait(
resourceGroupName: string,
assetName: string,
options?: AssetsDeleteOptionalParams,
): Promise<AssetsDeleteResponse>;
}

Просмотреть файл

@ -0,0 +1,12 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
export * from "./operations";
export * from "./assetEndpointProfiles";
export * from "./assets";
export * from "./operationStatus";

Просмотреть файл

@ -0,0 +1,27 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import {
OperationStatusGetOptionalParams,
OperationStatusGetResponse,
} from "../models";
/** Interface representing a OperationStatus. */
export interface OperationStatus {
/**
* Returns the current status of an async operation.
* @param location The name of Azure region.
* @param operationId The ID of an ongoing async operation.
* @param options The options parameters.
*/
get(
location: string,
operationId: string,
options?: OperationStatusGetOptionalParams,
): Promise<OperationStatusGetResponse>;
}

Просмотреть файл

@ -0,0 +1,22 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import { Operation, OperationsListOptionalParams } from "../models";
/// <reference lib="esnext.asynciterable" />
/** Interface representing a Operations. */
export interface Operations {
/**
* List the operations for the provider
* @param options The options parameters.
*/
list(
options?: OperationsListOptionalParams,
): PagedAsyncIterableIterator<Operation>;
}

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
export interface PageInfo {
continuationToken?: string;
}
const pageMap = new WeakMap<object, PageInfo>();
/**
* Given the last `.value` produced by the `byPage` iterator,
* returns a continuation token that can be used to begin paging from
* that point later.
* @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
* @returns The continuation token that can be passed into byPage() during future calls.
*/
export function getContinuationToken(page: unknown): string | undefined {
if (typeof page !== "object" || page === null) {
return undefined;
}
return pageMap.get(page)?.continuationToken;
}
export function setContinuationToken(
page: unknown,
continuationToken: string | undefined,
): void {
if (typeof page !== "object" || page === null || !continuationToken) {
return;
}
const pageInfo = pageMap.get(page) ?? {};
pageInfo.continuationToken = continuationToken;
pageMap.set(page, pageInfo);
}

Просмотреть файл

@ -0,0 +1,69 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import {
env,
Recorder,
RecorderStartOptions,
delay,
isPlaybackMode,
} from "@azure-tools/test-recorder";
import { createTestCredential } from "@azure-tools/test-credential";
import { assert } from "chai";
import { Context } from "mocha";
import { DeviceRegistryManagementClient } from "../src/deviceRegistryManagementClient";
const replaceableVariables: Record<string, string> = {
AZURE_CLIENT_ID: "azure_client_id",
AZURE_CLIENT_SECRET: "azure_client_secret",
AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
SUBSCRIPTION_ID: "azure_subscription_id"
};
const recorderOptions: RecorderStartOptions = {
envSetupForPlayback: replaceableVariables
};
export const testPollingOptions = {
updateIntervalInMs: isPlaybackMode() ? 0 : undefined,
};
describe.skip("DeviceRegistry test", () => {
let recorder: Recorder;
let subscriptionId: string;
let client: DeviceRegistryManagementClient;
let location: string;
let resourceGroup: string;
let resourcename: string;
beforeEach(async function (this: Context) {
recorder = new Recorder(this.currentTest);
await recorder.start(recorderOptions);
subscriptionId = env.SUBSCRIPTION_ID || '';
// This is an example of how the environment variables are used
const credential = createTestCredential();
client = new DeviceRegistryManagementClient(credential, subscriptionId, recorder.configureClientOptions({}));
location = "eastus";
resourceGroup = "myjstest";
resourcename = "resourcetest";
});
afterEach(async function () {
await recorder.stop();
});
it("operations list test", async function () {
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
assert.notEqual(resArray.length, 0);
});
})

Просмотреть файл

@ -0,0 +1,33 @@
{
"compilerOptions": {
"module": "es6",
"moduleResolution": "node",
"strict": true,
"target": "es6",
"sourceMap": true,
"declarationMap": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"lib": [
"es6",
"dom"
],
"declaration": true,
"outDir": "./dist-esm",
"importHelpers": true,
"paths": {
"@azure/arm-deviceregistry": [
"./src/index"
]
}
},
"include": [
"./src/**/*.ts",
"./test/**/*.ts",
"samples-dev/**/*.ts"
],
"exclude": [
"node_modules"
]
}

Просмотреть файл

@ -0,0 +1,38 @@
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
trigger:
branches:
include:
- main
- feature/*
- release/*
- hotfix/*
exclude:
- feature/v4
paths:
include:
- sdk/deviceregistry/arm-deviceregistry
- sdk/deviceregistry/ci.mgmt.yml
pr:
branches:
include:
- main
- feature/*
- release/*
- hotfix/*
exclude:
- feature/v4
paths:
include:
- sdk/deviceregistry/arm-deviceregistry
- sdk/deviceregistry/ci.mgmt.yml
extends:
template: /eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
ServiceDirectory: deviceregistry
Artifacts:
- name: azure-arm-deviceregistry
safeName: azurearmdeviceregistry