diff --git a/sdk/deviceupdate/device-update/README.md b/sdk/deviceupdate/device-update/README.md new file mode 100644 index 000000000000..e6bae4f31ed7 --- /dev/null +++ b/sdk/deviceupdate/device-update/README.md @@ -0,0 +1,107 @@ +# Azure DeviceUpdate client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure DeviceUpdate client. + +Device Update for IoT Hub is an Azure service that enables customers to publish update for their IoT devices to the cloud, and then deploy that update to their devices (approve updates to groups of devices managed and provisioned in IoT Hub). It leverages the proven security and reliability of the Windows Update platform, optimized for IoT devices. It works globally and knows when and how to update devices, enabling customers to focus on their business goals and let Device Update for IoT Hub handle the updates. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceupdate/device-update) | +[Package (NPM)](https://www.npmjs.com/package/@azure/device-update) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/device-update?view=azure-node-preview) | +[Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceupdate/device-update/samples) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/device-update` package + +Install the Azure DeviceUpdate client library for JavaScript with `npm`: + +```bash +npm install @azure/device-update +``` + +### Create and authenticate a `DeviceUpdateClient` + +To create a client object to access the Azure DeviceUpdate API, you will need the `endpoint` of your Azure DeviceUpdate resource and a `credential`. The Azure DeviceUpdate client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure DeviceUpdate 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 DeviceUpdate** 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 { DeviceUpdateClient } = require("@azure/device-update"); +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 client = new DeviceUpdateClient("", new DefaultAzureCredential()); +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new DeviceUpdateClient("", credential); +``` + + +### 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 + +### DeviceUpdateClient + +`DeviceUpdateClient` is the primary interface for developers using the Azure DeviceUpdate client library. Explore the methods on this client object to understand the different features of the Azure DeviceUpdate 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/azure-sdk-for-js/tree/main/sdk/deviceupdate/device-update/samples) 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%2Fdeviceupdate%2Fdevice-update%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 diff --git a/sdk/deviceupdate/device-update/api-extractor.json b/sdk/deviceupdate/device-update/api-extractor.json new file mode 100644 index 000000000000..d64b5b3d9e2d --- /dev/null +++ b/sdk/deviceupdate/device-update/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/device-update.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/deviceupdate/device-update/package.json b/sdk/deviceupdate/device-update/package.json new file mode 100644 index 000000000000..6ff3689add5f --- /dev/null +++ b/sdk/deviceupdate/device-update/package.json @@ -0,0 +1,93 @@ +{ + "name": "@azure/device-update", + "sdk-type": "client", + "author": "Microsoft Corporation", + "description": "A generated SDK for DeviceUpdateClient.", + "version": "1.0.0-beta.1", + "engines": { "node": ">=12.0.0" }, + "dependencies": { + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.5.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.8.0", + "tslib": "^2.2.0" + }, + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/index.js", + "types": "./types/device-update.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "7.18.11", + "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-multi-entry": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^1.0.4", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceupdate/device-update", + "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", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "echo skipped", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "echo skipped", + "unit-test:node": "echo skipped", + "unit-test:browser": "echo skipped", + "integration-test": "echo skipped", + "integration-test:node": "echo skipped", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { "path": "src/deviceUpdateClient.ts", "prefix": "packageDetails" } + ] + }, + "autoPublish": true +} diff --git a/sdk/deviceupdate/device-update/rollup.config.js b/sdk/deviceupdate/device-update/rollup.config.js new file mode 100644 index 000000000000..7c67b82139a1 --- /dev/null +++ b/sdk/deviceupdate/device-update/rollup.config.js @@ -0,0 +1,114 @@ +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs(), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/deviceupdate/device-update/src/deviceUpdateClient.ts b/sdk/deviceupdate/device-update/src/deviceUpdateClient.ts new file mode 100644 index 000000000000..be37272c269b --- /dev/null +++ b/sdk/deviceupdate/device-update/src/deviceUpdateClient.ts @@ -0,0 +1,105 @@ +import * as coreClient from "@azure/core-client"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; +import * as coreAuth from "@azure/core-auth"; +import { DeviceUpdateImpl, DeviceManagementImpl } from "./operations"; +import { DeviceUpdate, DeviceManagement } from "./operationsInterfaces"; +import { DeviceUpdateClientOptionalParams } from "./models"; + +export class DeviceUpdateClient extends coreClient.ServiceClient { + endpoint: string; + instanceId: string; + apiVersion: string; + + /** + * Initializes a new instance of the DeviceUpdateClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param endpoint Account endpoint. + * @param instanceId Account instance identifier. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + endpoint: string, + instanceId: string, + options?: DeviceUpdateClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (endpoint === undefined) { + throw new Error("'endpoint' cannot be null"); + } + if (instanceId === undefined) { + throw new Error("'instanceId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: DeviceUpdateClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-device-update/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint ?? options.baseUri ?? "https://{endpoint}" + }; + super(optionsWithDefaults); + // Parameter assignments + this.endpoint = endpoint; + this.instanceId = instanceId; + + // Assigning values to Constant parameters + this.apiVersion = options.apiVersion || "2022-07-01-preview"; + this.deviceUpdate = new DeviceUpdateImpl(this); + this.deviceManagement = new DeviceManagementImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return item.replace(/(?<==).*$/, apiVersion); + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + deviceUpdate: DeviceUpdate; + deviceManagement: DeviceManagement; +} diff --git a/sdk/deviceupdate/device-update/src/index.ts b/sdk/deviceupdate/device-update/src/index.ts new file mode 100644 index 000000000000..90eac4a95350 --- /dev/null +++ b/sdk/deviceupdate/device-update/src/index.ts @@ -0,0 +1,4 @@ +/// +export * from "./models"; +export { DeviceUpdateClient } from "./deviceUpdateClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/deviceupdate/device-update/src/lroImpl.ts b/sdk/deviceupdate/device-update/src/lroImpl.ts new file mode 100644 index 000000000000..337d0f656b14 --- /dev/null +++ b/sdk/deviceupdate/device-update/src/lroImpl.ts @@ -0,0 +1,26 @@ +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/deviceupdate/device-update/src/models/index.ts b/sdk/deviceupdate/device-update/src/models/index.ts new file mode 100644 index 000000000000..605cd3b8cb13 --- /dev/null +++ b/sdk/deviceupdate/device-update/src/models/index.ts @@ -0,0 +1,1554 @@ +import * as coreClient from "@azure/core-client"; + +/** The list of updates. */ +export interface UpdateList { + /** The collection of pageable items. */ + value: Update[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Update metadata. */ +export interface Update { + /** Update identity. */ + updateId: UpdateId; + /** Update description specified by creator. */ + description?: string; + /** Friendly update name specified by importer. */ + friendlyName?: string; + /** Whether the update can be deployed to a device on its own. */ + isDeployable?: boolean; + /** Update type. Deprecated in latest import manifest schema. */ + updateType?: string; + /** String interpreted by Device Update client to determine if the update is installed on the device. Deprecated in latest import manifest schema. */ + installedCriteria?: string; + /** List of update compatibility information. */ + compatibility: { [propertyName: string]: string }[]; + /** Update install instructions. */ + instructions?: Instructions; + /** List of update identities that reference this update. */ + referencedBy?: UpdateId[]; + /** Update aggregate scan result (calculated from payload file scan results). */ + scanResult?: string; + /** Schema version of manifest used to import the update. */ + manifestVersion: string; + /** Date and time in UTC when the update was imported. */ + importedDateTime: Date; + /** Date and time in UTC when the update was created. */ + createdDateTime: Date; + /** Update ETag. */ + etag?: string; +} + +/** Update identifier. */ +export interface UpdateId { + /** Update provider. */ + provider: string; + /** Update name. */ + name: string; + /** Update version. */ + version: string; +} + +export interface Instructions { + /** Collection of installation steps. */ + steps: Step[]; +} + +/** Update install instruction step. */ +export interface Step { + /** Step type. */ + type?: StepType; + /** Step description. */ + description?: string; + /** Identity of handler that will execute this step. Required if step type is inline. */ + handler?: string; + /** Parameters to be passed to handler during execution. */ + handlerProperties?: Record; + /** Collection of file names to be passed to handler during execution. Required if step type is inline. */ + files?: string[]; + /** Referenced child update identity. Required if step type is reference. */ + updateId?: UpdateId; +} + +/** Common error response. */ +export interface ErrorResponse { + /** The error details. */ + error: ErrorModel; +} + +/** Error details. */ +export interface ErrorModel { + /** Server defined error code. */ + code: string; + /** A human-readable representation of the error. */ + message: string; + /** The target of the error. */ + target?: string; + /** An array of errors that led to the reported error. */ + details?: ErrorModel[]; + /** An object containing more specific information than the current object about the error. */ + innererror?: InnerError; + /** Date and time in UTC when the error occurred. */ + occurredDateTime?: Date; +} + +/** An object containing more specific information than the current object about the error. */ +export interface InnerError { + /** A more specific error code than what was provided by the containing error. */ + code: string; + /** A human-readable representation of the error. */ + message?: string; + /** The internal error or exception message. */ + errorDetail?: string; + /** An object containing more specific information than the current object about the error. */ + innerError?: InnerError; +} + +/** Import update input item metadata. */ +export interface ImportUpdateInputItem { + /** Import manifest metadata like source URL, file size/hashes, etc. */ + importManifest: ImportManifestMetadata; + /** Friendly update name. */ + friendlyName?: string; + /** One or more update file properties like filename and source URL. */ + files?: FileImportMetadata[]; +} + +/** Metadata describing the import manifest, a document which describes the files and other metadata about an update version. */ +export interface ImportManifestMetadata { + /** Azure Blob location from which the import manifest can be downloaded by Device Update for IoT Hub. This is typically a read-only SAS-protected blob URL with an expiration set to at least 4 hours. */ + url: string; + /** File size in number of bytes. */ + sizeInBytes: number; + /** A JSON object containing the hash(es) of the file. At least SHA256 hash is required. This object can be thought of as a set of key-value pairs where the key is the hash algorithm, and the value is the hash of the file calculated using that algorithm. */ + hashes: { [propertyName: string]: string }; +} + +/** Metadata describing an update file. */ +export interface FileImportMetadata { + /** Update file name as specified inside import manifest. */ + filename: string; + /** Azure Blob location from which the update file can be downloaded by Device Update for IoT Hub. This is typically a read-only SAS-protected blob URL with an expiration set to at least 4 hours. */ + url: string; +} + +/** The list of strings with server paging support. */ +export interface StringsList { + /** The collection of pageable items. */ + value: string[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Update file basic metadata. */ +export interface UpdateFileBase { + /** File name. */ + fileName: string; + /** File size in number of bytes. */ + sizeInBytes: number; + /** Mapping of hashing algorithm to base64 encoded hash values. */ + hashes: { [propertyName: string]: string }; + /** File MIME type. */ + mimeType?: string; + /** Anti-malware scan result. */ + scanResult?: string; + /** Anti-malware scan details. */ + scanDetails?: string; + /** Optional file properties (not consumed by service but pass-through to device). */ + properties?: { [propertyName: string]: string }; +} + +/** Download handler for utilizing related files to download payload file. */ +export interface UpdateFileDownloadHandler { + /** Download handler identifier. */ + id: string; +} + +/** The list of operations with server paging support. */ +export interface UpdateOperationsList { + /** The collection of pageable items. */ + value: UpdateOperation[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Operation metadata. */ +export interface UpdateOperation { + /** Operation Id. */ + operationId: string; + /** Operation status. */ + status: OperationStatus; + /** The update being imported or deleted. For import, this property will only be populated after import manifest is processed successfully. */ + update?: UpdateInfo; + /** Location of the imported update when operation is successful. */ + resourceLocation?: string; + /** Operation error encountered, if any. */ + error?: ErrorModel; + /** Operation correlation identity that can used by Microsoft Support for troubleshooting. */ + traceId?: string; + /** Date and time in UTC when the operation status was last updated. */ + lastActionDateTime: Date; + /** Date and time in UTC when the operation was created. */ + createdDateTime: Date; + /** Operation ETag. */ + etag?: string; +} + +/** Update information. */ +export interface UpdateInfo { + /** Update identifier. */ + updateId: UpdateId; + /** + * Update description. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; + /** + * Friendly update name. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly friendlyName?: string; +} + +/** The list of device classes. */ +export interface DeviceClassesList { + /** The collection of pageable items. */ + value: DeviceClass[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Device class metadata. */ +export interface DeviceClass { + /** The device class identifier. */ + deviceClassId: string; + /** The device class friendly name. This can be updated by callers after the device class has been automatically created. */ + friendlyName?: string; + /** The device class properties that are used to calculate the device class Id */ + deviceClassProperties: DeviceClassProperties; + /** Update that is best compatible with this device class. */ + bestCompatibleUpdate?: UpdateInfo; +} + +/** The device class properties that are used to calculate the device class Id */ +export interface DeviceClassProperties { + /** The Device Update agent contract model. */ + contractModel?: ContractModel; + /** The compat properties of the device class. This object can be thought of as a set of key-value pairs where the key is the name of the compatibility property and the value is the value of the compatibility property. There will always be at least 1 compat property */ + compatProperties: { [propertyName: string]: string }; +} + +/** The Device Update agent contract model. */ +export interface ContractModel { + /** The Device Update agent contract model Id of the device class. This is also used to calculate the device class Id. */ + id: string; + /** The Device Update agent contract model name of the device class. Intended to be a more readable form of the contract model Id. */ + name: string; +} + +/** Device Class JSON Merge Patch request body */ +export interface PatchBody { + /** The device class friendly name. */ + friendlyName: string; +} + +/** List of update information. */ +export interface UpdateInfoList { + /** The collection of pageable items. */ + value: UpdateInfo[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** The list of devices. */ +export interface DevicesList { + /** The collection of pageable items. */ + value: Device[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Device metadata. */ +export interface Device { + /** Device identity. */ + deviceId: string; + /** Device module identity. */ + moduleId?: string; + /** Device class identity. */ + deviceClassId: string; + /** Device group identity. */ + groupId?: string; + /** The update that device last attempted to install. */ + lastAttemptedUpdate?: UpdateInfo; + /** State of the device in its last deployment. */ + deploymentStatus?: DeviceDeploymentState; + /** Currently installed update on device. */ + installedUpdate?: UpdateInfo; + /** Boolean flag indicating whether the latest update is installed on the device */ + onLatestUpdate: boolean; + /** The deployment identifier for the last deployment to the device */ + lastDeploymentId?: string; + /** Last install result. */ + lastInstallResult?: InstallResult; +} + +/** The install result of an update and any step results under it. */ +export interface InstallResult { + /** Install result code. */ + resultCode: number; + /** Install extended result code */ + extendedResultCode: number; + /** A string containing further details about the install result */ + resultDetails?: string; + /** Array of step results */ + stepResults?: StepResult[]; +} + +/** The step result under an update. */ +export interface StepResult { + /** The update that this step installs if it is of reference type. */ + update?: UpdateInfo; + /** Step description. */ + description?: string; + /** Install result code. */ + resultCode: number; + /** Install extended result code */ + extendedResultCode: number; + /** A string containing further details about the install result */ + resultDetails?: string; +} + +/** Update compliance information. */ +export interface UpdateCompliance { + /** Total number of devices. */ + totalDeviceCount: number; + /** Number of devices on the latest update. */ + onLatestUpdateDeviceCount: number; + /** Number of devices with a newer update available. */ + newUpdatesAvailableDeviceCount: number; + /** Number of devices with update in-progress. */ + updatesInProgressDeviceCount: number; +} + +/** The list of groups. */ +export interface GroupsList { + /** The collection of pageable items. */ + value: Group[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Group details. */ +export interface Group { + /** Group identity. */ + groupId: string; + /** Group type. */ + groupType: GroupType; + /** Date and time when the update was created. */ + createdDateTime: string; + /** The number of devices in the group. */ + deviceCount?: number; + /** The count of subgroups with new updates available. */ + subgroupsWithNewUpdatesAvailableCount?: number; + /** The count of subgroups with updates in progress. */ + subgroupsWithUpdatesInProgressCount?: number; + /** The count of subgroups with devices on the latest update. */ + subgroupsWithOnLatestUpdateCount?: number; + /** The active deployment Ids for the group */ + deployments?: string[]; +} + +/** The list of updatable devices for a device class subgroup. */ +export interface DeviceClassSubgroupUpdatableDevicesList { + /** The collection of pageable items. */ + value: DeviceClassSubgroupUpdatableDevices[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Device class subgroup, update information, and the number of devices for which the update is applicable. */ +export interface DeviceClassSubgroupUpdatableDevices { + /** The group Id */ + groupId: string; + /** The device class subgroup's device class Id */ + deviceClassId: string; + /** Update information. */ + update: UpdateInfo; + /** Total number of devices for which the update is applicable. */ + deviceCount: number; +} + +/** The list of deployments. */ +export interface DeploymentsList { + /** The collection of pageable items. */ + value: Deployment[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Deployment metadata. */ +export interface Deployment { + /** The deployment identifier. */ + deploymentId: string; + /** The deployment start datetime. */ + startDateTime: Date; + /** Update information. */ + update: UpdateInfo; + /** The group identity */ + groupId: string; + /** The device class subgroups for the deployment. */ + deviceClassSubgroups?: string[]; + /** Boolean flag indicating whether the deployment was canceled. */ + isCanceled?: boolean; + /** Boolean flag indicating whether the deployment has been retried. */ + isRetried?: boolean; + /** The rollback policy for the deployment. */ + rollbackPolicy?: CloudInitiatedRollbackPolicy; + /** Boolean flag indicating whether the deployment is a rollback deployment. */ + isCloudInitiatedRollback?: boolean; +} + +/** Rollback policy for deployment */ +export interface CloudInitiatedRollbackPolicy { + /** Update to rollback to. */ + update: UpdateInfo; + /** Failure conditions to initiate rollback policy. */ + failure: CloudInitiatedRollbackPolicyFailure; +} + +/** Failure conditions to initiate rollback policy */ +export interface CloudInitiatedRollbackPolicyFailure { + /** Percentage of devices that failed. */ + devicesFailedPercentage: number; + /** Number of devices that failed. */ + devicesFailedCount: number; +} + +/** Deployment status metadata. */ +export interface DeploymentStatus { + /** The group identity */ + groupId: string; + /** The state of the deployment. */ + deploymentState: DeploymentState; + /** The error details of the Failed state. This is not present if the deployment state is not Failed. */ + error?: ErrorModel; + /** The collection of device class subgroup status objects */ + subgroupStatus: DeviceClassSubgroupDeploymentStatus[]; +} + +/** Device class subgroup deployment status metadata. */ +export interface DeviceClassSubgroupDeploymentStatus { + /** The group identity */ + groupId: string; + /** The device class subgroup identity */ + deviceClassId: string; + /** The state of the subgroup deployment. */ + deploymentState: DeviceClassSubgroupDeploymentState; + /** The error details of the Failed state. This is not present if the deployment state is not Failed. */ + error?: ErrorModel; + /** The total number of devices in the deployment. */ + totalDevices?: number; + /** The number of devices that are currently in deployment. */ + devicesInProgressCount?: number; + /** The number of devices that have completed deployment with a failure. */ + devicesCompletedFailedCount?: number; + /** The number of devices which have successfully completed deployment. */ + devicesCompletedSucceededCount?: number; + /** The number of devices which have had their deployment canceled. */ + devicesCanceledCount?: number; +} + +/** The list of device class subgroups within a group. */ +export interface DeviceClassSubgroupsList { + /** The collection of pageable items. */ + value: DeviceClassSubgroup[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Device class subgroup details. */ +export interface DeviceClassSubgroup { + /** Device class subgroup identity. */ + deviceClassId: string; + /** Group identity. */ + groupId: string; + /** Date and time when the deviceclass subgroup was created. */ + createdDateTime: string; + /** The number of devices in the deviceclass subgroup. */ + deviceCount?: number; + /** The active deployment Id for the deviceclass subgroup. */ + deploymentId?: string; +} + +/** The list of deployment device states. */ +export interface DeploymentDeviceStatesList { + /** The collection of pageable items. */ + value: DeploymentDeviceState[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Deployment device status. */ +export interface DeploymentDeviceState { + /** Device identity. */ + deviceId: string; + /** Device module identity. */ + moduleId?: string; + /** The number of times this deployment has been retried on this device. */ + retryCount: number; + /** Boolean flag indicating whether this device is in a newer deployment and can no longer retry this deployment. */ + movedOnToNewDeployment: boolean; + /** Deployment device state. */ + deviceState: DeviceDeploymentState; +} + +/** Operation metadata. */ +export interface DeviceOperation { + /** Operation Id. */ + operationId: string; + /** Operation status. */ + status: OperationStatus; + /** Operation error encountered, if any. */ + error?: ErrorModel; + /** Operation correlation identity that can used by Microsoft Support for troubleshooting. */ + traceId?: string; + /** Date and time in UTC when the operation status was last updated. */ + lastActionDateTime: Date; + /** Date and time in UTC when the operation was created. */ + createdDateTime: Date; + /** Operation ETag. */ + etag?: string; +} + +/** The list of device operations with server paging support. */ +export interface DeviceOperationsList { + /** The collection of pageable items. */ + value: DeviceOperation[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Diagnostics request body */ +export interface LogCollectionOperation { + /** The diagnostics operation id. */ + operationId?: string; + /** Array of Device Update agent ids */ + deviceList: DeviceUpdateAgentId[]; + /** Description of the diagnostics operation. */ + description?: string; + /** + * The timestamp when the operation was created. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly createdDateTime?: string; + /** + * A timestamp for when the current state was entered. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastActionDateTime?: string; + /** + * Operation status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly status?: OperationStatus; +} + +/** Device Update agent id */ +export interface DeviceUpdateAgentId { + /** Device Id */ + deviceId: string; + /** Module Id */ + moduleId?: string; +} + +/** The list of diagnostics operations with server paging support. */ +export interface LogCollectionOperationList { + /** The collection of pageable items. */ + value: LogCollectionOperation[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Device diagnostics operation detailed status */ +export interface LogCollectionOperationDetailedStatus { + /** The device diagnostics operation id. */ + operationId?: string; + /** The timestamp when the operation was created. */ + createdDateTime?: string; + /** A timestamp for when the current state was entered. */ + lastActionDateTime?: string; + /** Operation status. */ + status?: OperationStatus; + /** Status of the devices in the operation */ + deviceStatus?: LogCollectionOperationDeviceStatus[]; + /** Device diagnostics operation description. */ + description?: string; +} + +/** Diagnostics operation device status */ +export interface LogCollectionOperationDeviceStatus { + /** Device id */ + deviceId: string; + /** Module id. */ + moduleId?: string; + /** Log upload status */ + status: OperationStatus; + /** Log upload result code */ + resultCode?: string; + /** Log upload extended result code */ + extendedResultCode?: string; + /** Log upload location */ + logLocation?: string; +} + +/** Array of Device Health, with server paging support. */ +export interface DeviceHealthList { + /** The collection of pageable items. */ + value: DeviceHealth[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Device Health */ +export interface DeviceHealth { + /** Device id */ + deviceId: string; + /** Module id */ + moduleId?: string; + /** Aggregate device health state */ + state: DeviceHealthState; + /** Digital twin model Id */ + digitalTwinModelId?: string; + /** Array of health checks and their results */ + healthChecks: HealthCheck[]; +} + +/** Health check */ +export interface HealthCheck { + /** Health check name */ + name?: string; + /** Health check result */ + result?: HealthCheckResult; +} + +/** Device filter. */ +export interface DeviceFilter { + /** Device group identity. */ + groupId?: string; + /** Device class identity. */ + deviceClassId?: string; + /** State of the device in its last deployment. */ + deploymentStatus?: DeviceDeploymentState; +} + +/** Update filter. */ +export interface UpdateFilter { + /** Update isDeployable property. */ + isDeployable?: boolean; +} + +/** Operation status filter. */ +export interface OperationFilter { + /** Operation status filter. */ + status?: OperationFilterStatus; +} + +/** Groups order by. */ +export interface GroupOrderBy { + /** The group Id. */ + groupId?: string; + /** The group device count. */ + deviceCount?: string; + /** The group created date. */ + createdDate?: string; + /** The number of subgroups with new updates available */ + subgroupsWithNewUpdatesAvailableCount?: string; + /** The number of subgroups with updates in progress */ + subgroupsWithUpdatesInProgressCount?: string; + /** The number of subgroups with devices on the latest update */ + subgroupsOnLatestUpdateCount?: string; +} + +/** Deployment order by. */ +export interface DeploymentOrderBy { + /** The deployment start datetime. */ + startDateTime?: Date; +} + +/** Deployment device state filter. */ +export interface DeploymentDeviceStatesFilter { + /** Device Identifier. */ + deviceId?: string; + /** Device module Identifier. */ + moduleId?: string; + /** The deployment device state. */ + deviceState?: DeviceState; +} + +/** The list of diagnostics operations with detailed status, with server paging support. */ +export interface LogCollectionOperationDetailedStatusList { + /** The collection of pageable items. */ + value: LogCollectionOperationDetailedStatus[]; + /** The link to the next page of items. */ + nextLink?: string; +} + +/** Device health filter. */ +export interface DeviceHealthFilter { + /** Device health state */ + state?: DeviceHealthState; + /** Device Id */ + deviceId?: string; + /** Module Id */ + moduleId?: string; +} + +/** Update file metadata. */ +export type UpdateFile = UpdateFileBase & { + /** File identity, generated by server at import time. */ + fileId: string; + /** Optional related files metadata used together DownloadHandler metadata to download payload file. */ + relatedFiles?: UpdateFileBase[]; + /** Optional download handler for utilizing related files to download payload file. */ + downloadHandler?: UpdateFileDownloadHandler; + /** File ETag. */ + etag?: string; +}; + +/** Defines headers for DeviceUpdate_importUpdate operation. */ +export interface DeviceUpdateImportUpdateHeaders { + /** Url to retrieve the import operation status. */ + operationLocation?: string; +} + +/** Defines headers for DeviceUpdate_deleteUpdate operation. */ +export interface DeviceUpdateDeleteUpdateHeaders { + /** Url to retrieve the operation status */ + operationLocation?: string; +} + +/** Defines headers for DeviceUpdate_getOperation operation. */ +export interface DeviceUpdateGetOperationHeaders { + /** Number of seconds to wait before checking the operation status again. */ + retryAfter?: string; +} + +/** Defines headers for DeviceManagement_importDevices operation. */ +export interface DeviceManagementImportDevicesHeaders { + /** Url to retrieve the device import operation status. */ + operationLocation?: string; +} + +/** Defines headers for DeviceManagement_getOperation operation. */ +export interface DeviceManagementGetOperationHeaders { + /** Number of seconds to wait before checking the operation status again. */ + retryAfter?: string; +} + +/** Parameter group */ +export interface AccessCondition { + /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */ + ifNoneMatch?: string; +} + +/** Known values of {@link StepType} that the service accepts. */ +export enum KnownStepType { + /** Step type that performs code execution. */ + Inline = "Inline", + /** Step type that installs another update. */ + Reference = "Reference" +} + +/** + * Defines values for StepType. \ + * {@link KnownStepType} can be used interchangeably with StepType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Inline**: Step type that performs code execution. \ + * **Reference**: Step type that installs another update. + */ +export type StepType = string; + +/** Known values of {@link OperationStatus} that the service accepts. */ +export enum KnownOperationStatus { + /** Background operation created but not started yet. */ + NotStarted = "NotStarted", + /** Background operation is currently running. */ + Running = "Running", + /** Background operation finished with success. */ + Succeeded = "Succeeded", + /** Background operation finished with failure. */ + Failed = "Failed" +} + +/** + * Defines values for OperationStatus. \ + * {@link KnownOperationStatus} can be used interchangeably with OperationStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotStarted**: Background operation created but not started yet. \ + * **Running**: Background operation is currently running. \ + * **Succeeded**: Background operation finished with success. \ + * **Failed**: Background operation finished with failure. + */ +export type OperationStatus = string; + +/** Known values of {@link DeviceDeploymentState} that the service accepts. */ +export enum KnownDeviceDeploymentState { + /** Deployment has completed with success. */ + Succeeded = "Succeeded", + /** Deployment is in progress. */ + InProgress = "InProgress", + /** Deployment was canceled. */ + Canceled = "Canceled", + /** Deployment has completed with failure. */ + Failed = "Failed" +} + +/** + * Defines values for DeviceDeploymentState. \ + * {@link KnownDeviceDeploymentState} can be used interchangeably with DeviceDeploymentState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: Deployment has completed with success. \ + * **InProgress**: Deployment is in progress. \ + * **Canceled**: Deployment was canceled. \ + * **Failed**: Deployment has completed with failure. + */ +export type DeviceDeploymentState = string; + +/** Known values of {@link ImportType} that the service accepts. */ +export enum KnownImportType { + /** Import only devices but not modules. */ + Devices = "Devices", + /** Import only modules but not devices. */ + Modules = "Modules", + /** Import both devices and modules. */ + All = "All" +} + +/** + * Defines values for ImportType. \ + * {@link KnownImportType} can be used interchangeably with ImportType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Devices**: Import only devices but not modules. \ + * **Modules**: Import only modules but not devices. \ + * **All**: Import both devices and modules. + */ +export type ImportType = string; + +/** Known values of {@link GroupType} that the service accepts. */ +export enum KnownGroupType { + /** IoT Hub tag based group, all devices in the group share an ADUGroup tag value. */ + IoTHubTag = "IoTHubTag", + /** Default group for untagged devices. */ + DefaultNoTag = "DefaultNoTag" +} + +/** + * Defines values for GroupType. \ + * {@link KnownGroupType} can be used interchangeably with GroupType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **IoTHubTag**: IoT Hub tag based group, all devices in the group share an ADUGroup tag value. \ + * **DefaultNoTag**: Default group for untagged devices. + */ +export type GroupType = string; + +/** Known values of {@link DeploymentState} that the service accepts. */ +export enum KnownDeploymentState { + /** The deployment can be sent to devices targeted in the deployment. */ + Active = "Active", + /** The deployment can be sent to some devices targeted in the deployment but at least 1 subgroup is in a failed state. */ + ActiveWithSubgroupFailures = "ActiveWithSubgroupFailures", + /** The deployment will not be sent to any devices. Consult error for more details about what failed. */ + Failed = "Failed", + /** A newer deployment for this group has been created and no devices in the group will receive this deployment. */ + Inactive = "Inactive", + /** The deployment has been canceled and no devices will receive it. */ + Canceled = "Canceled" +} + +/** + * Defines values for DeploymentState. \ + * {@link KnownDeploymentState} can be used interchangeably with DeploymentState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active**: The deployment can be sent to devices targeted in the deployment. \ + * **ActiveWithSubgroupFailures**: The deployment can be sent to some devices targeted in the deployment but at least 1 subgroup is in a failed state. \ + * **Failed**: The deployment will not be sent to any devices. Consult error for more details about what failed. \ + * **Inactive**: A newer deployment for this group has been created and no devices in the group will receive this deployment. \ + * **Canceled**: The deployment has been canceled and no devices will receive it. + */ +export type DeploymentState = string; + +/** Known values of {@link DeviceClassSubgroupDeploymentState} that the service accepts. */ +export enum KnownDeviceClassSubgroupDeploymentState { + /** The subgroup deployment can be sent to devices targeted in the deployment. */ + Active = "Active", + /** The subgroup deployment failed and will not be sent to any devices. */ + Failed = "Failed", + /** A newer deployment for this subgroup has been created and no devices in the subgroup will receive this deployment. */ + Inactive = "Inactive", + /** The subgroup deployment has been canceled and no devices will receive it. */ + Canceled = "Canceled" +} + +/** + * Defines values for DeviceClassSubgroupDeploymentState. \ + * {@link KnownDeviceClassSubgroupDeploymentState} can be used interchangeably with DeviceClassSubgroupDeploymentState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active**: The subgroup deployment can be sent to devices targeted in the deployment. \ + * **Failed**: The subgroup deployment failed and will not be sent to any devices. \ + * **Inactive**: A newer deployment for this subgroup has been created and no devices in the subgroup will receive this deployment. \ + * **Canceled**: The subgroup deployment has been canceled and no devices will receive it. + */ +export type DeviceClassSubgroupDeploymentState = string; + +/** Known values of {@link DeviceHealthState} that the service accepts. */ +export enum KnownDeviceHealthState { + /** Agent is healthy */ + Healthy = "healthy", + /** Agent is in an unhealthy state */ + Unhealthy = "unhealthy" +} + +/** + * Defines values for DeviceHealthState. \ + * {@link KnownDeviceHealthState} can be used interchangeably with DeviceHealthState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **healthy**: Agent is healthy \ + * **unhealthy**: Agent is in an unhealthy state + */ +export type DeviceHealthState = string; + +/** Known values of {@link HealthCheckResult} that the service accepts. */ +export enum KnownHealthCheckResult { + /** Health check succeeded */ + Success = "success", + /** Health check failed due to user error */ + UserError = "userError" +} + +/** + * Defines values for HealthCheckResult. \ + * {@link KnownHealthCheckResult} can be used interchangeably with HealthCheckResult, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **success**: Health check succeeded \ + * **userError**: Health check failed due to user error + */ +export type HealthCheckResult = string; + +/** Known values of {@link OperationFilterStatus} that the service accepts. */ +export enum KnownOperationFilterStatus { + Running = "Running", + NotStarted = "NotStarted" +} + +/** + * Defines values for OperationFilterStatus. \ + * {@link KnownOperationFilterStatus} can be used interchangeably with OperationFilterStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Running** \ + * **NotStarted** + */ +export type OperationFilterStatus = string; + +/** Known values of {@link DeviceState} that the service accepts. */ +export enum KnownDeviceState { + /** Not started (or uninitialized) */ + NotStarted = "NotStarted", + /** Deployment incompatible for this device. */ + Incompatible = "Incompatible", + /** Another Deployment is underway for this device. */ + AlreadyInDeployment = "AlreadyInDeployment", + /** Deployment has been canceled for this device. */ + Canceled = "Canceled", + /** Deployment underway. */ + InProgress = "InProgress", + /** Deployment failed. */ + Failed = "Failed", + /** Deployment completed successfully. */ + Succeeded = "Succeeded" +} + +/** + * Defines values for DeviceState. \ + * {@link KnownDeviceState} can be used interchangeably with DeviceState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotStarted**: Not started (or uninitialized) \ + * **Incompatible**: Deployment incompatible for this device. \ + * **AlreadyInDeployment**: Another Deployment is underway for this device. \ + * **Canceled**: Deployment has been canceled for this device. \ + * **InProgress**: Deployment underway. \ + * **Failed**: Deployment failed. \ + * **Succeeded**: Deployment completed successfully. + */ +export type DeviceState = string; + +/** Optional parameters. */ +export interface DeviceUpdateListUpdatesOptionalParams + extends coreClient.OperationOptions { + /** Request updates matching a free-text search expression. */ + search?: string; + /** Filter updates by its properties. */ + filter?: string; +} + +/** Contains response data for the listUpdates operation. */ +export type DeviceUpdateListUpdatesResponse = UpdateList; + +/** Optional parameters. */ +export interface DeviceUpdateImportUpdateOptionalParams + 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 importUpdate operation. */ +export type DeviceUpdateImportUpdateResponse = DeviceUpdateImportUpdateHeaders; + +/** Optional parameters. */ +export interface DeviceUpdateGetUpdateOptionalParams + extends coreClient.OperationOptions { + /** Parameter group */ + accessCondition?: AccessCondition; +} + +/** Contains response data for the getUpdate operation. */ +export type DeviceUpdateGetUpdateResponse = Update; + +/** Optional parameters. */ +export interface DeviceUpdateDeleteUpdateOptionalParams + 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 deleteUpdate operation. */ +export type DeviceUpdateDeleteUpdateResponse = DeviceUpdateDeleteUpdateHeaders; + +/** Optional parameters. */ +export interface DeviceUpdateListProvidersOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listProviders operation. */ +export type DeviceUpdateListProvidersResponse = StringsList; + +/** Optional parameters. */ +export interface DeviceUpdateListNamesOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNames operation. */ +export type DeviceUpdateListNamesResponse = StringsList; + +/** Optional parameters. */ +export interface DeviceUpdateListVersionsOptionalParams + extends coreClient.OperationOptions { + /** Filter updates by its properties. */ + filter?: string; +} + +/** Contains response data for the listVersions operation. */ +export type DeviceUpdateListVersionsResponse = StringsList; + +/** Optional parameters. */ +export interface DeviceUpdateListFilesOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listFiles operation. */ +export type DeviceUpdateListFilesResponse = StringsList; + +/** Optional parameters. */ +export interface DeviceUpdateGetFileOptionalParams + extends coreClient.OperationOptions { + /** Parameter group */ + accessCondition?: AccessCondition; +} + +/** Contains response data for the getFile operation. */ +export type DeviceUpdateGetFileResponse = UpdateFile; + +/** Optional parameters. */ +export interface DeviceUpdateListOperationsOptionalParams + extends coreClient.OperationOptions { + /** Restricts the set of operations returned. Only one specific filter is supported: "status eq 'NotStarted' or status eq 'Running'" */ + filter?: string; + /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */ + top?: number; +} + +/** Contains response data for the listOperations operation. */ +export type DeviceUpdateListOperationsResponse = UpdateOperationsList; + +/** Optional parameters. */ +export interface DeviceUpdateGetOperationOptionalParams + extends coreClient.OperationOptions { + /** Parameter group */ + accessCondition?: AccessCondition; +} + +/** Contains response data for the getOperation operation. */ +export type DeviceUpdateGetOperationResponse = DeviceUpdateGetOperationHeaders & + UpdateOperation; + +/** Optional parameters. */ +export interface DeviceUpdateListUpdatesNextOptionalParams + extends coreClient.OperationOptions { + /** Request updates matching a free-text search expression. */ + search?: string; + /** Filter updates by its properties. */ + filter?: string; +} + +/** Contains response data for the listUpdatesNext operation. */ +export type DeviceUpdateListUpdatesNextResponse = UpdateList; + +/** Optional parameters. */ +export interface DeviceUpdateListProvidersNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listProvidersNext operation. */ +export type DeviceUpdateListProvidersNextResponse = StringsList; + +/** Optional parameters. */ +export interface DeviceUpdateListNamesNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNamesNext operation. */ +export type DeviceUpdateListNamesNextResponse = StringsList; + +/** Optional parameters. */ +export interface DeviceUpdateListVersionsNextOptionalParams + extends coreClient.OperationOptions { + /** Filter updates by its properties. */ + filter?: string; +} + +/** Contains response data for the listVersionsNext operation. */ +export type DeviceUpdateListVersionsNextResponse = StringsList; + +/** Optional parameters. */ +export interface DeviceUpdateListFilesNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listFilesNext operation. */ +export type DeviceUpdateListFilesNextResponse = StringsList; + +/** Optional parameters. */ +export interface DeviceUpdateListOperationsNextOptionalParams + extends coreClient.OperationOptions { + /** Restricts the set of operations returned. Only one specific filter is supported: "status eq 'NotStarted' or status eq 'Running'" */ + filter?: string; + /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */ + top?: number; +} + +/** Contains response data for the listOperationsNext operation. */ +export type DeviceUpdateListOperationsNextResponse = UpdateOperationsList; + +/** Optional parameters. */ +export interface DeviceManagementListDeviceClassesOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listDeviceClasses operation. */ +export type DeviceManagementListDeviceClassesResponse = DeviceClassesList; + +/** Optional parameters. */ +export interface DeviceManagementGetDeviceClassOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDeviceClass operation. */ +export type DeviceManagementGetDeviceClassResponse = DeviceClass; + +/** Optional parameters. */ +export interface DeviceManagementUpdateDeviceClassOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the updateDeviceClass operation. */ +export type DeviceManagementUpdateDeviceClassResponse = DeviceClass; + +/** Optional parameters. */ +export interface DeviceManagementDeleteDeviceClassOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface DeviceManagementListInstallableUpdatesForDeviceClassOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listInstallableUpdatesForDeviceClass operation. */ +export type DeviceManagementListInstallableUpdatesForDeviceClassResponse = UpdateInfoList; + +/** Optional parameters. */ +export interface DeviceManagementListDevicesOptionalParams + extends coreClient.OperationOptions { + /** Restricts the set of devices returned. You can filter on GroupId, DeviceClassId, or GroupId and DeploymentStatus. */ + filter?: string; +} + +/** Contains response data for the listDevices operation. */ +export type DeviceManagementListDevicesResponse = DevicesList; + +/** Optional parameters. */ +export interface DeviceManagementImportDevicesOptionalParams + 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 importDevices operation. */ +export type DeviceManagementImportDevicesResponse = DeviceManagementImportDevicesHeaders; + +/** Optional parameters. */ +export interface DeviceManagementGetDeviceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDevice operation. */ +export type DeviceManagementGetDeviceResponse = Device; + +/** Optional parameters. */ +export interface DeviceManagementGetDeviceModuleOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDeviceModule operation. */ +export type DeviceManagementGetDeviceModuleResponse = Device; + +/** Optional parameters. */ +export interface DeviceManagementGetUpdateComplianceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getUpdateCompliance operation. */ +export type DeviceManagementGetUpdateComplianceResponse = UpdateCompliance; + +/** Optional parameters. */ +export interface DeviceManagementListGroupsOptionalParams + extends coreClient.OperationOptions { + /** Orders the set of groups returned. You can order by any combination of groupId, device count, created date, subgroupsWithNewUpdatesAvailableCount, subgroupsWithUpdatesInProgressCount, or subgroupsOnLatestUpdateCount. */ + orderby?: string; +} + +/** Contains response data for the listGroups operation. */ +export type DeviceManagementListGroupsResponse = GroupsList; + +/** Optional parameters. */ +export interface DeviceManagementGetGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getGroup operation. */ +export type DeviceManagementGetGroupResponse = Group; + +/** Optional parameters. */ +export interface DeviceManagementDeleteGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface DeviceManagementGetGroupUpdateComplianceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getGroupUpdateCompliance operation. */ +export type DeviceManagementGetGroupUpdateComplianceResponse = UpdateCompliance; + +/** Optional parameters. */ +export interface DeviceManagementListBestUpdatesForGroupOptionalParams + extends coreClient.OperationOptions { + /** Restricts the set of bestUpdates returned. You can filter on update Provider, Name and Version property. */ + filter?: string; +} + +/** Contains response data for the listBestUpdatesForGroup operation. */ +export type DeviceManagementListBestUpdatesForGroupResponse = DeviceClassSubgroupUpdatableDevicesList; + +/** Optional parameters. */ +export interface DeviceManagementListDeploymentsForGroupOptionalParams + extends coreClient.OperationOptions { + /** Orders the set of deployments returned. You can order by start date. */ + orderby?: string; +} + +/** Contains response data for the listDeploymentsForGroup operation. */ +export type DeviceManagementListDeploymentsForGroupResponse = DeploymentsList; + +/** Optional parameters. */ +export interface DeviceManagementGetDeploymentOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDeployment operation. */ +export type DeviceManagementGetDeploymentResponse = Deployment; + +/** Optional parameters. */ +export interface DeviceManagementCreateOrUpdateDeploymentOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdateDeployment operation. */ +export type DeviceManagementCreateOrUpdateDeploymentResponse = Deployment; + +/** Optional parameters. */ +export interface DeviceManagementDeleteDeploymentOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface DeviceManagementGetDeploymentStatusOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDeploymentStatus operation. */ +export type DeviceManagementGetDeploymentStatusResponse = DeploymentStatus; + +/** Optional parameters. */ +export interface DeviceManagementListDeviceClassSubgroupsForGroupOptionalParams + extends coreClient.OperationOptions { + /** Restricts the set of device class subgroups returned. You can filter on compat properties by name and value. */ + filter?: string; +} + +/** Contains response data for the listDeviceClassSubgroupsForGroup operation. */ +export type DeviceManagementListDeviceClassSubgroupsForGroupResponse = DeviceClassSubgroupsList; + +/** Optional parameters. */ +export interface DeviceManagementGetDeviceClassSubgroupDetailsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDeviceClassSubgroupDetails operation. */ +export type DeviceManagementGetDeviceClassSubgroupDetailsResponse = DeviceClassSubgroup; + +/** Optional parameters. */ +export interface DeviceManagementDeleteDeviceClassSubgroupOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface DeviceManagementGetDeviceClassSubgroupUpdateComplianceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDeviceClassSubgroupUpdateCompliance operation. */ +export type DeviceManagementGetDeviceClassSubgroupUpdateComplianceResponse = UpdateCompliance; + +/** Optional parameters. */ +export interface DeviceManagementListBestUpdatesForDeviceClassSubgroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBestUpdatesForDeviceClassSubgroup operation. */ +export type DeviceManagementListBestUpdatesForDeviceClassSubgroupResponse = DeviceClassSubgroupUpdatableDevices; + +/** Optional parameters. */ +export interface DeviceManagementListDeploymentsForDeviceClassSubgroupOptionalParams + extends coreClient.OperationOptions { + /** Orders the set of deployments returned. You can order by start date. */ + orderby?: string; +} + +/** Contains response data for the listDeploymentsForDeviceClassSubgroup operation. */ +export type DeviceManagementListDeploymentsForDeviceClassSubgroupResponse = DeploymentsList; + +/** Optional parameters. */ +export interface DeviceManagementGetDeploymentForDeviceClassSubgroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDeploymentForDeviceClassSubgroup operation. */ +export type DeviceManagementGetDeploymentForDeviceClassSubgroupResponse = Deployment; + +/** Optional parameters. */ +export interface DeviceManagementDeleteDeviceClassSubgroupDeploymentOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface DeviceManagementStopDeploymentOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the stopDeployment operation. */ +export type DeviceManagementStopDeploymentResponse = Deployment; + +/** Optional parameters. */ +export interface DeviceManagementRetryDeploymentOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the retryDeployment operation. */ +export type DeviceManagementRetryDeploymentResponse = Deployment; + +/** Optional parameters. */ +export interface DeviceManagementGetDeviceClassSubgroupDeploymentStatusOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDeviceClassSubgroupDeploymentStatus operation. */ +export type DeviceManagementGetDeviceClassSubgroupDeploymentStatusResponse = DeviceClassSubgroupDeploymentStatus; + +/** Optional parameters. */ +export interface DeviceManagementListDevicesForDeviceClassSubgroupDeploymentOptionalParams + extends coreClient.OperationOptions { + /** Restricts the set of deployment device states returned. You can filter on deviceId and moduleId and/or deviceState. */ + filter?: string; +} + +/** Contains response data for the listDevicesForDeviceClassSubgroupDeployment operation. */ +export type DeviceManagementListDevicesForDeviceClassSubgroupDeploymentResponse = DeploymentDeviceStatesList; + +/** Optional parameters. */ +export interface DeviceManagementGetOperationOptionalParams + extends coreClient.OperationOptions { + /** Parameter group */ + accessCondition?: AccessCondition; +} + +/** Contains response data for the getOperation operation. */ +export type DeviceManagementGetOperationResponse = DeviceManagementGetOperationHeaders & + DeviceOperation; + +/** Optional parameters. */ +export interface DeviceManagementListOperationsOptionalParams + extends coreClient.OperationOptions { + /** Restricts the set of operations returned. Only one specific filter is supported: "status eq 'NotStarted' or status eq 'Running'" */ + filter?: string; + /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */ + top?: number; +} + +/** Contains response data for the listOperations operation. */ +export type DeviceManagementListOperationsResponse = DeviceOperationsList; + +/** Optional parameters. */ +export interface DeviceManagementCollectLogsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the collectLogs operation. */ +export type DeviceManagementCollectLogsResponse = LogCollectionOperation; + +/** Optional parameters. */ +export interface DeviceManagementGetLogCollectionOperationOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getLogCollectionOperation operation. */ +export type DeviceManagementGetLogCollectionOperationResponse = LogCollectionOperation; + +/** Optional parameters. */ +export interface DeviceManagementListLogCollectionOperationsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listLogCollectionOperations operation. */ +export type DeviceManagementListLogCollectionOperationsResponse = LogCollectionOperationList; + +/** Optional parameters. */ +export interface DeviceManagementGetLogCollectionOperationDetailedStatusOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getLogCollectionOperationDetailedStatus operation. */ +export type DeviceManagementGetLogCollectionOperationDetailedStatusResponse = LogCollectionOperationDetailedStatus; + +/** Optional parameters. */ +export interface DeviceManagementListDeviceHealthOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listDeviceHealth operation. */ +export type DeviceManagementListDeviceHealthResponse = DeviceHealthList; + +/** Optional parameters. */ +export interface DeviceManagementListDeviceClassesNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listDeviceClassesNext operation. */ +export type DeviceManagementListDeviceClassesNextResponse = DeviceClassesList; + +/** Optional parameters. */ +export interface DeviceManagementListInstallableUpdatesForDeviceClassNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listInstallableUpdatesForDeviceClassNext operation. */ +export type DeviceManagementListInstallableUpdatesForDeviceClassNextResponse = UpdateInfoList; + +/** Optional parameters. */ +export interface DeviceManagementListDevicesNextOptionalParams + extends coreClient.OperationOptions { + /** Restricts the set of devices returned. You can filter on GroupId, DeviceClassId, or GroupId and DeploymentStatus. */ + filter?: string; +} + +/** Contains response data for the listDevicesNext operation. */ +export type DeviceManagementListDevicesNextResponse = DevicesList; + +/** Optional parameters. */ +export interface DeviceManagementListGroupsNextOptionalParams + extends coreClient.OperationOptions { + /** Orders the set of groups returned. You can order by any combination of groupId, device count, created date, subgroupsWithNewUpdatesAvailableCount, subgroupsWithUpdatesInProgressCount, or subgroupsOnLatestUpdateCount. */ + orderby?: string; +} + +/** Contains response data for the listGroupsNext operation. */ +export type DeviceManagementListGroupsNextResponse = GroupsList; + +/** Optional parameters. */ +export interface DeviceManagementListBestUpdatesForGroupNextOptionalParams + extends coreClient.OperationOptions { + /** Restricts the set of bestUpdates returned. You can filter on update Provider, Name and Version property. */ + filter?: string; +} + +/** Contains response data for the listBestUpdatesForGroupNext operation. */ +export type DeviceManagementListBestUpdatesForGroupNextResponse = DeviceClassSubgroupUpdatableDevicesList; + +/** Optional parameters. */ +export interface DeviceManagementListDeploymentsForGroupNextOptionalParams + extends coreClient.OperationOptions { + /** Orders the set of deployments returned. You can order by start date. */ + orderby?: string; +} + +/** Contains response data for the listDeploymentsForGroupNext operation. */ +export type DeviceManagementListDeploymentsForGroupNextResponse = DeploymentsList; + +/** Optional parameters. */ +export interface DeviceManagementListDeploymentsForDeviceClassSubgroupNextOptionalParams + extends coreClient.OperationOptions { + /** Orders the set of deployments returned. You can order by start date. */ + orderby?: string; +} + +/** Contains response data for the listDeploymentsForDeviceClassSubgroupNext operation. */ +export type DeviceManagementListDeploymentsForDeviceClassSubgroupNextResponse = DeploymentsList; + +/** Optional parameters. */ +export interface DeviceManagementListDevicesForDeviceClassSubgroupDeploymentNextOptionalParams + extends coreClient.OperationOptions { + /** Restricts the set of deployment device states returned. You can filter on deviceId and moduleId and/or deviceState. */ + filter?: string; +} + +/** Contains response data for the listDevicesForDeviceClassSubgroupDeploymentNext operation. */ +export type DeviceManagementListDevicesForDeviceClassSubgroupDeploymentNextResponse = DeploymentDeviceStatesList; + +/** Optional parameters. */ +export interface DeviceManagementListOperationsNextOptionalParams + extends coreClient.OperationOptions { + /** Restricts the set of operations returned. Only one specific filter is supported: "status eq 'NotStarted' or status eq 'Running'" */ + filter?: string; + /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */ + top?: number; +} + +/** Contains response data for the listOperationsNext operation. */ +export type DeviceManagementListOperationsNextResponse = DeviceOperationsList; + +/** Optional parameters. */ +export interface DeviceManagementListLogCollectionOperationsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listLogCollectionOperationsNext operation. */ +export type DeviceManagementListLogCollectionOperationsNextResponse = LogCollectionOperationList; + +/** Optional parameters. */ +export interface DeviceUpdateClientOptionalParams + extends coreClient.ServiceClientOptions { + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/deviceupdate/device-update/src/models/mappers.ts b/sdk/deviceupdate/device-update/src/models/mappers.ts new file mode 100644 index 000000000000..b7e95db00768 --- /dev/null +++ b/sdk/deviceupdate/device-update/src/models/mappers.ts @@ -0,0 +1,2341 @@ +import * as coreClient from "@azure/core-client"; + +export const UpdateList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Update" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const Update: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Update", + modelProperties: { + updateId: { + serializedName: "updateId", + type: { + name: "Composite", + className: "UpdateId" + } + }, + description: { + constraints: { + MaxLength: 512, + MinLength: 1 + }, + serializedName: "description", + type: { + name: "String" + } + }, + friendlyName: { + constraints: { + MaxLength: 512, + MinLength: 1 + }, + serializedName: "friendlyName", + type: { + name: "String" + } + }, + isDeployable: { + defaultValue: true, + serializedName: "isDeployable", + type: { + name: "Boolean" + } + }, + updateType: { + serializedName: "updateType", + type: { + name: "String" + } + }, + installedCriteria: { + serializedName: "installedCriteria", + type: { + name: "String" + } + }, + compatibility: { + constraints: { + MinItems: 1, + MaxItems: 10 + }, + serializedName: "compatibility", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + }, + instructions: { + serializedName: "instructions", + type: { + name: "Composite", + className: "Instructions" + } + }, + referencedBy: { + constraints: { + MinItems: 1 + }, + serializedName: "referencedBy", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "UpdateId" + } + } + } + }, + scanResult: { + serializedName: "scanResult", + type: { + name: "String" + } + }, + manifestVersion: { + serializedName: "manifestVersion", + required: true, + type: { + name: "String" + } + }, + importedDateTime: { + serializedName: "importedDateTime", + required: true, + type: { + name: "DateTime" + } + }, + createdDateTime: { + serializedName: "createdDateTime", + required: true, + type: { + name: "DateTime" + } + }, + etag: { + serializedName: "etag", + type: { + name: "String" + } + } + } + } +}; + +export const UpdateId: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateId", + modelProperties: { + provider: { + serializedName: "provider", + required: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + }, + version: { + serializedName: "version", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const Instructions: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Instructions", + modelProperties: { + steps: { + constraints: { + MinItems: 1, + MaxItems: 10 + }, + serializedName: "steps", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Step" + } + } + } + } + } + } +}; + +export const Step: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Step", + modelProperties: { + type: { + defaultValue: "inline", + serializedName: "type", + type: { + name: "String" + } + }, + description: { + constraints: { + MaxLength: 64, + MinLength: 1 + }, + serializedName: "description", + type: { + name: "String" + } + }, + handler: { + constraints: { + MaxLength: 32, + MinLength: 1 + }, + serializedName: "handler", + type: { + name: "String" + } + }, + handlerProperties: { + serializedName: "handlerProperties", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + files: { + constraints: { + MinItems: 1, + MaxItems: 5 + }, + serializedName: "files", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + updateId: { + serializedName: "updateId", + type: { + name: "Composite", + className: "UpdateId" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorModel" + } + } + } + } +}; + +export const ErrorModel: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorModel", + modelProperties: { + code: { + serializedName: "code", + required: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + required: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorModel" + } + } + } + }, + innererror: { + serializedName: "innererror", + type: { + name: "Composite", + className: "InnerError" + } + }, + occurredDateTime: { + serializedName: "occurredDateTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const InnerError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "InnerError", + modelProperties: { + code: { + serializedName: "code", + required: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + errorDetail: { + serializedName: "errorDetail", + type: { + name: "String" + } + }, + innerError: { + serializedName: "innerError", + type: { + name: "Composite", + className: "InnerError" + } + } + } + } +}; + +export const ImportUpdateInputItem: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImportUpdateInputItem", + modelProperties: { + importManifest: { + serializedName: "importManifest", + type: { + name: "Composite", + className: "ImportManifestMetadata" + } + }, + friendlyName: { + constraints: { + MaxLength: 512, + MinLength: 1 + }, + serializedName: "friendlyName", + type: { + name: "String" + } + }, + files: { + constraints: { + MinItems: 1, + MaxItems: 5 + }, + serializedName: "files", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FileImportMetadata" + } + } + } + } + } + } +}; + +export const ImportManifestMetadata: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImportManifestMetadata", + modelProperties: { + url: { + serializedName: "url", + required: true, + type: { + name: "String" + } + }, + sizeInBytes: { + serializedName: "sizeInBytes", + required: true, + type: { + name: "Number" + } + }, + hashes: { + serializedName: "hashes", + required: true, + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const FileImportMetadata: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FileImportMetadata", + modelProperties: { + filename: { + serializedName: "filename", + required: true, + type: { + name: "String" + } + }, + url: { + serializedName: "url", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const StringsList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StringsList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const UpdateFileBase: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateFileBase", + modelProperties: { + fileName: { + serializedName: "fileName", + required: true, + type: { + name: "String" + } + }, + sizeInBytes: { + serializedName: "sizeInBytes", + required: true, + type: { + name: "Number" + } + }, + hashes: { + serializedName: "hashes", + required: true, + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + mimeType: { + serializedName: "mimeType", + type: { + name: "String" + } + }, + scanResult: { + serializedName: "scanResult", + type: { + name: "String" + } + }, + scanDetails: { + serializedName: "scanDetails", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const UpdateFileDownloadHandler: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateFileDownloadHandler", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const UpdateOperationsList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateOperationsList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "UpdateOperation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const UpdateOperation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateOperation", + modelProperties: { + operationId: { + serializedName: "operationId", + required: true, + type: { + name: "String" + } + }, + status: { + serializedName: "status", + required: true, + type: { + name: "String" + } + }, + update: { + serializedName: "update", + type: { + name: "Composite", + className: "UpdateInfo" + } + }, + resourceLocation: { + serializedName: "resourceLocation", + type: { + name: "String" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorModel" + } + }, + traceId: { + serializedName: "traceId", + type: { + name: "String" + } + }, + lastActionDateTime: { + serializedName: "lastActionDateTime", + required: true, + type: { + name: "DateTime" + } + }, + createdDateTime: { + serializedName: "createdDateTime", + required: true, + type: { + name: "DateTime" + } + }, + etag: { + serializedName: "etag", + type: { + name: "String" + } + } + } + } +}; + +export const UpdateInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateInfo", + modelProperties: { + updateId: { + serializedName: "updateId", + type: { + name: "Composite", + className: "UpdateId" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + }, + friendlyName: { + serializedName: "friendlyName", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DeviceClassesList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceClassesList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DeviceClass" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceClass: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceClass", + modelProperties: { + deviceClassId: { + serializedName: "deviceClassId", + required: true, + type: { + name: "String" + } + }, + friendlyName: { + serializedName: "friendlyName", + type: { + name: "String" + } + }, + deviceClassProperties: { + serializedName: "deviceClassProperties", + type: { + name: "Composite", + className: "DeviceClassProperties" + } + }, + bestCompatibleUpdate: { + serializedName: "bestCompatibleUpdate", + type: { + name: "Composite", + className: "UpdateInfo" + } + } + } + } +}; + +export const DeviceClassProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceClassProperties", + modelProperties: { + contractModel: { + serializedName: "contractModel", + type: { + name: "Composite", + className: "ContractModel" + } + }, + compatProperties: { + serializedName: "compatProperties", + required: true, + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const ContractModel: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ContractModel", + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const PatchBody: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PatchBody", + modelProperties: { + friendlyName: { + serializedName: "friendlyName", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const UpdateInfoList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateInfoList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "UpdateInfo" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const DevicesList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DevicesList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Device" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const Device: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Device", + modelProperties: { + deviceId: { + serializedName: "deviceId", + required: true, + type: { + name: "String" + } + }, + moduleId: { + serializedName: "moduleId", + type: { + name: "String" + } + }, + deviceClassId: { + serializedName: "deviceClassId", + required: true, + type: { + name: "String" + } + }, + groupId: { + serializedName: "groupId", + type: { + name: "String" + } + }, + lastAttemptedUpdate: { + serializedName: "lastAttemptedUpdate", + type: { + name: "Composite", + className: "UpdateInfo" + } + }, + deploymentStatus: { + serializedName: "deploymentStatus", + type: { + name: "String" + } + }, + installedUpdate: { + serializedName: "installedUpdate", + type: { + name: "Composite", + className: "UpdateInfo" + } + }, + onLatestUpdate: { + serializedName: "onLatestUpdate", + required: true, + type: { + name: "Boolean" + } + }, + lastDeploymentId: { + serializedName: "lastDeploymentId", + type: { + name: "String" + } + }, + lastInstallResult: { + serializedName: "lastInstallResult", + type: { + name: "Composite", + className: "InstallResult" + } + } + } + } +}; + +export const InstallResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "InstallResult", + modelProperties: { + resultCode: { + serializedName: "resultCode", + required: true, + type: { + name: "Number" + } + }, + extendedResultCode: { + serializedName: "extendedResultCode", + required: true, + type: { + name: "Number" + } + }, + resultDetails: { + serializedName: "resultDetails", + type: { + name: "String" + } + }, + stepResults: { + serializedName: "stepResults", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StepResult" + } + } + } + } + } + } +}; + +export const StepResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StepResult", + modelProperties: { + update: { + serializedName: "update", + type: { + name: "Composite", + className: "UpdateInfo" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + resultCode: { + serializedName: "resultCode", + required: true, + type: { + name: "Number" + } + }, + extendedResultCode: { + serializedName: "extendedResultCode", + required: true, + type: { + name: "Number" + } + }, + resultDetails: { + serializedName: "resultDetails", + type: { + name: "String" + } + } + } + } +}; + +export const UpdateCompliance: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateCompliance", + modelProperties: { + totalDeviceCount: { + serializedName: "totalDeviceCount", + required: true, + type: { + name: "Number" + } + }, + onLatestUpdateDeviceCount: { + serializedName: "onLatestUpdateDeviceCount", + required: true, + type: { + name: "Number" + } + }, + newUpdatesAvailableDeviceCount: { + serializedName: "newUpdatesAvailableDeviceCount", + required: true, + type: { + name: "Number" + } + }, + updatesInProgressDeviceCount: { + serializedName: "updatesInProgressDeviceCount", + required: true, + type: { + name: "Number" + } + } + } + } +}; + +export const GroupsList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupsList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Group" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const Group: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Group", + modelProperties: { + groupId: { + serializedName: "groupId", + required: true, + type: { + name: "String" + } + }, + groupType: { + serializedName: "groupType", + required: true, + type: { + name: "String" + } + }, + createdDateTime: { + serializedName: "createdDateTime", + required: true, + type: { + name: "String" + } + }, + deviceCount: { + serializedName: "deviceCount", + type: { + name: "Number" + } + }, + subgroupsWithNewUpdatesAvailableCount: { + serializedName: "subgroupsWithNewUpdatesAvailableCount", + type: { + name: "Number" + } + }, + subgroupsWithUpdatesInProgressCount: { + serializedName: "subgroupsWithUpdatesInProgressCount", + type: { + name: "Number" + } + }, + subgroupsWithOnLatestUpdateCount: { + serializedName: "subgroupsWithOnLatestUpdateCount", + type: { + name: "Number" + } + }, + deployments: { + serializedName: "deployments", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const DeviceClassSubgroupUpdatableDevicesList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceClassSubgroupUpdatableDevicesList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DeviceClassSubgroupUpdatableDevices" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceClassSubgroupUpdatableDevices: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceClassSubgroupUpdatableDevices", + modelProperties: { + groupId: { + serializedName: "groupId", + required: true, + type: { + name: "String" + } + }, + deviceClassId: { + serializedName: "deviceClassId", + required: true, + type: { + name: "String" + } + }, + update: { + serializedName: "update", + type: { + name: "Composite", + className: "UpdateInfo" + } + }, + deviceCount: { + serializedName: "deviceCount", + required: true, + type: { + name: "Number" + } + } + } + } +}; + +export const DeploymentsList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentsList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Deployment" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const Deployment: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Deployment", + modelProperties: { + deploymentId: { + serializedName: "deploymentId", + required: true, + type: { + name: "String" + } + }, + startDateTime: { + serializedName: "startDateTime", + required: true, + type: { + name: "DateTime" + } + }, + update: { + serializedName: "update", + type: { + name: "Composite", + className: "UpdateInfo" + } + }, + groupId: { + serializedName: "groupId", + required: true, + type: { + name: "String" + } + }, + deviceClassSubgroups: { + serializedName: "deviceClassSubgroups", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + isCanceled: { + serializedName: "isCanceled", + type: { + name: "Boolean" + } + }, + isRetried: { + serializedName: "isRetried", + type: { + name: "Boolean" + } + }, + rollbackPolicy: { + serializedName: "rollbackPolicy", + type: { + name: "Composite", + className: "CloudInitiatedRollbackPolicy" + } + }, + isCloudInitiatedRollback: { + serializedName: "isCloudInitiatedRollback", + type: { + name: "Boolean" + } + } + } + } +}; + +export const CloudInitiatedRollbackPolicy: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudInitiatedRollbackPolicy", + modelProperties: { + update: { + serializedName: "update", + type: { + name: "Composite", + className: "UpdateInfo" + } + }, + failure: { + serializedName: "failure", + type: { + name: "Composite", + className: "CloudInitiatedRollbackPolicyFailure" + } + } + } + } +}; + +export const CloudInitiatedRollbackPolicyFailure: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudInitiatedRollbackPolicyFailure", + modelProperties: { + devicesFailedPercentage: { + serializedName: "devicesFailedPercentage", + required: true, + type: { + name: "Number" + } + }, + devicesFailedCount: { + serializedName: "devicesFailedCount", + required: true, + type: { + name: "Number" + } + } + } + } +}; + +export const DeploymentStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentStatus", + modelProperties: { + groupId: { + serializedName: "groupId", + required: true, + type: { + name: "String" + } + }, + deploymentState: { + serializedName: "deploymentState", + required: true, + type: { + name: "String" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorModel" + } + }, + subgroupStatus: { + serializedName: "subgroupStatus", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DeviceClassSubgroupDeploymentStatus" + } + } + } + } + } + } +}; + +export const DeviceClassSubgroupDeploymentStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceClassSubgroupDeploymentStatus", + modelProperties: { + groupId: { + serializedName: "groupId", + required: true, + type: { + name: "String" + } + }, + deviceClassId: { + serializedName: "deviceClassId", + required: true, + type: { + name: "String" + } + }, + deploymentState: { + serializedName: "deploymentState", + required: true, + type: { + name: "String" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorModel" + } + }, + totalDevices: { + serializedName: "totalDevices", + type: { + name: "Number" + } + }, + devicesInProgressCount: { + serializedName: "devicesInProgressCount", + type: { + name: "Number" + } + }, + devicesCompletedFailedCount: { + serializedName: "devicesCompletedFailedCount", + type: { + name: "Number" + } + }, + devicesCompletedSucceededCount: { + serializedName: "devicesCompletedSucceededCount", + type: { + name: "Number" + } + }, + devicesCanceledCount: { + serializedName: "devicesCanceledCount", + type: { + name: "Number" + } + } + } + } +}; + +export const DeviceClassSubgroupsList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceClassSubgroupsList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DeviceClassSubgroup" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceClassSubgroup: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceClassSubgroup", + modelProperties: { + deviceClassId: { + serializedName: "deviceClassId", + required: true, + type: { + name: "String" + } + }, + groupId: { + serializedName: "groupId", + required: true, + type: { + name: "String" + } + }, + createdDateTime: { + serializedName: "createdDateTime", + required: true, + type: { + name: "String" + } + }, + deviceCount: { + serializedName: "deviceCount", + type: { + name: "Number" + } + }, + deploymentId: { + serializedName: "deploymentId", + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentDeviceStatesList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentDeviceStatesList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DeploymentDeviceState" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentDeviceState: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentDeviceState", + modelProperties: { + deviceId: { + serializedName: "deviceId", + required: true, + type: { + name: "String" + } + }, + moduleId: { + serializedName: "moduleId", + type: { + name: "String" + } + }, + retryCount: { + serializedName: "retryCount", + required: true, + type: { + name: "Number" + } + }, + movedOnToNewDeployment: { + serializedName: "movedOnToNewDeployment", + required: true, + type: { + name: "Boolean" + } + }, + deviceState: { + serializedName: "deviceState", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const DeviceOperation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceOperation", + modelProperties: { + operationId: { + serializedName: "operationId", + required: true, + type: { + name: "String" + } + }, + status: { + serializedName: "status", + required: true, + type: { + name: "String" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorModel" + } + }, + traceId: { + serializedName: "traceId", + type: { + name: "String" + } + }, + lastActionDateTime: { + serializedName: "lastActionDateTime", + required: true, + type: { + name: "DateTime" + } + }, + createdDateTime: { + serializedName: "createdDateTime", + required: true, + type: { + name: "DateTime" + } + }, + etag: { + serializedName: "etag", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceOperationsList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceOperationsList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DeviceOperation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const LogCollectionOperation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LogCollectionOperation", + modelProperties: { + operationId: { + serializedName: "operationId", + type: { + name: "String" + } + }, + deviceList: { + serializedName: "deviceList", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DeviceUpdateAgentId" + } + } + } + }, + description: { + constraints: { + MaxLength: 512 + }, + serializedName: "description", + type: { + name: "String" + } + }, + createdDateTime: { + serializedName: "createdDateTime", + readOnly: true, + type: { + name: "String" + } + }, + lastActionDateTime: { + serializedName: "lastActionDateTime", + readOnly: true, + type: { + name: "String" + } + }, + status: { + serializedName: "status", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DeviceUpdateAgentId: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceUpdateAgentId", + modelProperties: { + deviceId: { + serializedName: "deviceId", + required: true, + type: { + name: "String" + } + }, + moduleId: { + serializedName: "moduleId", + type: { + name: "String" + } + } + } + } +}; + +export const LogCollectionOperationList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LogCollectionOperationList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "LogCollectionOperation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const LogCollectionOperationDetailedStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LogCollectionOperationDetailedStatus", + modelProperties: { + operationId: { + serializedName: "operationId", + type: { + name: "String" + } + }, + createdDateTime: { + serializedName: "createdDateTime", + type: { + name: "String" + } + }, + lastActionDateTime: { + serializedName: "lastActionDateTime", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + deviceStatus: { + serializedName: "deviceStatus", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "LogCollectionOperationDeviceStatus" + } + } + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const LogCollectionOperationDeviceStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LogCollectionOperationDeviceStatus", + modelProperties: { + deviceId: { + serializedName: "deviceId", + required: true, + type: { + name: "String" + } + }, + moduleId: { + serializedName: "moduleId", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + required: true, + type: { + name: "String" + } + }, + resultCode: { + serializedName: "resultCode", + type: { + name: "String" + } + }, + extendedResultCode: { + serializedName: "extendedResultCode", + type: { + name: "String" + } + }, + logLocation: { + serializedName: "logLocation", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceHealthList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceHealthList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DeviceHealth" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceHealth: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceHealth", + modelProperties: { + deviceId: { + serializedName: "deviceId", + required: true, + type: { + name: "String" + } + }, + moduleId: { + serializedName: "moduleId", + type: { + name: "String" + } + }, + state: { + serializedName: "state", + required: true, + type: { + name: "String" + } + }, + digitalTwinModelId: { + serializedName: "digitalTwinModelId", + type: { + name: "String" + } + }, + healthChecks: { + serializedName: "healthChecks", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "HealthCheck" + } + } + } + } + } + } +}; + +export const HealthCheck: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "HealthCheck", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + result: { + serializedName: "result", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceFilter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceFilter", + modelProperties: { + groupId: { + serializedName: "groupId", + type: { + name: "String" + } + }, + deviceClassId: { + serializedName: "deviceClassId", + type: { + name: "String" + } + }, + deploymentStatus: { + serializedName: "deploymentStatus", + type: { + name: "String" + } + } + } + } +}; + +export const UpdateFilter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateFilter", + modelProperties: { + isDeployable: { + serializedName: "isDeployable", + type: { + name: "Boolean" + } + } + } + } +}; + +export const OperationFilter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationFilter", + modelProperties: { + status: { + serializedName: "status", + type: { + name: "String" + } + } + } + } +}; + +export const GroupOrderBy: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GroupOrderBy", + modelProperties: { + groupId: { + serializedName: "groupId", + type: { + name: "String" + } + }, + deviceCount: { + serializedName: "deviceCount", + type: { + name: "String" + } + }, + createdDate: { + serializedName: "createdDate", + type: { + name: "String" + } + }, + subgroupsWithNewUpdatesAvailableCount: { + serializedName: "subgroupsWithNewUpdatesAvailableCount", + type: { + name: "String" + } + }, + subgroupsWithUpdatesInProgressCount: { + serializedName: "subgroupsWithUpdatesInProgressCount", + type: { + name: "String" + } + }, + subgroupsOnLatestUpdateCount: { + serializedName: "subgroupsOnLatestUpdateCount", + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentOrderBy: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentOrderBy", + modelProperties: { + startDateTime: { + serializedName: "startDateTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const DeploymentDeviceStatesFilter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentDeviceStatesFilter", + modelProperties: { + deviceId: { + serializedName: "deviceId", + type: { + name: "String" + } + }, + moduleId: { + serializedName: "moduleId", + type: { + name: "String" + } + }, + deviceState: { + serializedName: "deviceState", + type: { + name: "String" + } + } + } + } +}; + +export const LogCollectionOperationDetailedStatusList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LogCollectionOperationDetailedStatusList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "LogCollectionOperationDetailedStatus" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceHealthFilter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceHealthFilter", + modelProperties: { + state: { + serializedName: "state", + type: { + name: "String" + } + }, + deviceId: { + serializedName: "deviceId", + type: { + name: "String" + } + }, + moduleId: { + serializedName: "moduleId", + type: { + name: "String" + } + } + } + } +}; + +export const UpdateFile: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateFile", + modelProperties: { + ...UpdateFileBase.type.modelProperties, + fileId: { + serializedName: "fileId", + required: true, + type: { + name: "String" + } + }, + relatedFiles: { + serializedName: "relatedFiles", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "UpdateFileBase" + } + } + } + }, + downloadHandler: { + serializedName: "downloadHandler", + type: { + name: "Composite", + className: "UpdateFileDownloadHandler" + } + }, + etag: { + serializedName: "etag", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceUpdateImportUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceUpdateImportUpdateHeaders", + modelProperties: { + operationLocation: { + serializedName: "operation-location", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceUpdateDeleteUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceUpdateDeleteUpdateHeaders", + modelProperties: { + operationLocation: { + serializedName: "operation-location", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceUpdateGetOperationHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceUpdateGetOperationHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceManagementImportDevicesHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceManagementImportDevicesHeaders", + modelProperties: { + operationLocation: { + serializedName: "operation-location", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceManagementGetOperationHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceManagementGetOperationHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/deviceupdate/device-update/src/models/parameters.ts b/sdk/deviceupdate/device-update/src/models/parameters.ts new file mode 100644 index 000000000000..946260ece9ae --- /dev/null +++ b/sdk/deviceupdate/device-update/src/models/parameters.ts @@ -0,0 +1,316 @@ +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + PatchBody as PatchBodyMapper, + Deployment as DeploymentMapper, + LogCollectionOperation as LogCollectionOperationMapper +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const endpoint: OperationURLParameter = { + parameterPath: "endpoint", + mapper: { + serializedName: "endpoint", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const instanceId: OperationURLParameter = { + parameterPath: "instanceId", + mapper: { + serializedName: "instanceId", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-07-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const search: OperationQueryParameter = { + parameterPath: ["options", "search"], + mapper: { + serializedName: "search", + type: { + name: "String" + } + } +}; + +export const filter: OperationQueryParameter = { + parameterPath: ["options", "filter"], + mapper: { + serializedName: "filter", + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const updateToImport: OperationParameter = { + parameterPath: "updateToImport", + mapper: { + constraints: { + MinItems: 1, + MaxItems: 11 + }, + serializedName: "updateToImport", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ImportUpdateInputItem" + } + } + } + } +}; + +export const provider: OperationURLParameter = { + parameterPath: "provider", + mapper: { + serializedName: "provider", + required: true, + type: { + name: "String" + } + } +}; + +export const name: OperationURLParameter = { + parameterPath: "name", + mapper: { + serializedName: "name", + required: true, + type: { + name: "String" + } + } +}; + +export const version: OperationURLParameter = { + parameterPath: "version", + mapper: { + serializedName: "version", + required: true, + type: { + name: "String" + } + } +}; + +export const ifNoneMatch: OperationParameter = { + parameterPath: ["options", "accessCondition", "ifNoneMatch"], + mapper: { + serializedName: "If-None-Match", + type: { + name: "String" + } + } +}; + +export const fileId: OperationURLParameter = { + parameterPath: "fileId", + mapper: { + serializedName: "fileId", + required: true, + type: { + name: "String" + } + } +}; + +export const top: OperationQueryParameter = { + parameterPath: ["options", "top"], + mapper: { + serializedName: "top", + type: { + name: "Number" + } + } +}; + +export const operationId: OperationURLParameter = { + parameterPath: "operationId", + mapper: { + constraints: { + MaxLength: 256, + MinLength: 1 + }, + serializedName: "operationId", + required: true, + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const deviceClassId: OperationURLParameter = { + parameterPath: "deviceClassId", + mapper: { + serializedName: "deviceClassId", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType1: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/merge-patch+json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const deviceClassPatch: OperationParameter = { + parameterPath: "deviceClassPatch", + mapper: PatchBodyMapper +}; + +export const importType: OperationParameter = { + parameterPath: "importType", + mapper: { + serializedName: "importType", + required: true, + type: { + name: "String" + } + } +}; + +export const deviceId: OperationURLParameter = { + parameterPath: "deviceId", + mapper: { + serializedName: "deviceId", + required: true, + type: { + name: "String" + } + } +}; + +export const moduleId: OperationURLParameter = { + parameterPath: "moduleId", + mapper: { + serializedName: "moduleId", + required: true, + type: { + name: "String" + } + } +}; + +export const orderby: OperationQueryParameter = { + parameterPath: ["options", "orderby"], + mapper: { + serializedName: "orderby", + type: { + name: "String" + } + } +}; + +export const groupId: OperationURLParameter = { + parameterPath: "groupId", + mapper: { + serializedName: "groupId", + required: true, + type: { + name: "String" + } + } +}; + +export const deploymentId: OperationURLParameter = { + parameterPath: "deploymentId", + mapper: { + serializedName: "deploymentId", + required: true, + type: { + name: "String" + } + } +}; + +export const deployment: OperationParameter = { + parameterPath: "deployment", + mapper: DeploymentMapper +}; + +export const logCollectionRequest: OperationParameter = { + parameterPath: "logCollectionRequest", + mapper: LogCollectionOperationMapper +}; + +export const filter1: OperationQueryParameter = { + parameterPath: "filter", + mapper: { + serializedName: "filter", + required: true, + type: { + name: "String" + } + } +}; diff --git a/sdk/deviceupdate/device-update/src/operations/deviceManagement.ts b/sdk/deviceupdate/device-update/src/operations/deviceManagement.ts new file mode 100644 index 000000000000..8a5f3b4fe12f --- /dev/null +++ b/sdk/deviceupdate/device-update/src/operations/deviceManagement.ts @@ -0,0 +1,2557 @@ +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { DeviceManagement } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { DeviceUpdateClient } from "../deviceUpdateClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + DeviceClass, + DeviceManagementListDeviceClassesNextOptionalParams, + DeviceManagementListDeviceClassesOptionalParams, + UpdateInfo, + DeviceManagementListInstallableUpdatesForDeviceClassNextOptionalParams, + DeviceManagementListInstallableUpdatesForDeviceClassOptionalParams, + Device, + DeviceManagementListDevicesNextOptionalParams, + DeviceManagementListDevicesOptionalParams, + Group, + DeviceManagementListGroupsNextOptionalParams, + DeviceManagementListGroupsOptionalParams, + DeviceClassSubgroupUpdatableDevices, + DeviceManagementListBestUpdatesForGroupNextOptionalParams, + DeviceManagementListBestUpdatesForGroupOptionalParams, + Deployment, + DeviceManagementListDeploymentsForGroupNextOptionalParams, + DeviceManagementListDeploymentsForGroupOptionalParams, + DeviceManagementListDeploymentsForDeviceClassSubgroupNextOptionalParams, + DeviceManagementListDeploymentsForDeviceClassSubgroupOptionalParams, + DeploymentDeviceState, + DeviceManagementListDevicesForDeviceClassSubgroupDeploymentNextOptionalParams, + DeviceManagementListDevicesForDeviceClassSubgroupDeploymentOptionalParams, + DeviceOperation, + DeviceManagementListOperationsNextOptionalParams, + DeviceManagementListOperationsOptionalParams, + LogCollectionOperation, + DeviceManagementListLogCollectionOperationsNextOptionalParams, + DeviceManagementListLogCollectionOperationsOptionalParams, + DeviceManagementListDeviceClassesResponse, + DeviceManagementGetDeviceClassOptionalParams, + DeviceManagementGetDeviceClassResponse, + PatchBody, + DeviceManagementUpdateDeviceClassOptionalParams, + DeviceManagementUpdateDeviceClassResponse, + DeviceManagementDeleteDeviceClassOptionalParams, + DeviceManagementListInstallableUpdatesForDeviceClassResponse, + DeviceManagementListDevicesResponse, + ImportType, + DeviceManagementImportDevicesOptionalParams, + DeviceManagementImportDevicesResponse, + DeviceManagementGetDeviceOptionalParams, + DeviceManagementGetDeviceResponse, + DeviceManagementGetDeviceModuleOptionalParams, + DeviceManagementGetDeviceModuleResponse, + DeviceManagementGetUpdateComplianceOptionalParams, + DeviceManagementGetUpdateComplianceResponse, + DeviceManagementListGroupsResponse, + DeviceManagementGetGroupOptionalParams, + DeviceManagementGetGroupResponse, + DeviceManagementDeleteGroupOptionalParams, + DeviceManagementGetGroupUpdateComplianceOptionalParams, + DeviceManagementGetGroupUpdateComplianceResponse, + DeviceManagementListBestUpdatesForGroupResponse, + DeviceManagementListDeploymentsForGroupResponse, + DeviceManagementGetDeploymentOptionalParams, + DeviceManagementGetDeploymentResponse, + DeviceManagementCreateOrUpdateDeploymentOptionalParams, + DeviceManagementCreateOrUpdateDeploymentResponse, + DeviceManagementDeleteDeploymentOptionalParams, + DeviceManagementGetDeploymentStatusOptionalParams, + DeviceManagementGetDeploymentStatusResponse, + DeviceManagementListDeviceClassSubgroupsForGroupOptionalParams, + DeviceManagementListDeviceClassSubgroupsForGroupResponse, + DeviceManagementGetDeviceClassSubgroupDetailsOptionalParams, + DeviceManagementGetDeviceClassSubgroupDetailsResponse, + DeviceManagementDeleteDeviceClassSubgroupOptionalParams, + DeviceManagementGetDeviceClassSubgroupUpdateComplianceOptionalParams, + DeviceManagementGetDeviceClassSubgroupUpdateComplianceResponse, + DeviceManagementListBestUpdatesForDeviceClassSubgroupOptionalParams, + DeviceManagementListBestUpdatesForDeviceClassSubgroupResponse, + DeviceManagementListDeploymentsForDeviceClassSubgroupResponse, + DeviceManagementGetDeploymentForDeviceClassSubgroupOptionalParams, + DeviceManagementGetDeploymentForDeviceClassSubgroupResponse, + DeviceManagementDeleteDeviceClassSubgroupDeploymentOptionalParams, + DeviceManagementStopDeploymentOptionalParams, + DeviceManagementStopDeploymentResponse, + DeviceManagementRetryDeploymentOptionalParams, + DeviceManagementRetryDeploymentResponse, + DeviceManagementGetDeviceClassSubgroupDeploymentStatusOptionalParams, + DeviceManagementGetDeviceClassSubgroupDeploymentStatusResponse, + DeviceManagementListDevicesForDeviceClassSubgroupDeploymentResponse, + DeviceManagementGetOperationOptionalParams, + DeviceManagementGetOperationResponse, + DeviceManagementListOperationsResponse, + DeviceManagementCollectLogsOptionalParams, + DeviceManagementCollectLogsResponse, + DeviceManagementGetLogCollectionOperationOptionalParams, + DeviceManagementGetLogCollectionOperationResponse, + DeviceManagementListLogCollectionOperationsResponse, + DeviceManagementGetLogCollectionOperationDetailedStatusOptionalParams, + DeviceManagementGetLogCollectionOperationDetailedStatusResponse, + DeviceManagementListDeviceHealthOptionalParams, + DeviceManagementListDeviceHealthResponse, + DeviceManagementListDeviceClassesNextResponse, + DeviceManagementListInstallableUpdatesForDeviceClassNextResponse, + DeviceManagementListDevicesNextResponse, + DeviceManagementListGroupsNextResponse, + DeviceManagementListBestUpdatesForGroupNextResponse, + DeviceManagementListDeploymentsForGroupNextResponse, + DeviceManagementListDeploymentsForDeviceClassSubgroupNextResponse, + DeviceManagementListDevicesForDeviceClassSubgroupDeploymentNextResponse, + DeviceManagementListOperationsNextResponse, + DeviceManagementListLogCollectionOperationsNextResponse +} from "../models"; + +/// +/** Class containing DeviceManagement operations. */ +export class DeviceManagementImpl implements DeviceManagement { + private readonly client: DeviceUpdateClient; + + /** + * Initialize a new instance of the class DeviceManagement class. + * @param client Reference to the service client + */ + constructor(client: DeviceUpdateClient) { + this.client = client; + } + + /** + * Gets a list of all device classes (unique combinations of device manufacturer and model) for all + * devices connected to Device Update for IoT Hub. + * @param options The options parameters. + */ + public listDeviceClasses( + options?: DeviceManagementListDeviceClassesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listDeviceClassesPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listDeviceClassesPagingPage(options); + } + }; + } + + private async *listDeviceClassesPagingPage( + options?: DeviceManagementListDeviceClassesOptionalParams + ): AsyncIterableIterator { + let result = await this._listDeviceClasses(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listDeviceClassesNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listDeviceClassesPagingAll( + options?: DeviceManagementListDeviceClassesOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listDeviceClassesPagingPage(options)) { + yield* page; + } + } + + /** + * Gets a list of installable updates for a device class. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + public listInstallableUpdatesForDeviceClass( + deviceClassId: string, + options?: DeviceManagementListInstallableUpdatesForDeviceClassOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listInstallableUpdatesForDeviceClassPagingAll( + deviceClassId, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listInstallableUpdatesForDeviceClassPagingPage( + deviceClassId, + options + ); + } + }; + } + + private async *listInstallableUpdatesForDeviceClassPagingPage( + deviceClassId: string, + options?: DeviceManagementListInstallableUpdatesForDeviceClassOptionalParams + ): AsyncIterableIterator { + let result = await this._listInstallableUpdatesForDeviceClass( + deviceClassId, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listInstallableUpdatesForDeviceClassNext( + deviceClassId, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listInstallableUpdatesForDeviceClassPagingAll( + deviceClassId: string, + options?: DeviceManagementListInstallableUpdatesForDeviceClassOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listInstallableUpdatesForDeviceClassPagingPage( + deviceClassId, + options + )) { + yield* page; + } + } + + /** + * Gets a list of devices connected to Device Update for IoT Hub. + * @param options The options parameters. + */ + public listDevices( + options?: DeviceManagementListDevicesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listDevicesPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listDevicesPagingPage(options); + } + }; + } + + private async *listDevicesPagingPage( + options?: DeviceManagementListDevicesOptionalParams + ): AsyncIterableIterator { + let result = await this._listDevices(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listDevicesNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listDevicesPagingAll( + options?: DeviceManagementListDevicesOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listDevicesPagingPage(options)) { + yield* page; + } + } + + /** + * Gets a list of all device groups. The $default group will always be returned first. + * @param options The options parameters. + */ + public listGroups( + options?: DeviceManagementListGroupsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listGroupsPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listGroupsPagingPage(options); + } + }; + } + + private async *listGroupsPagingPage( + options?: DeviceManagementListGroupsOptionalParams + ): AsyncIterableIterator { + let result = await this._listGroups(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listGroupsNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listGroupsPagingAll( + options?: DeviceManagementListGroupsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listGroupsPagingPage(options)) { + yield* page; + } + } + + /** + * Get the best available updates for a device group and a count of how many devices need each update. + * @param groupId Group identity. + * @param options The options parameters. + */ + public listBestUpdatesForGroup( + groupId: string, + options?: DeviceManagementListBestUpdatesForGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBestUpdatesForGroupPagingAll(groupId, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBestUpdatesForGroupPagingPage(groupId, options); + } + }; + } + + private async *listBestUpdatesForGroupPagingPage( + groupId: string, + options?: DeviceManagementListBestUpdatesForGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listBestUpdatesForGroup(groupId, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listBestUpdatesForGroupNext( + groupId, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listBestUpdatesForGroupPagingAll( + groupId: string, + options?: DeviceManagementListBestUpdatesForGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBestUpdatesForGroupPagingPage( + groupId, + options + )) { + yield* page; + } + } + + /** + * Gets a list of deployments for a device group. + * @param groupId Group identity. + * @param options The options parameters. + */ + public listDeploymentsForGroup( + groupId: string, + options?: DeviceManagementListDeploymentsForGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listDeploymentsForGroupPagingAll(groupId, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listDeploymentsForGroupPagingPage(groupId, options); + } + }; + } + + private async *listDeploymentsForGroupPagingPage( + groupId: string, + options?: DeviceManagementListDeploymentsForGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listDeploymentsForGroup(groupId, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listDeploymentsForGroupNext( + groupId, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listDeploymentsForGroupPagingAll( + groupId: string, + options?: DeviceManagementListDeploymentsForGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listDeploymentsForGroupPagingPage( + groupId, + options + )) { + yield* page; + } + } + + /** + * Gets a list of deployments for a device class subgroup. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + public listDeploymentsForDeviceClassSubgroup( + groupId: string, + deviceClassId: string, + options?: DeviceManagementListDeploymentsForDeviceClassSubgroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listDeploymentsForDeviceClassSubgroupPagingAll( + groupId, + deviceClassId, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listDeploymentsForDeviceClassSubgroupPagingPage( + groupId, + deviceClassId, + options + ); + } + }; + } + + private async *listDeploymentsForDeviceClassSubgroupPagingPage( + groupId: string, + deviceClassId: string, + options?: DeviceManagementListDeploymentsForDeviceClassSubgroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listDeploymentsForDeviceClassSubgroup( + groupId, + deviceClassId, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listDeploymentsForDeviceClassSubgroupNext( + groupId, + deviceClassId, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listDeploymentsForDeviceClassSubgroupPagingAll( + groupId: string, + deviceClassId: string, + options?: DeviceManagementListDeploymentsForDeviceClassSubgroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listDeploymentsForDeviceClassSubgroupPagingPage( + groupId, + deviceClassId, + options + )) { + yield* page; + } + } + + /** + * Gets a list of devices in a deployment along with their state. Useful for getting a list of failed + * devices. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + public listDevicesForDeviceClassSubgroupDeployment( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementListDevicesForDeviceClassSubgroupDeploymentOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listDevicesForDeviceClassSubgroupDeploymentPagingAll( + groupId, + deviceClassId, + deploymentId, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listDevicesForDeviceClassSubgroupDeploymentPagingPage( + groupId, + deviceClassId, + deploymentId, + options + ); + } + }; + } + + private async *listDevicesForDeviceClassSubgroupDeploymentPagingPage( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementListDevicesForDeviceClassSubgroupDeploymentOptionalParams + ): AsyncIterableIterator { + let result = await this._listDevicesForDeviceClassSubgroupDeployment( + groupId, + deviceClassId, + deploymentId, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listDevicesForDeviceClassSubgroupDeploymentNext( + groupId, + deviceClassId, + deploymentId, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listDevicesForDeviceClassSubgroupDeploymentPagingAll( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementListDevicesForDeviceClassSubgroupDeploymentOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listDevicesForDeviceClassSubgroupDeploymentPagingPage( + groupId, + deviceClassId, + deploymentId, + options + )) { + yield* page; + } + } + + /** + * Get a list of all device import operations. Completed operations are kept for 7 days before + * auto-deleted. + * @param options The options parameters. + */ + public listOperations( + options?: DeviceManagementListOperationsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listOperationsPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listOperationsPagingPage(options); + } + }; + } + + private async *listOperationsPagingPage( + options?: DeviceManagementListOperationsOptionalParams + ): AsyncIterableIterator { + let result = await this._listOperations(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listOperationsNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listOperationsPagingAll( + options?: DeviceManagementListOperationsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listOperationsPagingPage(options)) { + yield* page; + } + } + + /** + * Get all device diagnostics log collection operations + * @param options The options parameters. + */ + public listLogCollectionOperations( + options?: DeviceManagementListLogCollectionOperationsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listLogCollectionOperationsPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listLogCollectionOperationsPagingPage(options); + } + }; + } + + private async *listLogCollectionOperationsPagingPage( + options?: DeviceManagementListLogCollectionOperationsOptionalParams + ): AsyncIterableIterator { + let result = await this._listLogCollectionOperations(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listLogCollectionOperationsNext( + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listLogCollectionOperationsPagingAll( + options?: DeviceManagementListLogCollectionOperationsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listLogCollectionOperationsPagingPage( + options + )) { + yield* page; + } + } + + /** + * Gets a list of all device classes (unique combinations of device manufacturer and model) for all + * devices connected to Device Update for IoT Hub. + * @param options The options parameters. + */ + private _listDeviceClasses( + options?: DeviceManagementListDeviceClassesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listDeviceClassesOperationSpec + ); + } + + /** + * Gets the properties of a device class. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + getDeviceClass( + deviceClassId: string, + options?: DeviceManagementGetDeviceClassOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { deviceClassId, options }, + getDeviceClassOperationSpec + ); + } + + /** + * Update device class details. + * @param deviceClassId Device class identifier. + * @param deviceClassPatch The device class json merge patch body. Currently only supports patching + * friendlyName + * @param options The options parameters. + */ + updateDeviceClass( + deviceClassId: string, + deviceClassPatch: PatchBody, + options?: DeviceManagementUpdateDeviceClassOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { deviceClassId, deviceClassPatch, options }, + updateDeviceClassOperationSpec + ); + } + + /** + * Deletes a device class. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + deleteDeviceClass( + deviceClassId: string, + options?: DeviceManagementDeleteDeviceClassOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { deviceClassId, options }, + deleteDeviceClassOperationSpec + ); + } + + /** + * Gets a list of installable updates for a device class. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + private _listInstallableUpdatesForDeviceClass( + deviceClassId: string, + options?: DeviceManagementListInstallableUpdatesForDeviceClassOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { deviceClassId, options }, + listInstallableUpdatesForDeviceClassOperationSpec + ); + } + + /** + * Gets a list of devices connected to Device Update for IoT Hub. + * @param options The options parameters. + */ + private _listDevices( + options?: DeviceManagementListDevicesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listDevicesOperationSpec + ); + } + + /** + * Import existing devices from IoT Hub. This is a long-running-operation; use Operation-Location + * response header value to check for operation status. + * @param importType The types of devices to import. + * @param options The options parameters. + */ + async beginImportDevices( + importType: ImportType, + options?: DeviceManagementImportDevicesOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DeviceManagementImportDevicesResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { importType, options }, + importDevicesOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Import existing devices from IoT Hub. This is a long-running-operation; use Operation-Location + * response header value to check for operation status. + * @param importType The types of devices to import. + * @param options The options parameters. + */ + async beginImportDevicesAndWait( + importType: ImportType, + options?: DeviceManagementImportDevicesOptionalParams + ): Promise { + const poller = await this.beginImportDevices(importType, options); + return poller.pollUntilDone(); + } + + /** + * Gets the device properties and latest deployment status for a device connected to Device Update for + * IoT Hub. + * @param deviceId Device identifier in Azure IoT Hub. + * @param options The options parameters. + */ + getDevice( + deviceId: string, + options?: DeviceManagementGetDeviceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { deviceId, options }, + getDeviceOperationSpec + ); + } + + /** + * Gets the device module properties and latest deployment status for a device module connected to + * Device Update for IoT Hub. + * @param deviceId Device identifier in Azure IoT Hub. + * @param moduleId Device module identifier in Azure IoT Hub. + * @param options The options parameters. + */ + getDeviceModule( + deviceId: string, + moduleId: string, + options?: DeviceManagementGetDeviceModuleOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { deviceId, moduleId, options }, + getDeviceModuleOperationSpec + ); + } + + /** + * Gets the breakdown of how many devices are on their latest update, have new updates available, or + * are in progress receiving new updates. + * @param options The options parameters. + */ + getUpdateCompliance( + options?: DeviceManagementGetUpdateComplianceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + getUpdateComplianceOperationSpec + ); + } + + /** + * Gets a list of all device groups. The $default group will always be returned first. + * @param options The options parameters. + */ + private _listGroups( + options?: DeviceManagementListGroupsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listGroupsOperationSpec + ); + } + + /** + * Gets the device group properties. + * @param groupId Group identity. + * @param options The options parameters. + */ + getGroup( + groupId: string, + options?: DeviceManagementGetGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, options }, + getGroupOperationSpec + ); + } + + /** + * Deletes a device group. + * @param groupId Group identity. + * @param options The options parameters. + */ + deleteGroup( + groupId: string, + options?: DeviceManagementDeleteGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, options }, + deleteGroupOperationSpec + ); + } + + /** + * Get device group update compliance information such as how many devices are on their latest update, + * how many need new updates, and how many are in progress on receiving a new update. + * @param groupId Group identity. + * @param options The options parameters. + */ + getGroupUpdateCompliance( + groupId: string, + options?: DeviceManagementGetGroupUpdateComplianceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, options }, + getGroupUpdateComplianceOperationSpec + ); + } + + /** + * Get the best available updates for a device group and a count of how many devices need each update. + * @param groupId Group identity. + * @param options The options parameters. + */ + private _listBestUpdatesForGroup( + groupId: string, + options?: DeviceManagementListBestUpdatesForGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, options }, + listBestUpdatesForGroupOperationSpec + ); + } + + /** + * Gets a list of deployments for a device group. + * @param groupId Group identity. + * @param options The options parameters. + */ + private _listDeploymentsForGroup( + groupId: string, + options?: DeviceManagementListDeploymentsForGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, options }, + listDeploymentsForGroupOperationSpec + ); + } + + /** + * Gets the deployment properties. + * @param groupId Group identity. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + getDeployment( + groupId: string, + deploymentId: string, + options?: DeviceManagementGetDeploymentOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deploymentId, options }, + getDeploymentOperationSpec + ); + } + + /** + * Creates or updates a deployment. + * @param groupId Group identity. + * @param deploymentId Deployment identifier. + * @param deployment The deployment properties. + * @param options The options parameters. + */ + createOrUpdateDeployment( + groupId: string, + deploymentId: string, + deployment: Deployment, + options?: DeviceManagementCreateOrUpdateDeploymentOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deploymentId, deployment, options }, + createOrUpdateDeploymentOperationSpec + ); + } + + /** + * Deletes a deployment. + * @param groupId Group identity. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + deleteDeployment( + groupId: string, + deploymentId: string, + options?: DeviceManagementDeleteDeploymentOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deploymentId, options }, + deleteDeploymentOperationSpec + ); + } + + /** + * Gets the status of a deployment including a breakdown of how many devices in the deployment are in + * progress, completed, or failed. + * @param groupId Group identity. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + getDeploymentStatus( + groupId: string, + deploymentId: string, + options?: DeviceManagementGetDeploymentStatusOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deploymentId, options }, + getDeploymentStatusOperationSpec + ); + } + + /** + * Get the device class subgroups for the group. + * @param groupId Group identity. + * @param options The options parameters. + */ + listDeviceClassSubgroupsForGroup( + groupId: string, + options?: DeviceManagementListDeviceClassSubgroupsForGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, options }, + listDeviceClassSubgroupsForGroupOperationSpec + ); + } + + /** + * Gets device class subgroup details. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + getDeviceClassSubgroupDetails( + groupId: string, + deviceClassId: string, + options?: DeviceManagementGetDeviceClassSubgroupDetailsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deviceClassId, options }, + getDeviceClassSubgroupDetailsOperationSpec + ); + } + + /** + * Deletes a device class subgroup. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + deleteDeviceClassSubgroup( + groupId: string, + deviceClassId: string, + options?: DeviceManagementDeleteDeviceClassSubgroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deviceClassId, options }, + deleteDeviceClassSubgroupOperationSpec + ); + } + + /** + * Get device class subgroup update compliance information such as how many devices are on their latest + * update, how many need new updates, and how many are in progress on receiving a new update. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + getDeviceClassSubgroupUpdateCompliance( + groupId: string, + deviceClassId: string, + options?: DeviceManagementGetDeviceClassSubgroupUpdateComplianceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deviceClassId, options }, + getDeviceClassSubgroupUpdateComplianceOperationSpec + ); + } + + /** + * Get the best available update for a device class subgroup and a count of how many devices need this + * update. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + listBestUpdatesForDeviceClassSubgroup( + groupId: string, + deviceClassId: string, + options?: DeviceManagementListBestUpdatesForDeviceClassSubgroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deviceClassId, options }, + listBestUpdatesForDeviceClassSubgroupOperationSpec + ); + } + + /** + * Gets a list of deployments for a device class subgroup. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + private _listDeploymentsForDeviceClassSubgroup( + groupId: string, + deviceClassId: string, + options?: DeviceManagementListDeploymentsForDeviceClassSubgroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deviceClassId, options }, + listDeploymentsForDeviceClassSubgroupOperationSpec + ); + } + + /** + * Gets the deployment properties. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + getDeploymentForDeviceClassSubgroup( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementGetDeploymentForDeviceClassSubgroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deviceClassId, deploymentId, options }, + getDeploymentForDeviceClassSubgroupOperationSpec + ); + } + + /** + * Deletes a device class subgroup deployment. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + deleteDeviceClassSubgroupDeployment( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementDeleteDeviceClassSubgroupDeploymentOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deviceClassId, deploymentId, options }, + deleteDeviceClassSubgroupDeploymentOperationSpec + ); + } + + /** + * Stops a deployment. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + stopDeployment( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementStopDeploymentOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deviceClassId, deploymentId, options }, + stopDeploymentOperationSpec + ); + } + + /** + * Retries a deployment with failed devices. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + retryDeployment( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementRetryDeploymentOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deviceClassId, deploymentId, options }, + retryDeploymentOperationSpec + ); + } + + /** + * Gets the status of a deployment including a breakdown of how many devices in the deployment are in + * progress, completed, or failed. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + getDeviceClassSubgroupDeploymentStatus( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementGetDeviceClassSubgroupDeploymentStatusOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, deviceClassId, deploymentId, options }, + getDeviceClassSubgroupDeploymentStatusOperationSpec + ); + } + + /** + * Gets a list of devices in a deployment along with their state. Useful for getting a list of failed + * devices. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + private _listDevicesForDeviceClassSubgroupDeployment( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementListDevicesForDeviceClassSubgroupDeploymentOptionalParams + ): Promise< + DeviceManagementListDevicesForDeviceClassSubgroupDeploymentResponse + > { + return this.client.sendOperationRequest( + { groupId, deviceClassId, deploymentId, options }, + listDevicesForDeviceClassSubgroupDeploymentOperationSpec + ); + } + + /** + * Retrieve operation status. + * @param operationId Operation identifier. + * @param options The options parameters. + */ + getOperation( + operationId: string, + options?: DeviceManagementGetOperationOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { operationId, options }, + getOperationOperationSpec + ); + } + + /** + * Get a list of all device import operations. Completed operations are kept for 7 days before + * auto-deleted. + * @param options The options parameters. + */ + private _listOperations( + options?: DeviceManagementListOperationsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listOperationsOperationSpec + ); + } + + /** + * Start the device diagnostics log collection operation on specified devices. + * @param operationId Operation identifier. + * @param logCollectionRequest The deployment properties. + * @param options The options parameters. + */ + collectLogs( + operationId: string, + logCollectionRequest: LogCollectionOperation, + options?: DeviceManagementCollectLogsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { operationId, logCollectionRequest, options }, + collectLogsOperationSpec + ); + } + + /** + * Get the device diagnostics log collection operation + * @param operationId Operation identifier. + * @param options The options parameters. + */ + getLogCollectionOperation( + operationId: string, + options?: DeviceManagementGetLogCollectionOperationOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { operationId, options }, + getLogCollectionOperationOperationSpec + ); + } + + /** + * Get all device diagnostics log collection operations + * @param options The options parameters. + */ + private _listLogCollectionOperations( + options?: DeviceManagementListLogCollectionOperationsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listLogCollectionOperationsOperationSpec + ); + } + + /** + * Get device diagnostics log collection operation with detailed status + * @param operationId Operation identifier. + * @param options The options parameters. + */ + getLogCollectionOperationDetailedStatus( + operationId: string, + options?: DeviceManagementGetLogCollectionOperationDetailedStatusOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { operationId, options }, + getLogCollectionOperationDetailedStatusOperationSpec + ); + } + + /** + * Get list of device health + * @param filter Filter list by specified properties. + * @param options The options parameters. + */ + listDeviceHealth( + filter: string, + options?: DeviceManagementListDeviceHealthOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { filter, options }, + listDeviceHealthOperationSpec + ); + } + + /** + * ListDeviceClassesNext + * @param nextLink The nextLink from the previous successful call to the ListDeviceClasses method. + * @param options The options parameters. + */ + private _listDeviceClassesNext( + nextLink: string, + options?: DeviceManagementListDeviceClassesNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listDeviceClassesNextOperationSpec + ); + } + + /** + * ListInstallableUpdatesForDeviceClassNext + * @param deviceClassId Device class identifier. + * @param nextLink The nextLink from the previous successful call to the + * ListInstallableUpdatesForDeviceClass method. + * @param options The options parameters. + */ + private _listInstallableUpdatesForDeviceClassNext( + deviceClassId: string, + nextLink: string, + options?: DeviceManagementListInstallableUpdatesForDeviceClassNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { deviceClassId, nextLink, options }, + listInstallableUpdatesForDeviceClassNextOperationSpec + ); + } + + /** + * ListDevicesNext + * @param nextLink The nextLink from the previous successful call to the ListDevices method. + * @param options The options parameters. + */ + private _listDevicesNext( + nextLink: string, + options?: DeviceManagementListDevicesNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listDevicesNextOperationSpec + ); + } + + /** + * ListGroupsNext + * @param nextLink The nextLink from the previous successful call to the ListGroups method. + * @param options The options parameters. + */ + private _listGroupsNext( + nextLink: string, + options?: DeviceManagementListGroupsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listGroupsNextOperationSpec + ); + } + + /** + * ListBestUpdatesForGroupNext + * @param groupId Group identity. + * @param nextLink The nextLink from the previous successful call to the ListBestUpdatesForGroup + * method. + * @param options The options parameters. + */ + private _listBestUpdatesForGroupNext( + groupId: string, + nextLink: string, + options?: DeviceManagementListBestUpdatesForGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, nextLink, options }, + listBestUpdatesForGroupNextOperationSpec + ); + } + + /** + * ListDeploymentsForGroupNext + * @param groupId Group identity. + * @param nextLink The nextLink from the previous successful call to the ListDeploymentsForGroup + * method. + * @param options The options parameters. + */ + private _listDeploymentsForGroupNext( + groupId: string, + nextLink: string, + options?: DeviceManagementListDeploymentsForGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { groupId, nextLink, options }, + listDeploymentsForGroupNextOperationSpec + ); + } + + /** + * ListDeploymentsForDeviceClassSubgroupNext + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param nextLink The nextLink from the previous successful call to the + * ListDeploymentsForDeviceClassSubgroup method. + * @param options The options parameters. + */ + private _listDeploymentsForDeviceClassSubgroupNext( + groupId: string, + deviceClassId: string, + nextLink: string, + options?: DeviceManagementListDeploymentsForDeviceClassSubgroupNextOptionalParams + ): Promise< + DeviceManagementListDeploymentsForDeviceClassSubgroupNextResponse + > { + return this.client.sendOperationRequest( + { groupId, deviceClassId, nextLink, options }, + listDeploymentsForDeviceClassSubgroupNextOperationSpec + ); + } + + /** + * ListDevicesForDeviceClassSubgroupDeploymentNext + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param nextLink The nextLink from the previous successful call to the + * ListDevicesForDeviceClassSubgroupDeployment method. + * @param options The options parameters. + */ + private _listDevicesForDeviceClassSubgroupDeploymentNext( + groupId: string, + deviceClassId: string, + deploymentId: string, + nextLink: string, + options?: DeviceManagementListDevicesForDeviceClassSubgroupDeploymentNextOptionalParams + ): Promise< + DeviceManagementListDevicesForDeviceClassSubgroupDeploymentNextResponse + > { + return this.client.sendOperationRequest( + { groupId, deviceClassId, deploymentId, nextLink, options }, + listDevicesForDeviceClassSubgroupDeploymentNextOperationSpec + ); + } + + /** + * ListOperationsNext + * @param nextLink The nextLink from the previous successful call to the ListOperations method. + * @param options The options parameters. + */ + private _listOperationsNext( + nextLink: string, + options?: DeviceManagementListOperationsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listOperationsNextOperationSpec + ); + } + + /** + * ListLogCollectionOperationsNext + * @param nextLink The nextLink from the previous successful call to the ListLogCollectionOperations + * method. + * @param options The options parameters. + */ + private _listLogCollectionOperationsNext( + nextLink: string, + options?: DeviceManagementListLogCollectionOperationsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listLogCollectionOperationsNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listDeviceClassesOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/deviceClasses", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceClassesList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.endpoint, Parameters.instanceId], + headerParameters: [Parameters.accept], + serializer +}; +const getDeviceClassOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/deviceClasses/{deviceClassId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceClass + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId + ], + headerParameters: [Parameters.accept], + serializer +}; +const updateDeviceClassOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/deviceClasses/{deviceClassId}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.DeviceClass + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.deviceClassPatch, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId + ], + headerParameters: [Parameters.accept, Parameters.contentType1], + mediaType: "json", + serializer +}; +const deleteDeviceClassOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/deviceClasses/{deviceClassId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listInstallableUpdatesForDeviceClassOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/deviceClasses/{deviceClassId}/installableUpdates", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UpdateInfoList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDevicesOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/devices", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DevicesList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [Parameters.endpoint, Parameters.instanceId], + headerParameters: [Parameters.accept], + serializer +}; +const importDevicesOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/devices:import", + httpMethod: "POST", + responses: { + 200: { + headersMapper: Mappers.DeviceManagementImportDevicesHeaders + }, + 201: { + headersMapper: Mappers.DeviceManagementImportDevicesHeaders + }, + 202: { + headersMapper: Mappers.DeviceManagementImportDevicesHeaders + }, + 204: { + headersMapper: Mappers.DeviceManagementImportDevicesHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.importType, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.endpoint, Parameters.instanceId], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getDeviceOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/devices/{deviceId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Device + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDeviceModuleOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/devices/{deviceId}/modules/{moduleId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Device + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceId, + Parameters.moduleId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getUpdateComplianceOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/updateCompliance", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UpdateCompliance + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.endpoint, Parameters.instanceId], + headerParameters: [Parameters.accept], + serializer +}; +const listGroupsOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/groups", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.orderby], + urlParameters: [Parameters.endpoint, Parameters.instanceId], + headerParameters: [Parameters.accept], + serializer +}; +const getGroupOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/groups/{groupId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Group + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteGroupOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/groups/{groupId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getGroupUpdateComplianceOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/updateCompliance", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UpdateCompliance + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBestUpdatesForGroupOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/groups/{groupId}/bestUpdates", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceClassSubgroupUpdatableDevicesList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDeploymentsForGroupOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/groups/{groupId}/deployments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.orderby], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDeploymentOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Deployment + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.groupId, + Parameters.deploymentId + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateDeploymentOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Deployment + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.deployment, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.groupId, + Parameters.deploymentId + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteDeploymentOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.groupId, + Parameters.deploymentId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDeploymentStatusOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}/status", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentStatus + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.groupId, + Parameters.deploymentId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDeviceClassSubgroupsForGroupOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceClassSubgroupsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDeviceClassSubgroupDetailsOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceClassSubgroup + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteDeviceClassSubgroupOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDeviceClassSubgroupUpdateComplianceOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/updateCompliance", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UpdateCompliance + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBestUpdatesForDeviceClassSubgroupOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/bestUpdates", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceClassSubgroupUpdatableDevices + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDeploymentsForDeviceClassSubgroupOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.orderby], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDeploymentForDeviceClassSubgroupOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Deployment + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId, + Parameters.groupId, + Parameters.deploymentId + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteDeviceClassSubgroupDeploymentOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}", + httpMethod: "DELETE", + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId, + Parameters.groupId, + Parameters.deploymentId + ], + headerParameters: [Parameters.accept], + serializer +}; +const stopDeploymentOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}:cancel", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.Deployment + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId, + Parameters.groupId, + Parameters.deploymentId + ], + headerParameters: [Parameters.accept], + serializer +}; +const retryDeploymentOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}:retry", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.Deployment + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId, + Parameters.groupId, + Parameters.deploymentId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDeviceClassSubgroupDeploymentStatusOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}/status", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceClassSubgroupDeploymentStatus + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId, + Parameters.groupId, + Parameters.deploymentId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDevicesForDeviceClassSubgroupDeploymentOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/groups/{groupId}/deviceClassSubgroups/{deviceClassId}/deployments/{deploymentId}/devicestates", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentDeviceStatesList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.deviceClassId, + Parameters.groupId, + Parameters.deploymentId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/operations/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceOperation, + headersMapper: Mappers.DeviceManagementGetOperationHeaders + }, + 304: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.operationId + ], + headerParameters: [Parameters.accept, Parameters.ifNoneMatch], + serializer +}; +const listOperationsOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceOperationsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter, Parameters.top], + urlParameters: [Parameters.endpoint, Parameters.instanceId], + headerParameters: [Parameters.accept], + serializer +}; +const collectLogsOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}", + httpMethod: "PUT", + responses: { + 201: { + bodyMapper: Mappers.LogCollectionOperation + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.logCollectionRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.operationId + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getLogCollectionOperationOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LogCollectionOperation + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.operationId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listLogCollectionOperationsOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LogCollectionOperationList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.endpoint, Parameters.instanceId], + headerParameters: [Parameters.accept], + serializer +}; +const getLogCollectionOperationDetailedStatusOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}/detailedStatus", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LogCollectionOperationDetailedStatus + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.operationId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDeviceHealthOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/management/deviceDiagnostics/deviceHealth", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceHealthList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter1], + urlParameters: [Parameters.endpoint, Parameters.instanceId], + headerParameters: [Parameters.accept], + serializer +}; +const listDeviceClassesNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceClassesList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listInstallableUpdatesForDeviceClassNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UpdateInfoList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.nextLink, + Parameters.deviceClassId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDevicesNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DevicesList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listGroupsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.GroupsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.orderby], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBestUpdatesForGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceClassSubgroupUpdatableDevicesList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.nextLink, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDeploymentsForGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.orderby], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.nextLink, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDeploymentsForDeviceClassSubgroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.orderby], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.nextLink, + Parameters.deviceClassId, + Parameters.groupId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDevicesForDeviceClassSubgroupDeploymentNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentDeviceStatesList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.nextLink, + Parameters.deviceClassId, + Parameters.groupId, + Parameters.deploymentId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceOperationsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter, Parameters.top], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listLogCollectionOperationsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LogCollectionOperationList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/deviceupdate/device-update/src/operations/deviceUpdate.ts b/sdk/deviceupdate/device-update/src/operations/deviceUpdate.ts new file mode 100644 index 000000000000..b3f3c33a5d3d --- /dev/null +++ b/sdk/deviceupdate/device-update/src/operations/deviceUpdate.ts @@ -0,0 +1,1161 @@ +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { DeviceUpdate } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { DeviceUpdateClient } from "../deviceUpdateClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + Update, + DeviceUpdateListUpdatesNextOptionalParams, + DeviceUpdateListUpdatesOptionalParams, + DeviceUpdateListProvidersNextOptionalParams, + DeviceUpdateListProvidersOptionalParams, + DeviceUpdateListNamesNextOptionalParams, + DeviceUpdateListNamesOptionalParams, + DeviceUpdateListVersionsNextOptionalParams, + DeviceUpdateListVersionsOptionalParams, + DeviceUpdateListFilesNextOptionalParams, + DeviceUpdateListFilesOptionalParams, + UpdateOperation, + DeviceUpdateListOperationsNextOptionalParams, + DeviceUpdateListOperationsOptionalParams, + DeviceUpdateListUpdatesResponse, + ImportUpdateInputItem, + DeviceUpdateImportUpdateOptionalParams, + DeviceUpdateImportUpdateResponse, + DeviceUpdateGetUpdateOptionalParams, + DeviceUpdateGetUpdateResponse, + DeviceUpdateDeleteUpdateOptionalParams, + DeviceUpdateDeleteUpdateResponse, + DeviceUpdateListProvidersResponse, + DeviceUpdateListNamesResponse, + DeviceUpdateListVersionsResponse, + DeviceUpdateListFilesResponse, + DeviceUpdateGetFileOptionalParams, + DeviceUpdateGetFileResponse, + DeviceUpdateListOperationsResponse, + DeviceUpdateGetOperationOptionalParams, + DeviceUpdateGetOperationResponse, + DeviceUpdateListUpdatesNextResponse, + DeviceUpdateListProvidersNextResponse, + DeviceUpdateListNamesNextResponse, + DeviceUpdateListVersionsNextResponse, + DeviceUpdateListFilesNextResponse, + DeviceUpdateListOperationsNextResponse +} from "../models"; + +/// +/** Class containing DeviceUpdate operations. */ +export class DeviceUpdateImpl implements DeviceUpdate { + private readonly client: DeviceUpdateClient; + + /** + * Initialize a new instance of the class DeviceUpdate class. + * @param client Reference to the service client + */ + constructor(client: DeviceUpdateClient) { + this.client = client; + } + + /** + * Get a list of all updates that have been imported to Device Update for IoT Hub. + * @param options The options parameters. + */ + public listUpdates( + options?: DeviceUpdateListUpdatesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listUpdatesPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listUpdatesPagingPage(options); + } + }; + } + + private async *listUpdatesPagingPage( + options?: DeviceUpdateListUpdatesOptionalParams + ): AsyncIterableIterator { + let result = await this._listUpdates(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listUpdatesNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listUpdatesPagingAll( + options?: DeviceUpdateListUpdatesOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listUpdatesPagingPage(options)) { + yield* page; + } + } + + /** + * Get a list of all update providers that have been imported to Device Update for IoT Hub. + * @param options The options parameters. + */ + public listProviders( + options?: DeviceUpdateListProvidersOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listProvidersPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listProvidersPagingPage(options); + } + }; + } + + private async *listProvidersPagingPage( + options?: DeviceUpdateListProvidersOptionalParams + ): AsyncIterableIterator { + let result = await this._listProviders(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listProvidersNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listProvidersPagingAll( + options?: DeviceUpdateListProvidersOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listProvidersPagingPage(options)) { + yield* page; + } + } + + /** + * Get a list of all update names that match the specified provider. + * @param provider Update provider. + * @param options The options parameters. + */ + public listNames( + provider: string, + options?: DeviceUpdateListNamesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listNamesPagingAll(provider, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listNamesPagingPage(provider, options); + } + }; + } + + private async *listNamesPagingPage( + provider: string, + options?: DeviceUpdateListNamesOptionalParams + ): AsyncIterableIterator { + let result = await this._listNames(provider, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNamesNext(provider, continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listNamesPagingAll( + provider: string, + options?: DeviceUpdateListNamesOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listNamesPagingPage(provider, options)) { + yield* page; + } + } + + /** + * Get a list of all update versions that match the specified provider and name. + * @param provider Update provider. + * @param name Update name. + * @param options The options parameters. + */ + public listVersions( + provider: string, + name: string, + options?: DeviceUpdateListVersionsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listVersionsPagingAll(provider, name, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listVersionsPagingPage(provider, name, options); + } + }; + } + + private async *listVersionsPagingPage( + provider: string, + name: string, + options?: DeviceUpdateListVersionsOptionalParams + ): AsyncIterableIterator { + let result = await this._listVersions(provider, name, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listVersionsNext( + provider, + name, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listVersionsPagingAll( + provider: string, + name: string, + options?: DeviceUpdateListVersionsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listVersionsPagingPage( + provider, + name, + options + )) { + yield* page; + } + } + + /** + * Get a list of all update file identifiers for the specified version. + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param options The options parameters. + */ + public listFiles( + provider: string, + name: string, + version: string, + options?: DeviceUpdateListFilesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listFilesPagingAll(provider, name, version, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listFilesPagingPage(provider, name, version, options); + } + }; + } + + private async *listFilesPagingPage( + provider: string, + name: string, + version: string, + options?: DeviceUpdateListFilesOptionalParams + ): AsyncIterableIterator { + let result = await this._listFiles(provider, name, version, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listFilesNext( + provider, + name, + version, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listFilesPagingAll( + provider: string, + name: string, + version: string, + options?: DeviceUpdateListFilesOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listFilesPagingPage( + provider, + name, + version, + options + )) { + yield* page; + } + } + + /** + * Get a list of all import update operations. Completed operations are kept for 7 days before + * auto-deleted. Delete operations are not returned by this API version. + * @param options The options parameters. + */ + public listOperations( + options?: DeviceUpdateListOperationsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listOperationsPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listOperationsPagingPage(options); + } + }; + } + + private async *listOperationsPagingPage( + options?: DeviceUpdateListOperationsOptionalParams + ): AsyncIterableIterator { + let result = await this._listOperations(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listOperationsNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listOperationsPagingAll( + options?: DeviceUpdateListOperationsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listOperationsPagingPage(options)) { + yield* page; + } + } + + /** + * Get a list of all updates that have been imported to Device Update for IoT Hub. + * @param options The options parameters. + */ + private _listUpdates( + options?: DeviceUpdateListUpdatesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listUpdatesOperationSpec + ); + } + + /** + * Import new update version. This is a long-running-operation; use Operation-Location response header + * value to check for operation status. + * @param updateToImport The update to be imported. + * @param options The options parameters. + */ + async beginImportUpdate( + updateToImport: ImportUpdateInputItem[], + options?: DeviceUpdateImportUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DeviceUpdateImportUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { updateToImport, options }, + importUpdateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Import new update version. This is a long-running-operation; use Operation-Location response header + * value to check for operation status. + * @param updateToImport The update to be imported. + * @param options The options parameters. + */ + async beginImportUpdateAndWait( + updateToImport: ImportUpdateInputItem[], + options?: DeviceUpdateImportUpdateOptionalParams + ): Promise { + const poller = await this.beginImportUpdate(updateToImport, options); + return poller.pollUntilDone(); + } + + /** + * Get a specific update version. + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param options The options parameters. + */ + getUpdate( + provider: string, + name: string, + version: string, + options?: DeviceUpdateGetUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { provider, name, version, options }, + getUpdateOperationSpec + ); + } + + /** + * Delete a specific update version. This is a long-running-operation; use Operation-Location response + * header value to check for operation status. + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param options The options parameters. + */ + async beginDeleteUpdate( + provider: string, + name: string, + version: string, + options?: DeviceUpdateDeleteUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DeviceUpdateDeleteUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { provider, name, version, options }, + deleteUpdateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Delete a specific update version. This is a long-running-operation; use Operation-Location response + * header value to check for operation status. + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param options The options parameters. + */ + async beginDeleteUpdateAndWait( + provider: string, + name: string, + version: string, + options?: DeviceUpdateDeleteUpdateOptionalParams + ): Promise { + const poller = await this.beginDeleteUpdate( + provider, + name, + version, + options + ); + return poller.pollUntilDone(); + } + + /** + * Get a list of all update providers that have been imported to Device Update for IoT Hub. + * @param options The options parameters. + */ + private _listProviders( + options?: DeviceUpdateListProvidersOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listProvidersOperationSpec + ); + } + + /** + * Get a list of all update names that match the specified provider. + * @param provider Update provider. + * @param options The options parameters. + */ + private _listNames( + provider: string, + options?: DeviceUpdateListNamesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { provider, options }, + listNamesOperationSpec + ); + } + + /** + * Get a list of all update versions that match the specified provider and name. + * @param provider Update provider. + * @param name Update name. + * @param options The options parameters. + */ + private _listVersions( + provider: string, + name: string, + options?: DeviceUpdateListVersionsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { provider, name, options }, + listVersionsOperationSpec + ); + } + + /** + * Get a list of all update file identifiers for the specified version. + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param options The options parameters. + */ + private _listFiles( + provider: string, + name: string, + version: string, + options?: DeviceUpdateListFilesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { provider, name, version, options }, + listFilesOperationSpec + ); + } + + /** + * Get a specific update file from the version. + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param fileId File identifier. + * @param options The options parameters. + */ + getFile( + provider: string, + name: string, + version: string, + fileId: string, + options?: DeviceUpdateGetFileOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { provider, name, version, fileId, options }, + getFileOperationSpec + ); + } + + /** + * Get a list of all import update operations. Completed operations are kept for 7 days before + * auto-deleted. Delete operations are not returned by this API version. + * @param options The options parameters. + */ + private _listOperations( + options?: DeviceUpdateListOperationsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listOperationsOperationSpec + ); + } + + /** + * Retrieve operation status. + * @param operationId Operation identifier. + * @param options The options parameters. + */ + getOperation( + operationId: string, + options?: DeviceUpdateGetOperationOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { operationId, options }, + getOperationOperationSpec + ); + } + + /** + * ListUpdatesNext + * @param nextLink The nextLink from the previous successful call to the ListUpdates method. + * @param options The options parameters. + */ + private _listUpdatesNext( + nextLink: string, + options?: DeviceUpdateListUpdatesNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listUpdatesNextOperationSpec + ); + } + + /** + * ListProvidersNext + * @param nextLink The nextLink from the previous successful call to the ListProviders method. + * @param options The options parameters. + */ + private _listProvidersNext( + nextLink: string, + options?: DeviceUpdateListProvidersNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listProvidersNextOperationSpec + ); + } + + /** + * ListNamesNext + * @param provider Update provider. + * @param nextLink The nextLink from the previous successful call to the ListNames method. + * @param options The options parameters. + */ + private _listNamesNext( + provider: string, + nextLink: string, + options?: DeviceUpdateListNamesNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { provider, nextLink, options }, + listNamesNextOperationSpec + ); + } + + /** + * ListVersionsNext + * @param provider Update provider. + * @param name Update name. + * @param nextLink The nextLink from the previous successful call to the ListVersions method. + * @param options The options parameters. + */ + private _listVersionsNext( + provider: string, + name: string, + nextLink: string, + options?: DeviceUpdateListVersionsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { provider, name, nextLink, options }, + listVersionsNextOperationSpec + ); + } + + /** + * ListFilesNext + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param nextLink The nextLink from the previous successful call to the ListFiles method. + * @param options The options parameters. + */ + private _listFilesNext( + provider: string, + name: string, + version: string, + nextLink: string, + options?: DeviceUpdateListFilesNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { provider, name, version, nextLink, options }, + listFilesNextOperationSpec + ); + } + + /** + * ListOperationsNext + * @param nextLink The nextLink from the previous successful call to the ListOperations method. + * @param options The options parameters. + */ + private _listOperationsNext( + nextLink: string, + options?: DeviceUpdateListOperationsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listOperationsNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listUpdatesOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/updates", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UpdateList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.search, + Parameters.filter + ], + urlParameters: [Parameters.endpoint, Parameters.instanceId], + headerParameters: [Parameters.accept], + serializer +}; +const importUpdateOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/updates:import", + httpMethod: "POST", + responses: { + 200: { + headersMapper: Mappers.DeviceUpdateImportUpdateHeaders + }, + 201: { + headersMapper: Mappers.DeviceUpdateImportUpdateHeaders + }, + 202: { + headersMapper: Mappers.DeviceUpdateImportUpdateHeaders + }, + 204: { + headersMapper: Mappers.DeviceUpdateImportUpdateHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.updateToImport, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.endpoint, Parameters.instanceId], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Update + }, + 304: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.provider, + Parameters.name, + Parameters.version + ], + headerParameters: [Parameters.accept, Parameters.ifNoneMatch], + serializer +}; +const deleteUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}", + httpMethod: "DELETE", + responses: { + 200: { + headersMapper: Mappers.DeviceUpdateDeleteUpdateHeaders + }, + 201: { + headersMapper: Mappers.DeviceUpdateDeleteUpdateHeaders + }, + 202: { + headersMapper: Mappers.DeviceUpdateDeleteUpdateHeaders + }, + 204: { + headersMapper: Mappers.DeviceUpdateDeleteUpdateHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.provider, + Parameters.name, + Parameters.version + ], + headerParameters: [Parameters.accept], + serializer +}; +const listProvidersOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/updates/providers", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StringsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.endpoint, Parameters.instanceId], + headerParameters: [Parameters.accept], + serializer +}; +const listNamesOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/updates/providers/{provider}/names", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StringsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.provider + ], + headerParameters: [Parameters.accept], + serializer +}; +const listVersionsOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StringsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.provider, + Parameters.name + ], + headerParameters: [Parameters.accept], + serializer +}; +const listFilesOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}/files", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StringsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.provider, + Parameters.name, + Parameters.version + ], + headerParameters: [Parameters.accept], + serializer +}; +const getFileOperationSpec: coreClient.OperationSpec = { + path: + "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}/files/{fileId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UpdateFile + }, + 304: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.provider, + Parameters.name, + Parameters.version, + Parameters.fileId + ], + headerParameters: [Parameters.accept, Parameters.ifNoneMatch], + serializer +}; +const listOperationsOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/updates/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UpdateOperationsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter, Parameters.top], + urlParameters: [Parameters.endpoint, Parameters.instanceId], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationOperationSpec: coreClient.OperationSpec = { + path: "/deviceUpdate/{instanceId}/updates/operations/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UpdateOperation, + headersMapper: Mappers.DeviceUpdateGetOperationHeaders + }, + 304: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.operationId + ], + headerParameters: [Parameters.accept, Parameters.ifNoneMatch], + serializer +}; +const listUpdatesNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UpdateList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.search, + Parameters.filter + ], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listProvidersNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StringsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNamesNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StringsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.provider, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listVersionsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StringsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.provider, + Parameters.name, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listFilesNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StringsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.provider, + Parameters.name, + Parameters.version, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UpdateOperationsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter, Parameters.top], + urlParameters: [ + Parameters.endpoint, + Parameters.instanceId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/deviceupdate/device-update/src/operations/index.ts b/sdk/deviceupdate/device-update/src/operations/index.ts new file mode 100644 index 000000000000..0e4aba34d8ad --- /dev/null +++ b/sdk/deviceupdate/device-update/src/operations/index.ts @@ -0,0 +1,2 @@ +export * from "./deviceUpdate"; +export * from "./deviceManagement"; diff --git a/sdk/deviceupdate/device-update/src/operationsInterfaces/deviceManagement.ts b/sdk/deviceupdate/device-update/src/operationsInterfaces/deviceManagement.ts new file mode 100644 index 000000000000..c8a6379df7e3 --- /dev/null +++ b/sdk/deviceupdate/device-update/src/operationsInterfaces/deviceManagement.ts @@ -0,0 +1,500 @@ +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + DeviceClass, + DeviceManagementListDeviceClassesOptionalParams, + UpdateInfo, + DeviceManagementListInstallableUpdatesForDeviceClassOptionalParams, + Device, + DeviceManagementListDevicesOptionalParams, + Group, + DeviceManagementListGroupsOptionalParams, + DeviceClassSubgroupUpdatableDevices, + DeviceManagementListBestUpdatesForGroupOptionalParams, + Deployment, + DeviceManagementListDeploymentsForGroupOptionalParams, + DeviceManagementListDeploymentsForDeviceClassSubgroupOptionalParams, + DeploymentDeviceState, + DeviceManagementListDevicesForDeviceClassSubgroupDeploymentOptionalParams, + DeviceOperation, + DeviceManagementListOperationsOptionalParams, + LogCollectionOperation, + DeviceManagementListLogCollectionOperationsOptionalParams, + DeviceManagementGetDeviceClassOptionalParams, + DeviceManagementGetDeviceClassResponse, + PatchBody, + DeviceManagementUpdateDeviceClassOptionalParams, + DeviceManagementUpdateDeviceClassResponse, + DeviceManagementDeleteDeviceClassOptionalParams, + ImportType, + DeviceManagementImportDevicesOptionalParams, + DeviceManagementImportDevicesResponse, + DeviceManagementGetDeviceOptionalParams, + DeviceManagementGetDeviceResponse, + DeviceManagementGetDeviceModuleOptionalParams, + DeviceManagementGetDeviceModuleResponse, + DeviceManagementGetUpdateComplianceOptionalParams, + DeviceManagementGetUpdateComplianceResponse, + DeviceManagementGetGroupOptionalParams, + DeviceManagementGetGroupResponse, + DeviceManagementDeleteGroupOptionalParams, + DeviceManagementGetGroupUpdateComplianceOptionalParams, + DeviceManagementGetGroupUpdateComplianceResponse, + DeviceManagementGetDeploymentOptionalParams, + DeviceManagementGetDeploymentResponse, + DeviceManagementCreateOrUpdateDeploymentOptionalParams, + DeviceManagementCreateOrUpdateDeploymentResponse, + DeviceManagementDeleteDeploymentOptionalParams, + DeviceManagementGetDeploymentStatusOptionalParams, + DeviceManagementGetDeploymentStatusResponse, + DeviceManagementListDeviceClassSubgroupsForGroupOptionalParams, + DeviceManagementListDeviceClassSubgroupsForGroupResponse, + DeviceManagementGetDeviceClassSubgroupDetailsOptionalParams, + DeviceManagementGetDeviceClassSubgroupDetailsResponse, + DeviceManagementDeleteDeviceClassSubgroupOptionalParams, + DeviceManagementGetDeviceClassSubgroupUpdateComplianceOptionalParams, + DeviceManagementGetDeviceClassSubgroupUpdateComplianceResponse, + DeviceManagementListBestUpdatesForDeviceClassSubgroupOptionalParams, + DeviceManagementListBestUpdatesForDeviceClassSubgroupResponse, + DeviceManagementGetDeploymentForDeviceClassSubgroupOptionalParams, + DeviceManagementGetDeploymentForDeviceClassSubgroupResponse, + DeviceManagementDeleteDeviceClassSubgroupDeploymentOptionalParams, + DeviceManagementStopDeploymentOptionalParams, + DeviceManagementStopDeploymentResponse, + DeviceManagementRetryDeploymentOptionalParams, + DeviceManagementRetryDeploymentResponse, + DeviceManagementGetDeviceClassSubgroupDeploymentStatusOptionalParams, + DeviceManagementGetDeviceClassSubgroupDeploymentStatusResponse, + DeviceManagementGetOperationOptionalParams, + DeviceManagementGetOperationResponse, + DeviceManagementCollectLogsOptionalParams, + DeviceManagementCollectLogsResponse, + DeviceManagementGetLogCollectionOperationOptionalParams, + DeviceManagementGetLogCollectionOperationResponse, + DeviceManagementGetLogCollectionOperationDetailedStatusOptionalParams, + DeviceManagementGetLogCollectionOperationDetailedStatusResponse, + DeviceManagementListDeviceHealthOptionalParams, + DeviceManagementListDeviceHealthResponse +} from "../models"; + +/// +/** Interface representing a DeviceManagement. */ +export interface DeviceManagement { + /** + * Gets a list of all device classes (unique combinations of device manufacturer and model) for all + * devices connected to Device Update for IoT Hub. + * @param options The options parameters. + */ + listDeviceClasses( + options?: DeviceManagementListDeviceClassesOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a list of installable updates for a device class. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + listInstallableUpdatesForDeviceClass( + deviceClassId: string, + options?: DeviceManagementListInstallableUpdatesForDeviceClassOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a list of devices connected to Device Update for IoT Hub. + * @param options The options parameters. + */ + listDevices( + options?: DeviceManagementListDevicesOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a list of all device groups. The $default group will always be returned first. + * @param options The options parameters. + */ + listGroups( + options?: DeviceManagementListGroupsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get the best available updates for a device group and a count of how many devices need each update. + * @param groupId Group identity. + * @param options The options parameters. + */ + listBestUpdatesForGroup( + groupId: string, + options?: DeviceManagementListBestUpdatesForGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a list of deployments for a device group. + * @param groupId Group identity. + * @param options The options parameters. + */ + listDeploymentsForGroup( + groupId: string, + options?: DeviceManagementListDeploymentsForGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a list of deployments for a device class subgroup. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + listDeploymentsForDeviceClassSubgroup( + groupId: string, + deviceClassId: string, + options?: DeviceManagementListDeploymentsForDeviceClassSubgroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a list of devices in a deployment along with their state. Useful for getting a list of failed + * devices. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + listDevicesForDeviceClassSubgroupDeployment( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementListDevicesForDeviceClassSubgroupDeploymentOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a list of all device import operations. Completed operations are kept for 7 days before + * auto-deleted. + * @param options The options parameters. + */ + listOperations( + options?: DeviceManagementListOperationsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get all device diagnostics log collection operations + * @param options The options parameters. + */ + listLogCollectionOperations( + options?: DeviceManagementListLogCollectionOperationsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets the properties of a device class. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + getDeviceClass( + deviceClassId: string, + options?: DeviceManagementGetDeviceClassOptionalParams + ): Promise; + /** + * Update device class details. + * @param deviceClassId Device class identifier. + * @param deviceClassPatch The device class json merge patch body. Currently only supports patching + * friendlyName + * @param options The options parameters. + */ + updateDeviceClass( + deviceClassId: string, + deviceClassPatch: PatchBody, + options?: DeviceManagementUpdateDeviceClassOptionalParams + ): Promise; + /** + * Deletes a device class. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + deleteDeviceClass( + deviceClassId: string, + options?: DeviceManagementDeleteDeviceClassOptionalParams + ): Promise; + /** + * Import existing devices from IoT Hub. This is a long-running-operation; use Operation-Location + * response header value to check for operation status. + * @param importType The types of devices to import. + * @param options The options parameters. + */ + beginImportDevices( + importType: ImportType, + options?: DeviceManagementImportDevicesOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DeviceManagementImportDevicesResponse + > + >; + /** + * Import existing devices from IoT Hub. This is a long-running-operation; use Operation-Location + * response header value to check for operation status. + * @param importType The types of devices to import. + * @param options The options parameters. + */ + beginImportDevicesAndWait( + importType: ImportType, + options?: DeviceManagementImportDevicesOptionalParams + ): Promise; + /** + * Gets the device properties and latest deployment status for a device connected to Device Update for + * IoT Hub. + * @param deviceId Device identifier in Azure IoT Hub. + * @param options The options parameters. + */ + getDevice( + deviceId: string, + options?: DeviceManagementGetDeviceOptionalParams + ): Promise; + /** + * Gets the device module properties and latest deployment status for a device module connected to + * Device Update for IoT Hub. + * @param deviceId Device identifier in Azure IoT Hub. + * @param moduleId Device module identifier in Azure IoT Hub. + * @param options The options parameters. + */ + getDeviceModule( + deviceId: string, + moduleId: string, + options?: DeviceManagementGetDeviceModuleOptionalParams + ): Promise; + /** + * Gets the breakdown of how many devices are on their latest update, have new updates available, or + * are in progress receiving new updates. + * @param options The options parameters. + */ + getUpdateCompliance( + options?: DeviceManagementGetUpdateComplianceOptionalParams + ): Promise; + /** + * Gets the device group properties. + * @param groupId Group identity. + * @param options The options parameters. + */ + getGroup( + groupId: string, + options?: DeviceManagementGetGroupOptionalParams + ): Promise; + /** + * Deletes a device group. + * @param groupId Group identity. + * @param options The options parameters. + */ + deleteGroup( + groupId: string, + options?: DeviceManagementDeleteGroupOptionalParams + ): Promise; + /** + * Get device group update compliance information such as how many devices are on their latest update, + * how many need new updates, and how many are in progress on receiving a new update. + * @param groupId Group identity. + * @param options The options parameters. + */ + getGroupUpdateCompliance( + groupId: string, + options?: DeviceManagementGetGroupUpdateComplianceOptionalParams + ): Promise; + /** + * Gets the deployment properties. + * @param groupId Group identity. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + getDeployment( + groupId: string, + deploymentId: string, + options?: DeviceManagementGetDeploymentOptionalParams + ): Promise; + /** + * Creates or updates a deployment. + * @param groupId Group identity. + * @param deploymentId Deployment identifier. + * @param deployment The deployment properties. + * @param options The options parameters. + */ + createOrUpdateDeployment( + groupId: string, + deploymentId: string, + deployment: Deployment, + options?: DeviceManagementCreateOrUpdateDeploymentOptionalParams + ): Promise; + /** + * Deletes a deployment. + * @param groupId Group identity. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + deleteDeployment( + groupId: string, + deploymentId: string, + options?: DeviceManagementDeleteDeploymentOptionalParams + ): Promise; + /** + * Gets the status of a deployment including a breakdown of how many devices in the deployment are in + * progress, completed, or failed. + * @param groupId Group identity. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + getDeploymentStatus( + groupId: string, + deploymentId: string, + options?: DeviceManagementGetDeploymentStatusOptionalParams + ): Promise; + /** + * Get the device class subgroups for the group. + * @param groupId Group identity. + * @param options The options parameters. + */ + listDeviceClassSubgroupsForGroup( + groupId: string, + options?: DeviceManagementListDeviceClassSubgroupsForGroupOptionalParams + ): Promise; + /** + * Gets device class subgroup details. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + getDeviceClassSubgroupDetails( + groupId: string, + deviceClassId: string, + options?: DeviceManagementGetDeviceClassSubgroupDetailsOptionalParams + ): Promise; + /** + * Deletes a device class subgroup. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + deleteDeviceClassSubgroup( + groupId: string, + deviceClassId: string, + options?: DeviceManagementDeleteDeviceClassSubgroupOptionalParams + ): Promise; + /** + * Get device class subgroup update compliance information such as how many devices are on their latest + * update, how many need new updates, and how many are in progress on receiving a new update. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + getDeviceClassSubgroupUpdateCompliance( + groupId: string, + deviceClassId: string, + options?: DeviceManagementGetDeviceClassSubgroupUpdateComplianceOptionalParams + ): Promise; + /** + * Get the best available update for a device class subgroup and a count of how many devices need this + * update. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param options The options parameters. + */ + listBestUpdatesForDeviceClassSubgroup( + groupId: string, + deviceClassId: string, + options?: DeviceManagementListBestUpdatesForDeviceClassSubgroupOptionalParams + ): Promise; + /** + * Gets the deployment properties. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + getDeploymentForDeviceClassSubgroup( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementGetDeploymentForDeviceClassSubgroupOptionalParams + ): Promise; + /** + * Deletes a device class subgroup deployment. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + deleteDeviceClassSubgroupDeployment( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementDeleteDeviceClassSubgroupDeploymentOptionalParams + ): Promise; + /** + * Stops a deployment. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + stopDeployment( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementStopDeploymentOptionalParams + ): Promise; + /** + * Retries a deployment with failed devices. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + retryDeployment( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementRetryDeploymentOptionalParams + ): Promise; + /** + * Gets the status of a deployment including a breakdown of how many devices in the deployment are in + * progress, completed, or failed. + * @param groupId Group identity. + * @param deviceClassId Device class identifier. + * @param deploymentId Deployment identifier. + * @param options The options parameters. + */ + getDeviceClassSubgroupDeploymentStatus( + groupId: string, + deviceClassId: string, + deploymentId: string, + options?: DeviceManagementGetDeviceClassSubgroupDeploymentStatusOptionalParams + ): Promise; + /** + * Retrieve operation status. + * @param operationId Operation identifier. + * @param options The options parameters. + */ + getOperation( + operationId: string, + options?: DeviceManagementGetOperationOptionalParams + ): Promise; + /** + * Start the device diagnostics log collection operation on specified devices. + * @param operationId Operation identifier. + * @param logCollectionRequest The deployment properties. + * @param options The options parameters. + */ + collectLogs( + operationId: string, + logCollectionRequest: LogCollectionOperation, + options?: DeviceManagementCollectLogsOptionalParams + ): Promise; + /** + * Get the device diagnostics log collection operation + * @param operationId Operation identifier. + * @param options The options parameters. + */ + getLogCollectionOperation( + operationId: string, + options?: DeviceManagementGetLogCollectionOperationOptionalParams + ): Promise; + /** + * Get device diagnostics log collection operation with detailed status + * @param operationId Operation identifier. + * @param options The options parameters. + */ + getLogCollectionOperationDetailedStatus( + operationId: string, + options?: DeviceManagementGetLogCollectionOperationDetailedStatusOptionalParams + ): Promise; + /** + * Get list of device health + * @param filter Filter list by specified properties. + * @param options The options parameters. + */ + listDeviceHealth( + filter: string, + options?: DeviceManagementListDeviceHealthOptionalParams + ): Promise; +} diff --git a/sdk/deviceupdate/device-update/src/operationsInterfaces/deviceUpdate.ts b/sdk/deviceupdate/device-update/src/operationsInterfaces/deviceUpdate.ts new file mode 100644 index 000000000000..df129690ce52 --- /dev/null +++ b/sdk/deviceupdate/device-update/src/operationsInterfaces/deviceUpdate.ts @@ -0,0 +1,178 @@ +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + Update, + DeviceUpdateListUpdatesOptionalParams, + DeviceUpdateListProvidersOptionalParams, + DeviceUpdateListNamesOptionalParams, + DeviceUpdateListVersionsOptionalParams, + DeviceUpdateListFilesOptionalParams, + UpdateOperation, + DeviceUpdateListOperationsOptionalParams, + ImportUpdateInputItem, + DeviceUpdateImportUpdateOptionalParams, + DeviceUpdateImportUpdateResponse, + DeviceUpdateGetUpdateOptionalParams, + DeviceUpdateGetUpdateResponse, + DeviceUpdateDeleteUpdateOptionalParams, + DeviceUpdateDeleteUpdateResponse, + DeviceUpdateGetFileOptionalParams, + DeviceUpdateGetFileResponse, + DeviceUpdateGetOperationOptionalParams, + DeviceUpdateGetOperationResponse +} from "../models"; + +/// +/** Interface representing a DeviceUpdate. */ +export interface DeviceUpdate { + /** + * Get a list of all updates that have been imported to Device Update for IoT Hub. + * @param options The options parameters. + */ + listUpdates( + options?: DeviceUpdateListUpdatesOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a list of all update providers that have been imported to Device Update for IoT Hub. + * @param options The options parameters. + */ + listProviders( + options?: DeviceUpdateListProvidersOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a list of all update names that match the specified provider. + * @param provider Update provider. + * @param options The options parameters. + */ + listNames( + provider: string, + options?: DeviceUpdateListNamesOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a list of all update versions that match the specified provider and name. + * @param provider Update provider. + * @param name Update name. + * @param options The options parameters. + */ + listVersions( + provider: string, + name: string, + options?: DeviceUpdateListVersionsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a list of all update file identifiers for the specified version. + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param options The options parameters. + */ + listFiles( + provider: string, + name: string, + version: string, + options?: DeviceUpdateListFilesOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a list of all import update operations. Completed operations are kept for 7 days before + * auto-deleted. Delete operations are not returned by this API version. + * @param options The options parameters. + */ + listOperations( + options?: DeviceUpdateListOperationsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Import new update version. This is a long-running-operation; use Operation-Location response header + * value to check for operation status. + * @param updateToImport The update to be imported. + * @param options The options parameters. + */ + beginImportUpdate( + updateToImport: ImportUpdateInputItem[], + options?: DeviceUpdateImportUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DeviceUpdateImportUpdateResponse + > + >; + /** + * Import new update version. This is a long-running-operation; use Operation-Location response header + * value to check for operation status. + * @param updateToImport The update to be imported. + * @param options The options parameters. + */ + beginImportUpdateAndWait( + updateToImport: ImportUpdateInputItem[], + options?: DeviceUpdateImportUpdateOptionalParams + ): Promise; + /** + * Get a specific update version. + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param options The options parameters. + */ + getUpdate( + provider: string, + name: string, + version: string, + options?: DeviceUpdateGetUpdateOptionalParams + ): Promise; + /** + * Delete a specific update version. This is a long-running-operation; use Operation-Location response + * header value to check for operation status. + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param options The options parameters. + */ + beginDeleteUpdate( + provider: string, + name: string, + version: string, + options?: DeviceUpdateDeleteUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + DeviceUpdateDeleteUpdateResponse + > + >; + /** + * Delete a specific update version. This is a long-running-operation; use Operation-Location response + * header value to check for operation status. + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param options The options parameters. + */ + beginDeleteUpdateAndWait( + provider: string, + name: string, + version: string, + options?: DeviceUpdateDeleteUpdateOptionalParams + ): Promise; + /** + * Get a specific update file from the version. + * @param provider Update provider. + * @param name Update name. + * @param version Update version. + * @param fileId File identifier. + * @param options The options parameters. + */ + getFile( + provider: string, + name: string, + version: string, + fileId: string, + options?: DeviceUpdateGetFileOptionalParams + ): Promise; + /** + * Retrieve operation status. + * @param operationId Operation identifier. + * @param options The options parameters. + */ + getOperation( + operationId: string, + options?: DeviceUpdateGetOperationOptionalParams + ): Promise; +} diff --git a/sdk/deviceupdate/device-update/src/operationsInterfaces/index.ts b/sdk/deviceupdate/device-update/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..0e4aba34d8ad --- /dev/null +++ b/sdk/deviceupdate/device-update/src/operationsInterfaces/index.ts @@ -0,0 +1,2 @@ +export * from "./deviceUpdate"; +export * from "./deviceManagement"; diff --git a/sdk/deviceupdate/device-update/tsconfig.json b/sdk/deviceupdate/device-update/tsconfig.json new file mode 100644 index 000000000000..603440b3a359 --- /dev/null +++ b/sdk/deviceupdate/device-update/tsconfig.json @@ -0,0 +1,19 @@ +{ + "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 + }, + "include": ["./src/**/*.ts"], + "exclude": ["node_modules"] +}