From 16c40d707860ab6d548d5560c18562b823a557ad Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Fri, 30 Aug 2024 17:05:28 +0800 Subject: [PATCH 01/13] [data-plane] refresh iot-device-update-rest sdk --- .../iot-device-update-rest/karma.conf.js | 21 +- .../iot-device-update-rest/package.json | 5 +- .../review/iot-device-update.api.md | 510 ++++++++-------- .../samples-dev/deleteUpdate.ts | 2 +- .../samples-dev/deployUpdate.ts | 2 +- .../samples-dev/importUpdate.ts | 2 +- .../src/clientDefinitions.ts | 202 +++--- .../src/deviceUpdate.ts | 53 +- .../iot-device-update-rest/src/index.ts | 2 +- .../src/isUnexpected.ts | 575 +++++++++--------- .../iot-device-update-rest/src/logger.ts | 5 + .../iot-device-update-rest/src/models.ts | 23 +- .../src/outputModels.ts | 60 +- .../src/paginateHelper.ts | 2 +- .../iot-device-update-rest/src/parameters.ts | 14 +- .../src/pollingHelper.ts | 164 ++++- .../iot-device-update-rest/src/responses.ts | 114 ++-- .../iot-device-update-rest/swagger/README.md | 6 +- 18 files changed, 989 insertions(+), 773 deletions(-) create mode 100644 sdk/deviceupdate/iot-device-update-rest/src/logger.ts diff --git a/sdk/deviceupdate/iot-device-update-rest/karma.conf.js b/sdk/deviceupdate/iot-device-update-rest/karma.conf.js index e2dc84ef207d..a9d5f1b5fc59 100644 --- a/sdk/deviceupdate/iot-device-update-rest/karma.conf.js +++ b/sdk/deviceupdate/iot-device-update-rest/karma.conf.js @@ -1,11 +1,11 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -const { relativeRecordingsPath } = require("@azure-tools/test-recorder"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + // https://github.com/karma-runner/karma-chrome-launcher process.env.CHROME_BIN = require("puppeteer").executablePath(); -process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath(); - require("dotenv").config(); +const { relativeRecordingsPath } = require("@azure-tools/test-recorder"); +process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath(); module.exports = function (config) { config.set({ @@ -25,15 +25,18 @@ module.exports = function (config) { "karma-coverage", "karma-sourcemap-loader", "karma-junit-reporter", - "karma-json-to-file-reporter", "karma-source-map-support", - "karma-json-preprocessor", ], // list of files / patterns to load in the browser files: [ "dist-test/index.browser.js", - { pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true }, + { + pattern: "dist-test/index.browser.js.map", + type: "html", + included: false, + served: true, + }, ], // list of files / patterns to exclude @@ -43,7 +46,6 @@ module.exports = function (config) { // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { "**/*.js": ["sourcemap", "env"], - "recordings/browsers/**/*.json": ["json"], // IMPORTANT: COMMENT following line if you want to debug in your browsers!! // Preprocess source file to calculate code coverage, however this will make source file unreadable // "dist-test/index.js": ["coverage"] @@ -55,6 +57,7 @@ module.exports = function (config) { "AZURE_CLIENT_SECRET", "AZURE_CLIENT_ID", "AZURE_TENANT_ID", + "SUBSCRIPTION_ID", "RECORDINGS_RELATIVE_PATH", ], diff --git a/sdk/deviceupdate/iot-device-update-rest/package.json b/sdk/deviceupdate/iot-device-update-rest/package.json index e3d169d2071c..5a56a7d04c48 100644 --- a/sdk/deviceupdate/iot-device-update-rest/package.json +++ b/sdk/deviceupdate/iot-device-update-rest/package.json @@ -89,8 +89,9 @@ "@azure/core-rest-pipeline": "^1.8.0", "@azure/logger": "^1.0.0", "tslib": "^2.2.0", - "@azure/core-paging": "^1.2.0", - "@azure/core-lro": "^2.2.0" + "@azure/core-paging": "^1.5.0", + "@azure/core-lro": "^3.0.0", + "@azure/abort-controller": "^2.1.2" }, "devDependencies": { "@azure/core-util": "^1.6.1", diff --git a/sdk/deviceupdate/iot-device-update-rest/review/iot-device-update.api.md b/sdk/deviceupdate/iot-device-update-rest/review/iot-device-update.api.md index c7694b9b430f..c66580d6cb59 100644 --- a/sdk/deviceupdate/iot-device-update-rest/review/iot-device-update.api.md +++ b/sdk/deviceupdate/iot-device-update-rest/review/iot-device-update.api.md @@ -4,55 +4,56 @@ ```ts +import { AbortSignalLike } from '@azure/abort-controller'; +import { CancelOnProgress } from '@azure/core-lro'; import { Client } from '@azure-rest/core-client'; import { ClientOptions } from '@azure-rest/core-client'; +import { CreateHttpPollerOptions } from '@azure/core-lro'; import { HttpResponse } from '@azure-rest/core-client'; -import { LroEngineOptions } from '@azure/core-lro'; +import { OperationState } from '@azure/core-lro'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; import { PathUncheckedResponse } from '@azure-rest/core-client'; -import { PollerLike } from '@azure/core-lro'; -import { PollOperationState } from '@azure/core-lro'; import { RawHttpHeaders } from '@azure/core-rest-pipeline'; import { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; import { RequestParameters } from '@azure-rest/core-client'; import { StreamableMethod } from '@azure-rest/core-client'; import { TokenCredential } from '@azure/core-auth'; -// @public (undocumented) +// @public export interface CloudInitiatedRollbackPolicy { failure: CloudInitiatedRollbackPolicyFailure; update: UpdateInfo; } -// @public (undocumented) +// @public export interface CloudInitiatedRollbackPolicyFailure { devicesFailedCount: number; devicesFailedPercentage: number; } -// @public (undocumented) +// @public export interface CloudInitiatedRollbackPolicyFailureOutput { devicesFailedCount: number; devicesFailedPercentage: number; } -// @public (undocumented) +// @public export interface CloudInitiatedRollbackPolicyOutput { failure: CloudInitiatedRollbackPolicyFailureOutput; update: UpdateInfoOutput; } -// @public (undocumented) +// @public export interface ContractModelOutput { id: string; name: string; } -// @public (undocumented) -function createClient(endpoint: string, credentials: TokenCredential, options?: ClientOptions): DeviceUpdateClient; +// @public +function createClient(endpoint: string, credentials: TokenCredential, { apiVersion, ...options }?: DeviceUpdateClientOptions): DeviceUpdateClient; export default createClient; -// @public (undocumented) +// @public export interface Deployment { deploymentId: string; deviceClassSubgroups?: Array; @@ -65,7 +66,7 @@ export interface Deployment { update: UpdateInfo; } -// @public (undocumented) +// @public export interface DeploymentDeviceStateOutput { deviceId: string; deviceState: "Succeeded" | "InProgress" | "Canceled" | "Failed"; @@ -74,13 +75,13 @@ export interface DeploymentDeviceStateOutput { retryCount: number; } -// @public (undocumented) +// @public export interface DeploymentDeviceStatesListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface DeploymentOutput { deploymentId: string; deviceClassSubgroups?: Array; @@ -93,13 +94,13 @@ export interface DeploymentOutput { update: UpdateInfoOutput; } -// @public (undocumented) +// @public export interface DeploymentsListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface DeploymentStatusOutput { deploymentState: "Active" | "ActiveWithSubgroupFailures" | "Failed" | "Inactive" | "Canceled"; error?: ErrorModelOutput; @@ -107,13 +108,13 @@ export interface DeploymentStatusOutput { subgroupStatus: Array; } -// @public (undocumented) +// @public export interface DeviceClassesListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface DeviceClassOutput { bestCompatibleUpdate?: UpdateInfoOutput; deviceClassId: string; @@ -121,13 +122,13 @@ export interface DeviceClassOutput { friendlyName?: string; } -// @public (undocumented) +// @public export interface DeviceClassPropertiesOutput { compatProperties: Record; contractModel?: ContractModelOutput; } -// @public (undocumented) +// @public export interface DeviceClassSubgroupDeploymentStatusOutput { deploymentState: "Active" | "Failed" | "Inactive" | "Canceled"; deviceClassId: string; @@ -140,7 +141,7 @@ export interface DeviceClassSubgroupDeploymentStatusOutput { totalDevices?: number; } -// @public (undocumented) +// @public export interface DeviceClassSubgroupOutput { createdDateTime: string; deploymentId?: string; @@ -149,19 +150,19 @@ export interface DeviceClassSubgroupOutput { groupId: string; } -// @public (undocumented) +// @public export interface DeviceClassSubgroupsListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface DeviceClassSubgroupUpdatableDevicesListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface DeviceClassSubgroupUpdatableDevicesOutput { deviceClassId: string; deviceCount: number; @@ -169,13 +170,13 @@ export interface DeviceClassSubgroupUpdatableDevicesOutput { update: UpdateInfoOutput; } -// @public (undocumented) +// @public export interface DeviceHealthListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface DeviceHealthOutput { deviceId: string; digitalTwinModelId?: string; @@ -198,7 +199,7 @@ export interface DeviceManagementCreateOrUpdateDeploymentBodyParam { } // @public -export interface DeviceManagementCreateOrUpdateDeploymentdefaultResponse extends HttpResponse { +export interface DeviceManagementCreateOrUpdateDeploymentDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -215,14 +216,12 @@ export type DeviceManagementCreateOrUpdateDeploymentParameters = DeviceManagemen // @public export interface DeviceManagementDeleteDeployment204Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) status: "204"; } // @public -export interface DeviceManagementDeleteDeploymentdefaultResponse extends HttpResponse { +export interface DeviceManagementDeleteDeploymentDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -231,14 +230,12 @@ export interface DeviceManagementDeleteDeploymentdefaultResponse extends HttpRes // @public export interface DeviceManagementDeleteDeploymentForDeviceClassSubgroup204Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) status: "204"; } // @public -export interface DeviceManagementDeleteDeploymentForDeviceClassSubgroupdefaultResponse extends HttpResponse { +export interface DeviceManagementDeleteDeploymentForDeviceClassSubgroupDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -253,14 +250,12 @@ export type DeviceManagementDeleteDeploymentParameters = RequestParameters; // @public export interface DeviceManagementDeleteDeviceClass204Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) status: "204"; } // @public -export interface DeviceManagementDeleteDeviceClassdefaultResponse extends HttpResponse { +export interface DeviceManagementDeleteDeviceClassDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -272,14 +267,12 @@ export type DeviceManagementDeleteDeviceClassParameters = RequestParameters; // @public export interface DeviceManagementDeleteDeviceClassSubgroup204Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) status: "204"; } // @public -export interface DeviceManagementDeleteDeviceClassSubgroupdefaultResponse extends HttpResponse { +export interface DeviceManagementDeleteDeviceClassSubgroupDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -291,14 +284,12 @@ export type DeviceManagementDeleteDeviceClassSubgroupParameters = RequestParamet // @public export interface DeviceManagementDeleteGroup204Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) status: "204"; } // @public -export interface DeviceManagementDeleteGroupdefaultResponse extends HttpResponse { +export interface DeviceManagementDeleteGroupDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -310,7 +301,7 @@ export type DeviceManagementDeleteGroupParameters = RequestParameters; // @public (undocumented) export interface DeviceManagementGetBestUpdatesForDeviceClassSubgroup { - get(options?: DeviceManagementGetBestUpdatesForDeviceClassSubgroupParameters): StreamableMethod; + get(options?: DeviceManagementGetBestUpdatesForDeviceClassSubgroupParameters): StreamableMethod; } // @public @@ -322,7 +313,7 @@ export interface DeviceManagementGetBestUpdatesForDeviceClassSubgroup200Response } // @public -export interface DeviceManagementGetBestUpdatesForDeviceClassSubgroupdefaultResponse extends HttpResponse { +export interface DeviceManagementGetBestUpdatesForDeviceClassSubgroupDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -334,9 +325,9 @@ export type DeviceManagementGetBestUpdatesForDeviceClassSubgroupParameters = Req // @public (undocumented) export interface DeviceManagementGetDeployment { - delete(options?: DeviceManagementDeleteDeploymentParameters): StreamableMethod; - get(options?: DeviceManagementGetDeploymentParameters): StreamableMethod; - put(options: DeviceManagementCreateOrUpdateDeploymentParameters): StreamableMethod; + delete(options?: DeviceManagementDeleteDeploymentParameters): StreamableMethod; + get(options?: DeviceManagementGetDeploymentParameters): StreamableMethod; + put(options: DeviceManagementCreateOrUpdateDeploymentParameters): StreamableMethod; } // @public @@ -348,7 +339,7 @@ export interface DeviceManagementGetDeployment200Response extends HttpResponse { } // @public -export interface DeviceManagementGetDeploymentdefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeploymentDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -357,8 +348,8 @@ export interface DeviceManagementGetDeploymentdefaultResponse extends HttpRespon // @public (undocumented) export interface DeviceManagementGetDeploymentForDeviceClassSubgroup { - delete(options?: DeviceManagementDeleteDeploymentForDeviceClassSubgroupParameters): StreamableMethod; - get(options?: DeviceManagementGetDeploymentForDeviceClassSubgroupParameters): StreamableMethod; + delete(options?: DeviceManagementDeleteDeploymentForDeviceClassSubgroupParameters): StreamableMethod; + get(options?: DeviceManagementGetDeploymentForDeviceClassSubgroupParameters): StreamableMethod; } // @public @@ -370,7 +361,7 @@ export interface DeviceManagementGetDeploymentForDeviceClassSubgroup200Response } // @public -export interface DeviceManagementGetDeploymentForDeviceClassSubgroupdefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeploymentForDeviceClassSubgroupDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -385,7 +376,7 @@ export type DeviceManagementGetDeploymentParameters = RequestParameters; // @public (undocumented) export interface DeviceManagementGetDeploymentStatus { - get(options?: DeviceManagementGetDeploymentStatusParameters): StreamableMethod; + get(options?: DeviceManagementGetDeploymentStatusParameters): StreamableMethod; } // @public @@ -397,7 +388,7 @@ export interface DeviceManagementGetDeploymentStatus200Response extends HttpResp } // @public -export interface DeviceManagementGetDeploymentStatusdefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeploymentStatusDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -409,7 +400,7 @@ export type DeviceManagementGetDeploymentStatusParameters = RequestParameters; // @public (undocumented) export interface DeviceManagementGetDevice { - get(options?: DeviceManagementGetDeviceParameters): StreamableMethod; + get(options?: DeviceManagementGetDeviceParameters): StreamableMethod; } // @public @@ -422,9 +413,9 @@ export interface DeviceManagementGetDevice200Response extends HttpResponse { // @public (undocumented) export interface DeviceManagementGetDeviceClass { - delete(options?: DeviceManagementDeleteDeviceClassParameters): StreamableMethod; - get(options?: DeviceManagementGetDeviceClassParameters): StreamableMethod; - patch(options: DeviceManagementUpdateDeviceClassParameters): StreamableMethod; + delete(options?: DeviceManagementDeleteDeviceClassParameters): StreamableMethod; + get(options?: DeviceManagementGetDeviceClassParameters): StreamableMethod; + patch(options: DeviceManagementUpdateDeviceClassParameters): StreamableMethod; } // @public @@ -436,7 +427,7 @@ export interface DeviceManagementGetDeviceClass200Response extends HttpResponse } // @public -export interface DeviceManagementGetDeviceClassdefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeviceClassDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -448,8 +439,8 @@ export type DeviceManagementGetDeviceClassParameters = RequestParameters; // @public (undocumented) export interface DeviceManagementGetDeviceClassSubgroup { - delete(options?: DeviceManagementDeleteDeviceClassSubgroupParameters): StreamableMethod; - get(options?: DeviceManagementGetDeviceClassSubgroupParameters): StreamableMethod; + delete(options?: DeviceManagementDeleteDeviceClassSubgroupParameters): StreamableMethod; + get(options?: DeviceManagementGetDeviceClassSubgroupParameters): StreamableMethod; } // @public @@ -461,7 +452,7 @@ export interface DeviceManagementGetDeviceClassSubgroup200Response extends HttpR } // @public -export interface DeviceManagementGetDeviceClassSubgroupdefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeviceClassSubgroupDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -470,7 +461,7 @@ export interface DeviceManagementGetDeviceClassSubgroupdefaultResponse extends H // @public (undocumented) export interface DeviceManagementGetDeviceClassSubgroupDeploymentStatus { - get(options?: DeviceManagementGetDeviceClassSubgroupDeploymentStatusParameters): StreamableMethod; + get(options?: DeviceManagementGetDeviceClassSubgroupDeploymentStatusParameters): StreamableMethod; } // @public @@ -482,7 +473,7 @@ export interface DeviceManagementGetDeviceClassSubgroupDeploymentStatus200Respon } // @public -export interface DeviceManagementGetDeviceClassSubgroupDeploymentStatusdefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeviceClassSubgroupDeploymentStatusDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -497,7 +488,7 @@ export type DeviceManagementGetDeviceClassSubgroupParameters = RequestParameters // @public (undocumented) export interface DeviceManagementGetDeviceClassSubgroupUpdateCompliance { - get(options?: DeviceManagementGetDeviceClassSubgroupUpdateComplianceParameters): StreamableMethod; + get(options?: DeviceManagementGetDeviceClassSubgroupUpdateComplianceParameters): StreamableMethod; } // @public @@ -509,7 +500,7 @@ export interface DeviceManagementGetDeviceClassSubgroupUpdateCompliance200Respon } // @public -export interface DeviceManagementGetDeviceClassSubgroupUpdateCompliancedefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeviceClassSubgroupUpdateComplianceDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -520,7 +511,7 @@ export interface DeviceManagementGetDeviceClassSubgroupUpdateCompliancedefaultRe export type DeviceManagementGetDeviceClassSubgroupUpdateComplianceParameters = RequestParameters; // @public -export interface DeviceManagementGetDevicedefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeviceDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -529,7 +520,7 @@ export interface DeviceManagementGetDevicedefaultResponse extends HttpResponse { // @public (undocumented) export interface DeviceManagementGetDeviceModule { - get(options?: DeviceManagementGetDeviceModuleParameters): StreamableMethod; + get(options?: DeviceManagementGetDeviceModuleParameters): StreamableMethod; } // @public @@ -541,7 +532,7 @@ export interface DeviceManagementGetDeviceModule200Response extends HttpResponse } // @public -export interface DeviceManagementGetDeviceModuledefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeviceModuleDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -556,8 +547,8 @@ export type DeviceManagementGetDeviceParameters = RequestParameters; // @public (undocumented) export interface DeviceManagementGetGroup { - delete(options?: DeviceManagementDeleteGroupParameters): StreamableMethod; - get(options?: DeviceManagementGetGroupParameters): StreamableMethod; + delete(options?: DeviceManagementDeleteGroupParameters): StreamableMethod; + get(options?: DeviceManagementGetGroupParameters): StreamableMethod; } // @public @@ -569,7 +560,7 @@ export interface DeviceManagementGetGroup200Response extends HttpResponse { } // @public -export interface DeviceManagementGetGroupdefaultResponse extends HttpResponse { +export interface DeviceManagementGetGroupDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -588,7 +579,7 @@ export interface DeviceManagementGetLogCollection200Response extends HttpRespons } // @public -export interface DeviceManagementGetLogCollectiondefaultResponse extends HttpResponse { +export interface DeviceManagementGetLogCollectionDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -597,7 +588,7 @@ export interface DeviceManagementGetLogCollectiondefaultResponse extends HttpRes // @public (undocumented) export interface DeviceManagementGetLogCollectionDetailedStatus { - get(options?: DeviceManagementGetLogCollectionDetailedStatusParameters): StreamableMethod; + get(options?: DeviceManagementGetLogCollectionDetailedStatusParameters): StreamableMethod; } // @public @@ -609,7 +600,7 @@ export interface DeviceManagementGetLogCollectionDetailedStatus200Response exten } // @public -export interface DeviceManagementGetLogCollectionDetailedStatusdefaultResponse extends HttpResponse { +export interface DeviceManagementGetLogCollectionDetailedStatusDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -624,7 +615,7 @@ export type DeviceManagementGetLogCollectionParameters = RequestParameters; // @public (undocumented) export interface DeviceManagementGetOperationStatus { - get(options?: DeviceManagementGetOperationStatusParameters): StreamableMethod; + get(options?: DeviceManagementGetOperationStatusParameters): StreamableMethod; } // @public (undocumented) @@ -644,14 +635,12 @@ export interface DeviceManagementGetOperationStatus200Response extends HttpRespo // @public export interface DeviceManagementGetOperationStatus304Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) status: "304"; } // @public -export interface DeviceManagementGetOperationStatusdefaultResponse extends HttpResponse { +export interface DeviceManagementGetOperationStatusDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -661,7 +650,7 @@ export interface DeviceManagementGetOperationStatusdefaultResponse extends HttpR // @public (undocumented) export interface DeviceManagementGetOperationStatusHeaderParam { // (undocumented) - headers: RawHttpHeadersInput & DeviceManagementGetOperationStatusHeaders; + headers?: RawHttpHeadersInput & DeviceManagementGetOperationStatusHeaders; } // @public (undocumented) @@ -674,7 +663,7 @@ export type DeviceManagementGetOperationStatusParameters = DeviceManagementGetOp // @public (undocumented) export interface DeviceManagementGetUpdateCompliance { - get(options?: DeviceManagementGetUpdateComplianceParameters): StreamableMethod; + get(options?: DeviceManagementGetUpdateComplianceParameters): StreamableMethod; } // @public @@ -686,7 +675,7 @@ export interface DeviceManagementGetUpdateCompliance200Response extends HttpResp } // @public -export interface DeviceManagementGetUpdateCompliancedefaultResponse extends HttpResponse { +export interface DeviceManagementGetUpdateComplianceDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -695,7 +684,7 @@ export interface DeviceManagementGetUpdateCompliancedefaultResponse extends Http // @public (undocumented) export interface DeviceManagementGetUpdateComplianceForGroup { - get(options?: DeviceManagementGetUpdateComplianceForGroupParameters): StreamableMethod; + get(options?: DeviceManagementGetUpdateComplianceForGroupParameters): StreamableMethod; } // @public @@ -707,7 +696,7 @@ export interface DeviceManagementGetUpdateComplianceForGroup200Response extends } // @public -export interface DeviceManagementGetUpdateComplianceForGroupdefaultResponse extends HttpResponse { +export interface DeviceManagementGetUpdateComplianceForGroupDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -722,7 +711,7 @@ export type DeviceManagementGetUpdateComplianceParameters = RequestParameters; // @public (undocumented) export interface DeviceManagementImportDevices { - post(options: DeviceManagementImportDevicesParameters): StreamableMethod; + post(options: DeviceManagementImportDevicesParameters): StreamableMethod; } // @public (undocumented) @@ -732,8 +721,6 @@ export interface DeviceManagementImportDevices202Headers { // @public export interface DeviceManagementImportDevices202Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) headers: RawHttpHeaders & DeviceManagementImportDevices202Headers; // (undocumented) @@ -746,7 +733,7 @@ export interface DeviceManagementImportDevicesBodyParam { } // @public -export interface DeviceManagementImportDevicesdefaultResponse extends HttpResponse { +export interface DeviceManagementImportDevicesDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -763,7 +750,7 @@ export type DeviceManagementImportDevicesParameters = DeviceManagementImportDevi // @public (undocumented) export interface DeviceManagementListBestUpdatesForGroup { - get(options?: DeviceManagementListBestUpdatesForGroupParameters): StreamableMethod; + get(options?: DeviceManagementListBestUpdatesForGroupParameters): StreamableMethod; } // @public @@ -775,7 +762,7 @@ export interface DeviceManagementListBestUpdatesForGroup200Response extends Http } // @public -export interface DeviceManagementListBestUpdatesForGroupdefaultResponse extends HttpResponse { +export interface DeviceManagementListBestUpdatesForGroupDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -787,7 +774,7 @@ export type DeviceManagementListBestUpdatesForGroupParameters = RequestParameter // @public (undocumented) export interface DeviceManagementListDeploymentsForDeviceClassSubgroup { - get(options?: DeviceManagementListDeploymentsForDeviceClassSubgroupParameters): StreamableMethod; + get(options?: DeviceManagementListDeploymentsForDeviceClassSubgroupParameters): StreamableMethod; } // @public @@ -799,7 +786,7 @@ export interface DeviceManagementListDeploymentsForDeviceClassSubgroup200Respons } // @public -export interface DeviceManagementListDeploymentsForDeviceClassSubgroupdefaultResponse extends HttpResponse { +export interface DeviceManagementListDeploymentsForDeviceClassSubgroupDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -822,7 +809,7 @@ export interface DeviceManagementListDeploymentsForDeviceClassSubgroupQueryParam // @public (undocumented) export interface DeviceManagementListDeploymentsForGroup { - get(options?: DeviceManagementListDeploymentsForGroupParameters): StreamableMethod; + get(options?: DeviceManagementListDeploymentsForGroupParameters): StreamableMethod; } // @public @@ -834,7 +821,7 @@ export interface DeviceManagementListDeploymentsForGroup200Response extends Http } // @public -export interface DeviceManagementListDeploymentsForGroupdefaultResponse extends HttpResponse { +export interface DeviceManagementListDeploymentsForGroupDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -857,7 +844,7 @@ export interface DeviceManagementListDeploymentsForGroupQueryParamProperties { // @public (undocumented) export interface DeviceManagementListDeviceClasses { - get(options?: DeviceManagementListDeviceClassesParameters): StreamableMethod; + get(options?: DeviceManagementListDeviceClassesParameters): StreamableMethod; } // @public @@ -869,7 +856,7 @@ export interface DeviceManagementListDeviceClasses200Response extends HttpRespon } // @public -export interface DeviceManagementListDeviceClassesdefaultResponse extends HttpResponse { +export interface DeviceManagementListDeviceClassesDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -892,7 +879,7 @@ export interface DeviceManagementListDeviceClassesQueryParamProperties { // @public (undocumented) export interface DeviceManagementListDeviceClassSubgroupsForGroup { - get(options?: DeviceManagementListDeviceClassSubgroupsForGroupParameters): StreamableMethod; + get(options?: DeviceManagementListDeviceClassSubgroupsForGroupParameters): StreamableMethod; } // @public @@ -904,7 +891,7 @@ export interface DeviceManagementListDeviceClassSubgroupsForGroup200Response ext } // @public -export interface DeviceManagementListDeviceClassSubgroupsForGroupdefaultResponse extends HttpResponse { +export interface DeviceManagementListDeviceClassSubgroupsForGroupDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -927,7 +914,7 @@ export interface DeviceManagementListDeviceClassSubgroupsForGroupQueryParamPrope // @public (undocumented) export interface DeviceManagementListDevices { - get(options?: DeviceManagementListDevicesParameters): StreamableMethod; + get(options?: DeviceManagementListDevicesParameters): StreamableMethod; } // @public @@ -939,7 +926,7 @@ export interface DeviceManagementListDevices200Response extends HttpResponse { } // @public -export interface DeviceManagementListDevicesdefaultResponse extends HttpResponse { +export interface DeviceManagementListDevicesDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -962,7 +949,7 @@ export interface DeviceManagementListDevicesQueryParamProperties { // @public (undocumented) export interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeployment { - get(options?: DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentParameters): StreamableMethod; + get(options?: DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentParameters): StreamableMethod; } // @public @@ -974,7 +961,7 @@ export interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymen } // @public -export interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentdefaultResponse extends HttpResponse { +export interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -997,7 +984,7 @@ export interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymen // @public (undocumented) export interface DeviceManagementListGroups { - get(options?: DeviceManagementListGroupsParameters): StreamableMethod; + get(options?: DeviceManagementListGroupsParameters): StreamableMethod; } // @public @@ -1009,7 +996,7 @@ export interface DeviceManagementListGroups200Response extends HttpResponse { } // @public -export interface DeviceManagementListGroupsdefaultResponse extends HttpResponse { +export interface DeviceManagementListGroupsDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1032,7 +1019,7 @@ export interface DeviceManagementListGroupsQueryParamProperties { // @public (undocumented) export interface DeviceManagementListHealthOfDevices { - get(options: DeviceManagementListHealthOfDevicesParameters): StreamableMethod; + get(options: DeviceManagementListHealthOfDevicesParameters): StreamableMethod; } // @public @@ -1044,7 +1031,7 @@ export interface DeviceManagementListHealthOfDevices200Response extends HttpResp } // @public -export interface DeviceManagementListHealthOfDevicesdefaultResponse extends HttpResponse { +export interface DeviceManagementListHealthOfDevicesDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1067,7 +1054,7 @@ export interface DeviceManagementListHealthOfDevicesQueryParamProperties { // @public (undocumented) export interface DeviceManagementListInstallableUpdatesForDeviceClass { - get(options?: DeviceManagementListInstallableUpdatesForDeviceClassParameters): StreamableMethod; + get(options?: DeviceManagementListInstallableUpdatesForDeviceClassParameters): StreamableMethod; } // @public @@ -1079,7 +1066,7 @@ export interface DeviceManagementListInstallableUpdatesForDeviceClass200Response } // @public -export interface DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse extends HttpResponse { +export interface DeviceManagementListInstallableUpdatesForDeviceClassDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1091,7 +1078,7 @@ export type DeviceManagementListInstallableUpdatesForDeviceClassParameters = Req // @public (undocumented) export interface DeviceManagementListLogCollections { - get(options?: DeviceManagementListLogCollectionsParameters): StreamableMethod; + get(options?: DeviceManagementListLogCollectionsParameters): StreamableMethod; } // @public @@ -1103,7 +1090,7 @@ export interface DeviceManagementListLogCollections200Response extends HttpRespo } // @public -export interface DeviceManagementListLogCollectionsdefaultResponse extends HttpResponse { +export interface DeviceManagementListLogCollectionsDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1115,7 +1102,7 @@ export type DeviceManagementListLogCollectionsParameters = RequestParameters; // @public (undocumented) export interface DeviceManagementListOperationStatuses { - get(options?: DeviceManagementListOperationStatusesParameters): StreamableMethod; + get(options?: DeviceManagementListOperationStatusesParameters): StreamableMethod; } // @public @@ -1127,7 +1114,7 @@ export interface DeviceManagementListOperationStatuses200Response extends HttpRe } // @public -export interface DeviceManagementListOperationStatusesdefaultResponse extends HttpResponse { +export interface DeviceManagementListOperationStatusesDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1151,7 +1138,7 @@ export interface DeviceManagementListOperationStatusesQueryParamProperties { // @public (undocumented) export interface DeviceManagementRetryDeployment { - post(options?: DeviceManagementRetryDeploymentParameters): StreamableMethod; + post(options?: DeviceManagementRetryDeploymentParameters): StreamableMethod; } // @public @@ -1163,7 +1150,7 @@ export interface DeviceManagementRetryDeployment200Response extends HttpResponse } // @public -export interface DeviceManagementRetryDeploymentdefaultResponse extends HttpResponse { +export interface DeviceManagementRetryDeploymentDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1175,8 +1162,8 @@ export type DeviceManagementRetryDeploymentParameters = RequestParameters; // @public (undocumented) export interface DeviceManagementStartLogCollection { - get(options?: DeviceManagementGetLogCollectionParameters): StreamableMethod; - put(options: DeviceManagementStartLogCollectionParameters): StreamableMethod; + get(options?: DeviceManagementGetLogCollectionParameters): StreamableMethod; + put(options: DeviceManagementStartLogCollectionParameters): StreamableMethod; } // @public @@ -1193,7 +1180,7 @@ export interface DeviceManagementStartLogCollectionBodyParam { } // @public -export interface DeviceManagementStartLogCollectiondefaultResponse extends HttpResponse { +export interface DeviceManagementStartLogCollectionDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1210,7 +1197,7 @@ export type DeviceManagementStartLogCollectionParameters = DeviceManagementStart // @public (undocumented) export interface DeviceManagementStopDeployment { - post(options?: DeviceManagementStopDeploymentParameters): StreamableMethod; + post(options?: DeviceManagementStopDeploymentParameters): StreamableMethod; } // @public @@ -1222,7 +1209,7 @@ export interface DeviceManagementStopDeployment200Response extends HttpResponse } // @public -export interface DeviceManagementStopDeploymentdefaultResponse extends HttpResponse { +export interface DeviceManagementStopDeploymentDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1242,11 +1229,11 @@ export interface DeviceManagementUpdateDeviceClass200Response extends HttpRespon // @public (undocumented) export interface DeviceManagementUpdateDeviceClassBodyParam { - body: PatchBody; + body: PatchBodyResourceMergeAndPatch; } // @public -export interface DeviceManagementUpdateDeviceClassdefaultResponse extends HttpResponse { +export interface DeviceManagementUpdateDeviceClassDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1261,7 +1248,7 @@ export interface DeviceManagementUpdateDeviceClassMediaTypesParam { // @public (undocumented) export type DeviceManagementUpdateDeviceClassParameters = DeviceManagementUpdateDeviceClassMediaTypesParam & DeviceManagementUpdateDeviceClassBodyParam & RequestParameters; -// @public (undocumented) +// @public export interface DeviceOperationOutput { createdDateTime: string; error?: ErrorModelOutput; @@ -1272,13 +1259,13 @@ export interface DeviceOperationOutput { traceId?: string; } -// @public (undocumented) +// @public export interface DeviceOperationsListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface DeviceOutput { deploymentStatus?: "Succeeded" | "InProgress" | "Canceled" | "Failed"; deviceClassId: string; @@ -1292,19 +1279,19 @@ export interface DeviceOutput { onLatestUpdate: boolean; } -// @public (undocumented) +// @public export interface DevicesListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface DeviceUpdateAgentId { deviceId: string; moduleId?: string; } -// @public (undocumented) +// @public export interface DeviceUpdateAgentIdOutput { deviceId: string; moduleId?: string; @@ -1315,6 +1302,11 @@ export type DeviceUpdateClient = Client & { path: Routes; }; +// @public +export interface DeviceUpdateClientOptions extends ClientOptions { + apiVersion?: string; +} + // @public (undocumented) export interface DeviceUpdateDeleteUpdate202Headers { "operation-location"?: string; @@ -1322,8 +1314,6 @@ export interface DeviceUpdateDeleteUpdate202Headers { // @public export interface DeviceUpdateDeleteUpdate202Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) headers: RawHttpHeaders & DeviceUpdateDeleteUpdate202Headers; // (undocumented) @@ -1331,7 +1321,7 @@ export interface DeviceUpdateDeleteUpdate202Response extends HttpResponse { } // @public -export interface DeviceUpdateDeleteUpdatedefaultResponse extends HttpResponse { +export interface DeviceUpdateDeleteUpdateDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1343,7 +1333,7 @@ export type DeviceUpdateDeleteUpdateParameters = RequestParameters; // @public (undocumented) export interface DeviceUpdateGetFile { - get(options?: DeviceUpdateGetFileParameters): StreamableMethod; + get(options?: DeviceUpdateGetFileParameters): StreamableMethod; } // @public @@ -1356,14 +1346,12 @@ export interface DeviceUpdateGetFile200Response extends HttpResponse { // @public export interface DeviceUpdateGetFile304Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) status: "304"; } // @public -export interface DeviceUpdateGetFiledefaultResponse extends HttpResponse { +export interface DeviceUpdateGetFileDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1373,7 +1361,7 @@ export interface DeviceUpdateGetFiledefaultResponse extends HttpResponse { // @public (undocumented) export interface DeviceUpdateGetFileHeaderParam { // (undocumented) - headers: RawHttpHeadersInput & DeviceUpdateGetFileHeaders; + headers?: RawHttpHeadersInput & DeviceUpdateGetFileHeaders; } // @public (undocumented) @@ -1386,7 +1374,7 @@ export type DeviceUpdateGetFileParameters = DeviceUpdateGetFileHeaderParam & Req // @public (undocumented) export interface DeviceUpdateGetOperationStatus { - get(options?: DeviceUpdateGetOperationStatusParameters): StreamableMethod; + get(options?: DeviceUpdateGetOperationStatusParameters): StreamableMethod; } // @public (undocumented) @@ -1406,14 +1394,12 @@ export interface DeviceUpdateGetOperationStatus200Response extends HttpResponse // @public export interface DeviceUpdateGetOperationStatus304Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) status: "304"; } // @public -export interface DeviceUpdateGetOperationStatusdefaultResponse extends HttpResponse { +export interface DeviceUpdateGetOperationStatusDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1423,7 +1409,7 @@ export interface DeviceUpdateGetOperationStatusdefaultResponse extends HttpRespo // @public (undocumented) export interface DeviceUpdateGetOperationStatusHeaderParam { // (undocumented) - headers: RawHttpHeadersInput & DeviceUpdateGetOperationStatusHeaders; + headers?: RawHttpHeadersInput & DeviceUpdateGetOperationStatusHeaders; } // @public (undocumented) @@ -1436,8 +1422,8 @@ export type DeviceUpdateGetOperationStatusParameters = DeviceUpdateGetOperationS // @public (undocumented) export interface DeviceUpdateGetUpdate { - delete(options?: DeviceUpdateDeleteUpdateParameters): StreamableMethod; - get(options?: DeviceUpdateGetUpdateParameters): StreamableMethod; + delete(options?: DeviceUpdateDeleteUpdateParameters): StreamableMethod; + get(options?: DeviceUpdateGetUpdateParameters): StreamableMethod; } // @public @@ -1450,14 +1436,12 @@ export interface DeviceUpdateGetUpdate200Response extends HttpResponse { // @public export interface DeviceUpdateGetUpdate304Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) status: "304"; } // @public -export interface DeviceUpdateGetUpdatedefaultResponse extends HttpResponse { +export interface DeviceUpdateGetUpdateDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1467,7 +1451,7 @@ export interface DeviceUpdateGetUpdatedefaultResponse extends HttpResponse { // @public (undocumented) export interface DeviceUpdateGetUpdateHeaderParam { // (undocumented) - headers: RawHttpHeadersInput & DeviceUpdateGetUpdateHeaders; + headers?: RawHttpHeadersInput & DeviceUpdateGetUpdateHeaders; } // @public (undocumented) @@ -1480,7 +1464,7 @@ export type DeviceUpdateGetUpdateParameters = DeviceUpdateGetUpdateHeaderParam & // @public (undocumented) export interface DeviceUpdateImportUpdate { - post(options: DeviceUpdateImportUpdateParameters): StreamableMethod; + post(options: DeviceUpdateImportUpdateParameters): StreamableMethod; } // @public @@ -1498,8 +1482,6 @@ export interface DeviceUpdateImportUpdate202Headers { // @public export interface DeviceUpdateImportUpdate202Response extends HttpResponse { - // (undocumented) - body: Record; // (undocumented) headers: RawHttpHeaders & DeviceUpdateImportUpdate202Headers; // (undocumented) @@ -1512,7 +1494,7 @@ export interface DeviceUpdateImportUpdateBodyParam { } // @public -export interface DeviceUpdateImportUpdatedefaultResponse extends HttpResponse { +export interface DeviceUpdateImportUpdateDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1529,7 +1511,7 @@ export type DeviceUpdateImportUpdateParameters = DeviceUpdateImportUpdateMediaTy // @public (undocumented) export interface DeviceUpdateListFiles { - get(options?: DeviceUpdateListFilesParameters): StreamableMethod; + get(options?: DeviceUpdateListFilesParameters): StreamableMethod; } // @public @@ -1541,7 +1523,7 @@ export interface DeviceUpdateListFiles200Response extends HttpResponse { } // @public -export interface DeviceUpdateListFilesdefaultResponse extends HttpResponse { +export interface DeviceUpdateListFilesDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1553,7 +1535,7 @@ export type DeviceUpdateListFilesParameters = RequestParameters; // @public (undocumented) export interface DeviceUpdateListNames { - get(options?: DeviceUpdateListNamesParameters): StreamableMethod; + get(options?: DeviceUpdateListNamesParameters): StreamableMethod; } // @public @@ -1565,7 +1547,7 @@ export interface DeviceUpdateListNames200Response extends HttpResponse { } // @public -export interface DeviceUpdateListNamesdefaultResponse extends HttpResponse { +export interface DeviceUpdateListNamesDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1577,7 +1559,7 @@ export type DeviceUpdateListNamesParameters = RequestParameters; // @public (undocumented) export interface DeviceUpdateListOperationStatuses { - get(options?: DeviceUpdateListOperationStatusesParameters): StreamableMethod; + get(options?: DeviceUpdateListOperationStatusesParameters): StreamableMethod; } // @public @@ -1589,7 +1571,7 @@ export interface DeviceUpdateListOperationStatuses200Response extends HttpRespon } // @public -export interface DeviceUpdateListOperationStatusesdefaultResponse extends HttpResponse { +export interface DeviceUpdateListOperationStatusesDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1613,7 +1595,7 @@ export interface DeviceUpdateListOperationStatusesQueryParamProperties { // @public (undocumented) export interface DeviceUpdateListProviders { - get(options?: DeviceUpdateListProvidersParameters): StreamableMethod; + get(options?: DeviceUpdateListProvidersParameters): StreamableMethod; } // @public @@ -1625,7 +1607,7 @@ export interface DeviceUpdateListProviders200Response extends HttpResponse { } // @public -export interface DeviceUpdateListProvidersdefaultResponse extends HttpResponse { +export interface DeviceUpdateListProvidersDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1637,7 +1619,7 @@ export type DeviceUpdateListProvidersParameters = RequestParameters; // @public (undocumented) export interface DeviceUpdateListUpdates { - get(options?: DeviceUpdateListUpdatesParameters): StreamableMethod; + get(options?: DeviceUpdateListUpdatesParameters): StreamableMethod; } // @public @@ -1649,7 +1631,7 @@ export interface DeviceUpdateListUpdates200Response extends HttpResponse { } // @public -export interface DeviceUpdateListUpdatesdefaultResponse extends HttpResponse { +export interface DeviceUpdateListUpdatesDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1673,7 +1655,7 @@ export interface DeviceUpdateListUpdatesQueryParamProperties { // @public (undocumented) export interface DeviceUpdateListVersions { - get(options?: DeviceUpdateListVersionsParameters): StreamableMethod; + get(options?: DeviceUpdateListVersionsParameters): StreamableMethod; } // @public @@ -1685,7 +1667,7 @@ export interface DeviceUpdateListVersions200Response extends HttpResponse { } // @public -export interface DeviceUpdateListVersionsdefaultResponse extends HttpResponse { +export interface DeviceUpdateListVersionsDefaultResponse extends HttpResponse { // (undocumented) body: ErrorResponseOutput; // (undocumented) @@ -1706,7 +1688,7 @@ export interface DeviceUpdateListVersionsQueryParamProperties { filter?: string; } -// @public (undocumented) +// @public export interface ErrorModelOutput { code: string; details?: Array; @@ -1716,12 +1698,12 @@ export interface ErrorModelOutput { target?: string; } -// @public (undocumented) +// @public export interface ErrorResponseOutput { error: ErrorModelOutput; } -// @public (undocumented) +// @public export interface FileImportMetadata { filename: string; url: string; @@ -1731,7 +1713,7 @@ export interface FileImportMetadata { export type GetArrayType = T extends Array ? TData : never; // @public -export function getLongRunningPoller(client: Client, initialResponse: TResult, options?: LroEngineOptions>): PollerLike, TResult>; +export function getLongRunningPoller(client: Client, initialResponse: TResult, options?: CreateHttpPollerOptions>): Promise, TResult>>; // @public export type GetPage = (pageLink: string, maxPageSize?: number) => Promise<{ @@ -1739,7 +1721,7 @@ export type GetPage = (pageLink: string, maxPageSize?: number) => Promise nextPageLink?: string; }>; -// @public (undocumented) +// @public export interface GroupOutput { createdDateTime: string; deployments?: Array; @@ -1751,33 +1733,33 @@ export interface GroupOutput { subgroupsWithUpdatesInProgressCount?: number; } -// @public (undocumented) +// @public export interface GroupsListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface HealthCheckOutput { name?: string; result?: "success" | "userError"; } -// @public (undocumented) +// @public export interface ImportManifestMetadata { hashes: Record; sizeInBytes: number; url: string; } -// @public (undocumented) +// @public export interface ImportUpdateInputItem { files?: Array; friendlyName?: string; importManifest: ImportManifestMetadata; } -// @public (undocumented) +// @public export interface InnerErrorOutput { code: string; errorDetail?: string; @@ -1785,7 +1767,7 @@ export interface InnerErrorOutput { message?: string; } -// @public (undocumented) +// @public export interface InstallResultOutput { extendedResultCode: number; resultCode: number; @@ -1799,172 +1781,169 @@ export interface InstructionsOutput { } // @public (undocumented) -export function isUnexpected(response: DeviceUpdateListUpdates200Response | DeviceUpdateListUpdatesdefaultResponse): response is DeviceUpdateListUpdatesdefaultResponse; +export function isUnexpected(response: DeviceUpdateListUpdates200Response | DeviceUpdateListUpdatesDefaultResponse): response is DeviceUpdateListUpdatesDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceUpdateImportUpdate200Response | DeviceUpdateImportUpdate202Response | DeviceUpdateImportUpdatedefaultResponse): response is DeviceUpdateImportUpdatedefaultResponse; +export function isUnexpected(response: DeviceUpdateImportUpdate200Response | DeviceUpdateImportUpdate202Response | DeviceUpdateImportUpdateDefaultResponse): response is DeviceUpdateImportUpdateDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceUpdateGetUpdate200Response | DeviceUpdateGetUpdate304Response | DeviceUpdateGetUpdatedefaultResponse): response is DeviceUpdateGetUpdatedefaultResponse; +export function isUnexpected(response: DeviceUpdateGetUpdate200Response | DeviceUpdateGetUpdate304Response | DeviceUpdateGetUpdateDefaultResponse): response is DeviceUpdateGetUpdateDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceUpdateDeleteUpdate202Response | DeviceUpdateDeleteUpdatedefaultResponse): response is DeviceUpdateDeleteUpdatedefaultResponse; +export function isUnexpected(response: DeviceUpdateDeleteUpdate202Response | DeviceUpdateDeleteUpdateDefaultResponse): response is DeviceUpdateDeleteUpdateDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceUpdateListProviders200Response | DeviceUpdateListProvidersdefaultResponse): response is DeviceUpdateListProvidersdefaultResponse; +export function isUnexpected(response: DeviceUpdateListProviders200Response | DeviceUpdateListProvidersDefaultResponse): response is DeviceUpdateListProvidersDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceUpdateListNames200Response | DeviceUpdateListNamesdefaultResponse): response is DeviceUpdateListNamesdefaultResponse; +export function isUnexpected(response: DeviceUpdateListNames200Response | DeviceUpdateListNamesDefaultResponse): response is DeviceUpdateListNamesDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceUpdateListVersions200Response | DeviceUpdateListVersionsdefaultResponse): response is DeviceUpdateListVersionsdefaultResponse; +export function isUnexpected(response: DeviceUpdateListVersions200Response | DeviceUpdateListVersionsDefaultResponse): response is DeviceUpdateListVersionsDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceUpdateListFiles200Response | DeviceUpdateListFilesdefaultResponse): response is DeviceUpdateListFilesdefaultResponse; +export function isUnexpected(response: DeviceUpdateListFiles200Response | DeviceUpdateListFilesDefaultResponse): response is DeviceUpdateListFilesDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceUpdateGetFile200Response | DeviceUpdateGetFile304Response | DeviceUpdateGetFiledefaultResponse): response is DeviceUpdateGetFiledefaultResponse; +export function isUnexpected(response: DeviceUpdateGetFile200Response | DeviceUpdateGetFile304Response | DeviceUpdateGetFileDefaultResponse): response is DeviceUpdateGetFileDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceUpdateListOperationStatuses200Response | DeviceUpdateListOperationStatusesdefaultResponse): response is DeviceUpdateListOperationStatusesdefaultResponse; +export function isUnexpected(response: DeviceUpdateListOperationStatuses200Response | DeviceUpdateListOperationStatusesDefaultResponse): response is DeviceUpdateListOperationStatusesDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceUpdateGetOperationStatus200Response | DeviceUpdateGetOperationStatus304Response | DeviceUpdateGetOperationStatusdefaultResponse): response is DeviceUpdateGetOperationStatusdefaultResponse; +export function isUnexpected(response: DeviceUpdateGetOperationStatus200Response | DeviceUpdateGetOperationStatus304Response | DeviceUpdateGetOperationStatusDefaultResponse): response is DeviceUpdateGetOperationStatusDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementListDeviceClasses200Response | DeviceManagementListDeviceClassesdefaultResponse): response is DeviceManagementListDeviceClassesdefaultResponse; +export function isUnexpected(response: DeviceManagementListDeviceClasses200Response | DeviceManagementListDeviceClassesDefaultResponse): response is DeviceManagementListDeviceClassesDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetDeviceClass200Response | DeviceManagementGetDeviceClassdefaultResponse): response is DeviceManagementGetDeviceClassdefaultResponse; +export function isUnexpected(response: DeviceManagementGetDeviceClass200Response | DeviceManagementGetDeviceClassDefaultResponse): response is DeviceManagementGetDeviceClassDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementUpdateDeviceClass200Response | DeviceManagementUpdateDeviceClassdefaultResponse): response is DeviceManagementUpdateDeviceClassdefaultResponse; +export function isUnexpected(response: DeviceManagementUpdateDeviceClass200Response | DeviceManagementUpdateDeviceClassDefaultResponse): response is DeviceManagementUpdateDeviceClassDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementDeleteDeviceClass204Response | DeviceManagementDeleteDeviceClassdefaultResponse): response is DeviceManagementDeleteDeviceClassdefaultResponse; +export function isUnexpected(response: DeviceManagementDeleteDeviceClass204Response | DeviceManagementDeleteDeviceClassDefaultResponse): response is DeviceManagementDeleteDeviceClassDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementListInstallableUpdatesForDeviceClass200Response | DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse): response is DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse; +export function isUnexpected(response: DeviceManagementListInstallableUpdatesForDeviceClass200Response | DeviceManagementListInstallableUpdatesForDeviceClassDefaultResponse): response is DeviceManagementListInstallableUpdatesForDeviceClassDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementListDevices200Response | DeviceManagementListDevicesdefaultResponse): response is DeviceManagementListDevicesdefaultResponse; +export function isUnexpected(response: DeviceManagementListDevices200Response | DeviceManagementListDevicesDefaultResponse): response is DeviceManagementListDevicesDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementImportDevices202Response | DeviceManagementImportDevicesdefaultResponse): response is DeviceManagementImportDevicesdefaultResponse; +export function isUnexpected(response: DeviceManagementImportDevices202Response | DeviceManagementImportDevicesDefaultResponse): response is DeviceManagementImportDevicesDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetDevice200Response | DeviceManagementGetDevicedefaultResponse): response is DeviceManagementGetDevicedefaultResponse; +export function isUnexpected(response: DeviceManagementGetDevice200Response | DeviceManagementGetDeviceDefaultResponse): response is DeviceManagementGetDeviceDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetDeviceModule200Response | DeviceManagementGetDeviceModuledefaultResponse): response is DeviceManagementGetDeviceModuledefaultResponse; +export function isUnexpected(response: DeviceManagementGetDeviceModule200Response | DeviceManagementGetDeviceModuleDefaultResponse): response is DeviceManagementGetDeviceModuleDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetUpdateCompliance200Response | DeviceManagementGetUpdateCompliancedefaultResponse): response is DeviceManagementGetUpdateCompliancedefaultResponse; +export function isUnexpected(response: DeviceManagementGetUpdateCompliance200Response | DeviceManagementGetUpdateComplianceDefaultResponse): response is DeviceManagementGetUpdateComplianceDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementListGroups200Response | DeviceManagementListGroupsdefaultResponse): response is DeviceManagementListGroupsdefaultResponse; +export function isUnexpected(response: DeviceManagementListGroups200Response | DeviceManagementListGroupsDefaultResponse): response is DeviceManagementListGroupsDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetGroup200Response | DeviceManagementGetGroupdefaultResponse): response is DeviceManagementGetGroupdefaultResponse; +export function isUnexpected(response: DeviceManagementGetGroup200Response | DeviceManagementGetGroupDefaultResponse): response is DeviceManagementGetGroupDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementDeleteGroup204Response | DeviceManagementDeleteGroupdefaultResponse): response is DeviceManagementDeleteGroupdefaultResponse; +export function isUnexpected(response: DeviceManagementDeleteGroup204Response | DeviceManagementDeleteGroupDefaultResponse): response is DeviceManagementDeleteGroupDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetUpdateComplianceForGroup200Response | DeviceManagementGetUpdateComplianceForGroupdefaultResponse): response is DeviceManagementGetUpdateComplianceForGroupdefaultResponse; +export function isUnexpected(response: DeviceManagementGetUpdateComplianceForGroup200Response | DeviceManagementGetUpdateComplianceForGroupDefaultResponse): response is DeviceManagementGetUpdateComplianceForGroupDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementListBestUpdatesForGroup200Response | DeviceManagementListBestUpdatesForGroupdefaultResponse): response is DeviceManagementListBestUpdatesForGroupdefaultResponse; +export function isUnexpected(response: DeviceManagementListBestUpdatesForGroup200Response | DeviceManagementListBestUpdatesForGroupDefaultResponse): response is DeviceManagementListBestUpdatesForGroupDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementListDeploymentsForGroup200Response | DeviceManagementListDeploymentsForGroupdefaultResponse): response is DeviceManagementListDeploymentsForGroupdefaultResponse; +export function isUnexpected(response: DeviceManagementListDeploymentsForGroup200Response | DeviceManagementListDeploymentsForGroupDefaultResponse): response is DeviceManagementListDeploymentsForGroupDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetDeployment200Response | DeviceManagementGetDeploymentdefaultResponse): response is DeviceManagementGetDeploymentdefaultResponse; +export function isUnexpected(response: DeviceManagementGetDeployment200Response | DeviceManagementGetDeploymentDefaultResponse): response is DeviceManagementGetDeploymentDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementCreateOrUpdateDeployment200Response | DeviceManagementCreateOrUpdateDeploymentdefaultResponse): response is DeviceManagementCreateOrUpdateDeploymentdefaultResponse; +export function isUnexpected(response: DeviceManagementCreateOrUpdateDeployment200Response | DeviceManagementCreateOrUpdateDeploymentDefaultResponse): response is DeviceManagementCreateOrUpdateDeploymentDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementDeleteDeployment204Response | DeviceManagementDeleteDeploymentdefaultResponse): response is DeviceManagementDeleteDeploymentdefaultResponse; +export function isUnexpected(response: DeviceManagementDeleteDeployment204Response | DeviceManagementDeleteDeploymentDefaultResponse): response is DeviceManagementDeleteDeploymentDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetDeploymentStatus200Response | DeviceManagementGetDeploymentStatusdefaultResponse): response is DeviceManagementGetDeploymentStatusdefaultResponse; +export function isUnexpected(response: DeviceManagementGetDeploymentStatus200Response | DeviceManagementGetDeploymentStatusDefaultResponse): response is DeviceManagementGetDeploymentStatusDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementListDeviceClassSubgroupsForGroup200Response | DeviceManagementListDeviceClassSubgroupsForGroupdefaultResponse): response is DeviceManagementListDeviceClassSubgroupsForGroupdefaultResponse; +export function isUnexpected(response: DeviceManagementListDeviceClassSubgroupsForGroup200Response | DeviceManagementListDeviceClassSubgroupsForGroupDefaultResponse): response is DeviceManagementListDeviceClassSubgroupsForGroupDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetDeviceClassSubgroup200Response | DeviceManagementGetDeviceClassSubgroupdefaultResponse): response is DeviceManagementGetDeviceClassSubgroupdefaultResponse; +export function isUnexpected(response: DeviceManagementGetDeviceClassSubgroup200Response | DeviceManagementGetDeviceClassSubgroupDefaultResponse): response is DeviceManagementGetDeviceClassSubgroupDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementDeleteDeviceClassSubgroup204Response | DeviceManagementDeleteDeviceClassSubgroupdefaultResponse): response is DeviceManagementDeleteDeviceClassSubgroupdefaultResponse; +export function isUnexpected(response: DeviceManagementDeleteDeviceClassSubgroup204Response | DeviceManagementDeleteDeviceClassSubgroupDefaultResponse): response is DeviceManagementDeleteDeviceClassSubgroupDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetDeviceClassSubgroupUpdateCompliance200Response | DeviceManagementGetDeviceClassSubgroupUpdateCompliancedefaultResponse): response is DeviceManagementGetDeviceClassSubgroupUpdateCompliancedefaultResponse; +export function isUnexpected(response: DeviceManagementGetDeviceClassSubgroupUpdateCompliance200Response | DeviceManagementGetDeviceClassSubgroupUpdateComplianceDefaultResponse): response is DeviceManagementGetDeviceClassSubgroupUpdateComplianceDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetBestUpdatesForDeviceClassSubgroup200Response | DeviceManagementGetBestUpdatesForDeviceClassSubgroupdefaultResponse): response is DeviceManagementGetBestUpdatesForDeviceClassSubgroupdefaultResponse; +export function isUnexpected(response: DeviceManagementGetBestUpdatesForDeviceClassSubgroup200Response | DeviceManagementGetBestUpdatesForDeviceClassSubgroupDefaultResponse): response is DeviceManagementGetBestUpdatesForDeviceClassSubgroupDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementListDeploymentsForDeviceClassSubgroup200Response | DeviceManagementListDeploymentsForDeviceClassSubgroupdefaultResponse): response is DeviceManagementListDeploymentsForDeviceClassSubgroupdefaultResponse; +export function isUnexpected(response: DeviceManagementListDeploymentsForDeviceClassSubgroup200Response | DeviceManagementListDeploymentsForDeviceClassSubgroupDefaultResponse): response is DeviceManagementListDeploymentsForDeviceClassSubgroupDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetDeploymentForDeviceClassSubgroup200Response | DeviceManagementGetDeploymentForDeviceClassSubgroupdefaultResponse): response is DeviceManagementGetDeploymentForDeviceClassSubgroupdefaultResponse; +export function isUnexpected(response: DeviceManagementGetDeploymentForDeviceClassSubgroup200Response | DeviceManagementGetDeploymentForDeviceClassSubgroupDefaultResponse): response is DeviceManagementGetDeploymentForDeviceClassSubgroupDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementDeleteDeploymentForDeviceClassSubgroup204Response | DeviceManagementDeleteDeploymentForDeviceClassSubgroupdefaultResponse): response is DeviceManagementDeleteDeploymentForDeviceClassSubgroupdefaultResponse; +export function isUnexpected(response: DeviceManagementDeleteDeploymentForDeviceClassSubgroup204Response | DeviceManagementDeleteDeploymentForDeviceClassSubgroupDefaultResponse): response is DeviceManagementDeleteDeploymentForDeviceClassSubgroupDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementStopDeployment200Response | DeviceManagementStopDeploymentdefaultResponse): response is DeviceManagementStopDeploymentdefaultResponse; +export function isUnexpected(response: DeviceManagementStopDeployment200Response | DeviceManagementStopDeploymentDefaultResponse): response is DeviceManagementStopDeploymentDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementRetryDeployment200Response | DeviceManagementRetryDeploymentdefaultResponse): response is DeviceManagementRetryDeploymentdefaultResponse; +export function isUnexpected(response: DeviceManagementRetryDeployment200Response | DeviceManagementRetryDeploymentDefaultResponse): response is DeviceManagementRetryDeploymentDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetDeviceClassSubgroupDeploymentStatus200Response | DeviceManagementGetDeviceClassSubgroupDeploymentStatusdefaultResponse): response is DeviceManagementGetDeviceClassSubgroupDeploymentStatusdefaultResponse; +export function isUnexpected(response: DeviceManagementGetDeviceClassSubgroupDeploymentStatus200Response | DeviceManagementGetDeviceClassSubgroupDeploymentStatusDefaultResponse): response is DeviceManagementGetDeviceClassSubgroupDeploymentStatusDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementListDeviceStatesForDeviceClassSubgroupDeployment200Response | DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentdefaultResponse): response is DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentdefaultResponse; +export function isUnexpected(response: DeviceManagementListDeviceStatesForDeviceClassSubgroupDeployment200Response | DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentDefaultResponse): response is DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetOperationStatus200Response | DeviceManagementGetOperationStatus304Response | DeviceManagementGetOperationStatusdefaultResponse): response is DeviceManagementGetOperationStatusdefaultResponse; +export function isUnexpected(response: DeviceManagementGetOperationStatus200Response | DeviceManagementGetOperationStatus304Response | DeviceManagementGetOperationStatusDefaultResponse): response is DeviceManagementGetOperationStatusDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementListOperationStatuses200Response | DeviceManagementListOperationStatusesdefaultResponse): response is DeviceManagementListOperationStatusesdefaultResponse; +export function isUnexpected(response: DeviceManagementListOperationStatuses200Response | DeviceManagementListOperationStatusesDefaultResponse): response is DeviceManagementListOperationStatusesDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementStartLogCollection201Response | DeviceManagementStartLogCollectiondefaultResponse): response is DeviceManagementStartLogCollectiondefaultResponse; +export function isUnexpected(response: DeviceManagementStartLogCollection201Response | DeviceManagementStartLogCollectionDefaultResponse): response is DeviceManagementStartLogCollectionDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetLogCollection200Response | DeviceManagementGetLogCollectiondefaultResponse): response is DeviceManagementGetLogCollectiondefaultResponse; +export function isUnexpected(response: DeviceManagementGetLogCollection200Response | DeviceManagementGetLogCollectionDefaultResponse): response is DeviceManagementGetLogCollectionDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementListLogCollections200Response | DeviceManagementListLogCollectionsdefaultResponse): response is DeviceManagementListLogCollectionsdefaultResponse; +export function isUnexpected(response: DeviceManagementListLogCollections200Response | DeviceManagementListLogCollectionsDefaultResponse): response is DeviceManagementListLogCollectionsDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementGetLogCollectionDetailedStatus200Response | DeviceManagementGetLogCollectionDetailedStatusdefaultResponse): response is DeviceManagementGetLogCollectionDetailedStatusdefaultResponse; +export function isUnexpected(response: DeviceManagementGetLogCollectionDetailedStatus200Response | DeviceManagementGetLogCollectionDetailedStatusDefaultResponse): response is DeviceManagementGetLogCollectionDetailedStatusDefaultResponse; // @public (undocumented) -export function isUnexpected(response: DeviceManagementListHealthOfDevices200Response | DeviceManagementListHealthOfDevicesdefaultResponse): response is DeviceManagementListHealthOfDevicesdefaultResponse; +export function isUnexpected(response: DeviceManagementListHealthOfDevices200Response | DeviceManagementListHealthOfDevicesDefaultResponse): response is DeviceManagementListHealthOfDevicesDefaultResponse; -// @public (undocumented) +// @public export interface LogCollection { - createdDateTime?: string; description?: string; deviceList: Array; - lastActionDateTime?: string; operationId?: string; - status?: "NotStarted" | "Running" | "Succeeded" | "Failed"; } -// @public (undocumented) +// @public export interface LogCollectionListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface LogCollectionOperationDetailedStatusOutput { createdDateTime?: string; description?: string; @@ -1974,7 +1953,7 @@ export interface LogCollectionOperationDetailedStatusOutput { status?: "NotStarted" | "Running" | "Succeeded" | "Failed"; } -// @public (undocumented) +// @public export interface LogCollectionOperationDeviceStatusOutput { deviceId: string; extendedResultCode?: string; @@ -1984,14 +1963,14 @@ export interface LogCollectionOperationDeviceStatusOutput { status: "NotStarted" | "Running" | "Succeeded" | "Failed"; } -// @public (undocumented) +// @public export interface LogCollectionOutput { - createdDateTime?: string; + readonly createdDateTime?: string; description?: string; deviceList: Array; - lastActionDateTime?: string; + readonly lastActionDateTime?: string; operationId?: string; - status?: "NotStarted" | "Running" | "Succeeded" | "Failed"; + readonly status?: "NotStarted" | "Running" | "Succeeded" | "Failed"; } // @public @@ -2009,11 +1988,14 @@ export interface PagingOptions { customGetPage?: GetPage[]>; } -// @public (undocumented) +// @public export interface PatchBody { friendlyName: string; } +// @public +export type PatchBodyResourceMergeAndPatch = Partial; + // @public (undocumented) export interface Routes { (path: "/deviceUpdate/{instanceId}/updates", instanceId: string): DeviceUpdateListUpdates; @@ -2059,7 +2041,29 @@ export interface Routes { (path: "/deviceUpdate/{instanceId}/management/deviceDiagnostics/deviceHealth", instanceId: string): DeviceManagementListHealthOfDevices; } -// @public (undocumented) +// @public +export interface SimplePollerLike, TResult> { + getOperationState(): TState; + getResult(): TResult | undefined; + isDone(): boolean; + // @deprecated + isStopped(): boolean; + onProgress(callback: (state: TState) => void): CancelOnProgress; + poll(options?: { + abortSignal?: AbortSignalLike; + }): Promise; + pollUntilDone(pollOptions?: { + abortSignal?: AbortSignalLike; + }): Promise; + serialize(): Promise; + // @deprecated + stopPolling(): void; + submitted(): Promise; + // @deprecated + toString(): string; +} + +// @public export interface StepOutput { description?: string; files?: Array; @@ -2069,7 +2073,7 @@ export interface StepOutput { updateId?: UpdateIdOutput; } -// @public (undocumented) +// @public export interface StepResultOutput { description?: string; extendedResultCode: number; @@ -2078,13 +2082,13 @@ export interface StepResultOutput { update?: UpdateInfoOutput; } -// @public (undocumented) +// @public export interface StringsListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface UpdateComplianceOutput { newUpdatesAvailableDeviceCount: number; onLatestUpdateDeviceCount: number; @@ -2092,7 +2096,7 @@ export interface UpdateComplianceOutput { updatesInProgressDeviceCount: number; } -// @public (undocumented) +// @public export interface UpdateFileBaseOutput { fileName: string; hashes: Record; @@ -2103,12 +2107,12 @@ export interface UpdateFileBaseOutput { sizeInBytes: number; } -// @public (undocumented) +// @public export interface UpdateFileDownloadHandlerOutput { id: string; } -// @public (undocumented) +// @public export interface UpdateFileOutput extends UpdateFileBaseOutput { downloadHandler?: UpdateFileDownloadHandlerOutput; etag?: string; @@ -2116,47 +2120,45 @@ export interface UpdateFileOutput extends UpdateFileBaseOutput { relatedFiles?: Array; } -// @public (undocumented) +// @public export interface UpdateId { name: string; provider: string; version: string; } -// @public (undocumented) +// @public export interface UpdateIdOutput { name: string; provider: string; version: string; } -// @public (undocumented) +// @public export interface UpdateInfo { - description?: string; - friendlyName?: string; updateId: UpdateId; } -// @public (undocumented) +// @public export interface UpdateInfoListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface UpdateInfoOutput { - description?: string; - friendlyName?: string; + readonly description?: string; + readonly friendlyName?: string; updateId: UpdateIdOutput; } -// @public (undocumented) +// @public export interface UpdateListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface UpdateOperationOutput { createdDateTime: string; error?: ErrorModelOutput; @@ -2169,13 +2171,13 @@ export interface UpdateOperationOutput { update?: UpdateInfoOutput; } -// @public (undocumented) +// @public export interface UpdateOperationsListOutput { nextLink?: string; value: Array; } -// @public (undocumented) +// @public export interface UpdateOutput { compatibility: Array>; createdDateTime: string; diff --git a/sdk/deviceupdate/iot-device-update-rest/samples-dev/deleteUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/samples-dev/deleteUpdate.ts index 23fdca992526..83c3f7692b59 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples-dev/deleteUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/samples-dev/deleteUpdate.ts @@ -39,7 +39,7 @@ async function main() { .delete(); const poller = getLongRunningPoller(client, initialResponse); - const result = await poller.pollUntilDone(); + const result = await (await poller).pollUntilDone(); if (isUnexpected(result)) { throw result.body.error; diff --git a/sdk/deviceupdate/iot-device-update-rest/samples-dev/deployUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/samples-dev/deployUpdate.ts index 667d947e286d..bb2d429b4315 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples-dev/deployUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/samples-dev/deployUpdate.ts @@ -55,7 +55,7 @@ async function main(): Promise { }); const poller = getLongRunningPoller(client, initialResponse); - const result = await poller.pollUntilDone(); + const result = await (await poller).pollUntilDone(); if (isUnexpected(result)) { throw result.body.error; diff --git a/sdk/deviceupdate/iot-device-update-rest/samples-dev/importUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/samples-dev/importUpdate.ts index 6ffe6d254653..480a0605565a 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples-dev/importUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/samples-dev/importUpdate.ts @@ -58,7 +58,7 @@ async function main() { }); const poller = getLongRunningPoller(client, initialResponse); - const result = await poller.pollUntilDone(); + const result = await (await poller).pollUntilDone(); if (isUnexpected(result)) { throw result.body.error; diff --git a/sdk/deviceupdate/iot-device-update-rest/src/clientDefinitions.ts b/sdk/deviceupdate/iot-device-update-rest/src/clientDefinitions.ts index 423d43931ad9..9f907aaafaea 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/clientDefinitions.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/clientDefinitions.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. +// Licensed under the MIT license. import { DeviceUpdateListUpdatesParameters, @@ -55,110 +55,110 @@ import { } from "./parameters"; import { DeviceUpdateListUpdates200Response, - DeviceUpdateListUpdatesdefaultResponse, + DeviceUpdateListUpdatesDefaultResponse, DeviceUpdateImportUpdate200Response, DeviceUpdateImportUpdate202Response, - DeviceUpdateImportUpdatedefaultResponse, + DeviceUpdateImportUpdateDefaultResponse, DeviceUpdateGetUpdate200Response, DeviceUpdateGetUpdate304Response, - DeviceUpdateGetUpdatedefaultResponse, + DeviceUpdateGetUpdateDefaultResponse, DeviceUpdateDeleteUpdate202Response, - DeviceUpdateDeleteUpdatedefaultResponse, + DeviceUpdateDeleteUpdateDefaultResponse, DeviceUpdateListProviders200Response, - DeviceUpdateListProvidersdefaultResponse, + DeviceUpdateListProvidersDefaultResponse, DeviceUpdateListNames200Response, - DeviceUpdateListNamesdefaultResponse, + DeviceUpdateListNamesDefaultResponse, DeviceUpdateListVersions200Response, - DeviceUpdateListVersionsdefaultResponse, + DeviceUpdateListVersionsDefaultResponse, DeviceUpdateListFiles200Response, - DeviceUpdateListFilesdefaultResponse, + DeviceUpdateListFilesDefaultResponse, DeviceUpdateGetFile200Response, DeviceUpdateGetFile304Response, - DeviceUpdateGetFiledefaultResponse, + DeviceUpdateGetFileDefaultResponse, DeviceUpdateListOperationStatuses200Response, - DeviceUpdateListOperationStatusesdefaultResponse, + DeviceUpdateListOperationStatusesDefaultResponse, DeviceUpdateGetOperationStatus200Response, DeviceUpdateGetOperationStatus304Response, - DeviceUpdateGetOperationStatusdefaultResponse, + DeviceUpdateGetOperationStatusDefaultResponse, DeviceManagementListDeviceClasses200Response, - DeviceManagementListDeviceClassesdefaultResponse, + DeviceManagementListDeviceClassesDefaultResponse, DeviceManagementGetDeviceClass200Response, - DeviceManagementGetDeviceClassdefaultResponse, + DeviceManagementGetDeviceClassDefaultResponse, DeviceManagementUpdateDeviceClass200Response, - DeviceManagementUpdateDeviceClassdefaultResponse, + DeviceManagementUpdateDeviceClassDefaultResponse, DeviceManagementDeleteDeviceClass204Response, - DeviceManagementDeleteDeviceClassdefaultResponse, + DeviceManagementDeleteDeviceClassDefaultResponse, DeviceManagementListInstallableUpdatesForDeviceClass200Response, - DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse, + DeviceManagementListInstallableUpdatesForDeviceClassDefaultResponse, DeviceManagementListDevices200Response, - DeviceManagementListDevicesdefaultResponse, + DeviceManagementListDevicesDefaultResponse, DeviceManagementImportDevices202Response, - DeviceManagementImportDevicesdefaultResponse, + DeviceManagementImportDevicesDefaultResponse, DeviceManagementGetDevice200Response, - DeviceManagementGetDevicedefaultResponse, + DeviceManagementGetDeviceDefaultResponse, DeviceManagementGetDeviceModule200Response, - DeviceManagementGetDeviceModuledefaultResponse, + DeviceManagementGetDeviceModuleDefaultResponse, DeviceManagementGetUpdateCompliance200Response, - DeviceManagementGetUpdateCompliancedefaultResponse, + DeviceManagementGetUpdateComplianceDefaultResponse, DeviceManagementListGroups200Response, - DeviceManagementListGroupsdefaultResponse, + DeviceManagementListGroupsDefaultResponse, DeviceManagementGetGroup200Response, - DeviceManagementGetGroupdefaultResponse, + DeviceManagementGetGroupDefaultResponse, DeviceManagementDeleteGroup204Response, - DeviceManagementDeleteGroupdefaultResponse, + DeviceManagementDeleteGroupDefaultResponse, DeviceManagementGetUpdateComplianceForGroup200Response, - DeviceManagementGetUpdateComplianceForGroupdefaultResponse, + DeviceManagementGetUpdateComplianceForGroupDefaultResponse, DeviceManagementListBestUpdatesForGroup200Response, - DeviceManagementListBestUpdatesForGroupdefaultResponse, + DeviceManagementListBestUpdatesForGroupDefaultResponse, DeviceManagementListDeploymentsForGroup200Response, - DeviceManagementListDeploymentsForGroupdefaultResponse, + DeviceManagementListDeploymentsForGroupDefaultResponse, DeviceManagementGetDeployment200Response, - DeviceManagementGetDeploymentdefaultResponse, + DeviceManagementGetDeploymentDefaultResponse, DeviceManagementCreateOrUpdateDeployment200Response, - DeviceManagementCreateOrUpdateDeploymentdefaultResponse, + DeviceManagementCreateOrUpdateDeploymentDefaultResponse, DeviceManagementDeleteDeployment204Response, - DeviceManagementDeleteDeploymentdefaultResponse, + DeviceManagementDeleteDeploymentDefaultResponse, DeviceManagementGetDeploymentStatus200Response, - DeviceManagementGetDeploymentStatusdefaultResponse, + DeviceManagementGetDeploymentStatusDefaultResponse, DeviceManagementListDeviceClassSubgroupsForGroup200Response, - DeviceManagementListDeviceClassSubgroupsForGroupdefaultResponse, + DeviceManagementListDeviceClassSubgroupsForGroupDefaultResponse, DeviceManagementGetDeviceClassSubgroup200Response, - DeviceManagementGetDeviceClassSubgroupdefaultResponse, + DeviceManagementGetDeviceClassSubgroupDefaultResponse, DeviceManagementDeleteDeviceClassSubgroup204Response, - DeviceManagementDeleteDeviceClassSubgroupdefaultResponse, + DeviceManagementDeleteDeviceClassSubgroupDefaultResponse, DeviceManagementGetDeviceClassSubgroupUpdateCompliance200Response, - DeviceManagementGetDeviceClassSubgroupUpdateCompliancedefaultResponse, + DeviceManagementGetDeviceClassSubgroupUpdateComplianceDefaultResponse, DeviceManagementGetBestUpdatesForDeviceClassSubgroup200Response, - DeviceManagementGetBestUpdatesForDeviceClassSubgroupdefaultResponse, + DeviceManagementGetBestUpdatesForDeviceClassSubgroupDefaultResponse, DeviceManagementListDeploymentsForDeviceClassSubgroup200Response, - DeviceManagementListDeploymentsForDeviceClassSubgroupdefaultResponse, + DeviceManagementListDeploymentsForDeviceClassSubgroupDefaultResponse, DeviceManagementGetDeploymentForDeviceClassSubgroup200Response, - DeviceManagementGetDeploymentForDeviceClassSubgroupdefaultResponse, + DeviceManagementGetDeploymentForDeviceClassSubgroupDefaultResponse, DeviceManagementDeleteDeploymentForDeviceClassSubgroup204Response, - DeviceManagementDeleteDeploymentForDeviceClassSubgroupdefaultResponse, + DeviceManagementDeleteDeploymentForDeviceClassSubgroupDefaultResponse, DeviceManagementStopDeployment200Response, - DeviceManagementStopDeploymentdefaultResponse, + DeviceManagementStopDeploymentDefaultResponse, DeviceManagementRetryDeployment200Response, - DeviceManagementRetryDeploymentdefaultResponse, + DeviceManagementRetryDeploymentDefaultResponse, DeviceManagementGetDeviceClassSubgroupDeploymentStatus200Response, - DeviceManagementGetDeviceClassSubgroupDeploymentStatusdefaultResponse, + DeviceManagementGetDeviceClassSubgroupDeploymentStatusDefaultResponse, DeviceManagementListDeviceStatesForDeviceClassSubgroupDeployment200Response, - DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentdefaultResponse, + DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentDefaultResponse, DeviceManagementGetOperationStatus200Response, DeviceManagementGetOperationStatus304Response, - DeviceManagementGetOperationStatusdefaultResponse, + DeviceManagementGetOperationStatusDefaultResponse, DeviceManagementListOperationStatuses200Response, - DeviceManagementListOperationStatusesdefaultResponse, + DeviceManagementListOperationStatusesDefaultResponse, DeviceManagementStartLogCollection201Response, - DeviceManagementStartLogCollectiondefaultResponse, + DeviceManagementStartLogCollectionDefaultResponse, DeviceManagementGetLogCollection200Response, - DeviceManagementGetLogCollectiondefaultResponse, + DeviceManagementGetLogCollectionDefaultResponse, DeviceManagementListLogCollections200Response, - DeviceManagementListLogCollectionsdefaultResponse, + DeviceManagementListLogCollectionsDefaultResponse, DeviceManagementGetLogCollectionDetailedStatus200Response, - DeviceManagementGetLogCollectionDetailedStatusdefaultResponse, + DeviceManagementGetLogCollectionDetailedStatusDefaultResponse, DeviceManagementListHealthOfDevices200Response, - DeviceManagementListHealthOfDevicesdefaultResponse, + DeviceManagementListHealthOfDevicesDefaultResponse, } from "./responses"; import { Client, StreamableMethod } from "@azure-rest/core-client"; @@ -166,7 +166,7 @@ export interface DeviceUpdateListUpdates { /** Get a list of all updates that have been imported to Device Update for IoT Hub. */ get( options?: DeviceUpdateListUpdatesParameters, - ): StreamableMethod; + ): StreamableMethod; } export interface DeviceUpdateImportUpdate { @@ -176,7 +176,7 @@ export interface DeviceUpdateImportUpdate { ): StreamableMethod< | DeviceUpdateImportUpdate200Response | DeviceUpdateImportUpdate202Response - | DeviceUpdateImportUpdatedefaultResponse + | DeviceUpdateImportUpdateDefaultResponse >; } @@ -187,13 +187,13 @@ export interface DeviceUpdateGetUpdate { ): StreamableMethod< | DeviceUpdateGetUpdate200Response | DeviceUpdateGetUpdate304Response - | DeviceUpdateGetUpdatedefaultResponse + | DeviceUpdateGetUpdateDefaultResponse >; /** Delete a specific update version. This is a long-running-operation; use Operation-Location response header value to check for operation status. */ delete( options?: DeviceUpdateDeleteUpdateParameters, ): StreamableMethod< - DeviceUpdateDeleteUpdate202Response | DeviceUpdateDeleteUpdatedefaultResponse + DeviceUpdateDeleteUpdate202Response | DeviceUpdateDeleteUpdateDefaultResponse >; } @@ -202,7 +202,7 @@ export interface DeviceUpdateListProviders { get( options?: DeviceUpdateListProvidersParameters, ): StreamableMethod< - DeviceUpdateListProviders200Response | DeviceUpdateListProvidersdefaultResponse + DeviceUpdateListProviders200Response | DeviceUpdateListProvidersDefaultResponse >; } @@ -210,7 +210,7 @@ export interface DeviceUpdateListNames { /** Get a list of all update names that match the specified provider. */ get( options?: DeviceUpdateListNamesParameters, - ): StreamableMethod; + ): StreamableMethod; } export interface DeviceUpdateListVersions { @@ -218,7 +218,7 @@ export interface DeviceUpdateListVersions { get( options?: DeviceUpdateListVersionsParameters, ): StreamableMethod< - DeviceUpdateListVersions200Response | DeviceUpdateListVersionsdefaultResponse + DeviceUpdateListVersions200Response | DeviceUpdateListVersionsDefaultResponse >; } @@ -226,7 +226,7 @@ export interface DeviceUpdateListFiles { /** Get a list of all update file identifiers for the specified version. */ get( options?: DeviceUpdateListFilesParameters, - ): StreamableMethod; + ): StreamableMethod; } export interface DeviceUpdateGetFile { @@ -236,7 +236,7 @@ export interface DeviceUpdateGetFile { ): StreamableMethod< | DeviceUpdateGetFile200Response | DeviceUpdateGetFile304Response - | DeviceUpdateGetFiledefaultResponse + | DeviceUpdateGetFileDefaultResponse >; } @@ -245,7 +245,7 @@ export interface DeviceUpdateListOperationStatuses { get( options?: DeviceUpdateListOperationStatusesParameters, ): StreamableMethod< - DeviceUpdateListOperationStatuses200Response | DeviceUpdateListOperationStatusesdefaultResponse + DeviceUpdateListOperationStatuses200Response | DeviceUpdateListOperationStatusesDefaultResponse >; } @@ -256,7 +256,7 @@ export interface DeviceUpdateGetOperationStatus { ): StreamableMethod< | DeviceUpdateGetOperationStatus200Response | DeviceUpdateGetOperationStatus304Response - | DeviceUpdateGetOperationStatusdefaultResponse + | DeviceUpdateGetOperationStatusDefaultResponse >; } @@ -265,7 +265,7 @@ export interface DeviceManagementListDeviceClasses { get( options?: DeviceManagementListDeviceClassesParameters, ): StreamableMethod< - DeviceManagementListDeviceClasses200Response | DeviceManagementListDeviceClassesdefaultResponse + DeviceManagementListDeviceClasses200Response | DeviceManagementListDeviceClassesDefaultResponse >; } @@ -274,19 +274,19 @@ export interface DeviceManagementGetDeviceClass { get( options?: DeviceManagementGetDeviceClassParameters, ): StreamableMethod< - DeviceManagementGetDeviceClass200Response | DeviceManagementGetDeviceClassdefaultResponse + DeviceManagementGetDeviceClass200Response | DeviceManagementGetDeviceClassDefaultResponse >; /** Update device class details. */ patch( options: DeviceManagementUpdateDeviceClassParameters, ): StreamableMethod< - DeviceManagementUpdateDeviceClass200Response | DeviceManagementUpdateDeviceClassdefaultResponse + DeviceManagementUpdateDeviceClass200Response | DeviceManagementUpdateDeviceClassDefaultResponse >; /** Deletes a device class. Device classes are created automatically when Device Update-enabled devices are connected to the hub but are not automatically cleaned up since they are referenced by DeviceClassSubgroups. If the user has deleted all DeviceClassSubgroups for a device class they can also delete the device class to remove the records from the system and to stop checking the compatibility of this device class with new updates. If a device is ever reconnected for this device class it will be re-created. */ delete( options?: DeviceManagementDeleteDeviceClassParameters, ): StreamableMethod< - DeviceManagementDeleteDeviceClass204Response | DeviceManagementDeleteDeviceClassdefaultResponse + DeviceManagementDeleteDeviceClass204Response | DeviceManagementDeleteDeviceClassDefaultResponse >; } @@ -296,7 +296,7 @@ export interface DeviceManagementListInstallableUpdatesForDeviceClass { options?: DeviceManagementListInstallableUpdatesForDeviceClassParameters, ): StreamableMethod< | DeviceManagementListInstallableUpdatesForDeviceClass200Response - | DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse + | DeviceManagementListInstallableUpdatesForDeviceClassDefaultResponse >; } @@ -305,7 +305,7 @@ export interface DeviceManagementListDevices { get( options?: DeviceManagementListDevicesParameters, ): StreamableMethod< - DeviceManagementListDevices200Response | DeviceManagementListDevicesdefaultResponse + DeviceManagementListDevices200Response | DeviceManagementListDevicesDefaultResponse >; } @@ -314,7 +314,7 @@ export interface DeviceManagementImportDevices { post( options: DeviceManagementImportDevicesParameters, ): StreamableMethod< - DeviceManagementImportDevices202Response | DeviceManagementImportDevicesdefaultResponse + DeviceManagementImportDevices202Response | DeviceManagementImportDevicesDefaultResponse >; } @@ -323,7 +323,7 @@ export interface DeviceManagementGetDevice { get( options?: DeviceManagementGetDeviceParameters, ): StreamableMethod< - DeviceManagementGetDevice200Response | DeviceManagementGetDevicedefaultResponse + DeviceManagementGetDevice200Response | DeviceManagementGetDeviceDefaultResponse >; } @@ -332,7 +332,7 @@ export interface DeviceManagementGetDeviceModule { get( options?: DeviceManagementGetDeviceModuleParameters, ): StreamableMethod< - DeviceManagementGetDeviceModule200Response | DeviceManagementGetDeviceModuledefaultResponse + DeviceManagementGetDeviceModule200Response | DeviceManagementGetDeviceModuleDefaultResponse >; } @@ -342,7 +342,7 @@ export interface DeviceManagementGetUpdateCompliance { options?: DeviceManagementGetUpdateComplianceParameters, ): StreamableMethod< | DeviceManagementGetUpdateCompliance200Response - | DeviceManagementGetUpdateCompliancedefaultResponse + | DeviceManagementGetUpdateComplianceDefaultResponse >; } @@ -351,7 +351,7 @@ export interface DeviceManagementListGroups { get( options?: DeviceManagementListGroupsParameters, ): StreamableMethod< - DeviceManagementListGroups200Response | DeviceManagementListGroupsdefaultResponse + DeviceManagementListGroups200Response | DeviceManagementListGroupsDefaultResponse >; } @@ -360,13 +360,13 @@ export interface DeviceManagementGetGroup { get( options?: DeviceManagementGetGroupParameters, ): StreamableMethod< - DeviceManagementGetGroup200Response | DeviceManagementGetGroupdefaultResponse + DeviceManagementGetGroup200Response | DeviceManagementGetGroupDefaultResponse >; /** Deletes a device group. This group is automatically created when a Device Update-enabled device is connected to the hub and reports its properties. Groups, subgroups, and deployments are not automatically cleaned up but are retained for history purposes. Users can call this method to delete a group if they do not need to retain any of the history of the group and no longer need it. If a device is ever connected again for this group after the group was deleted it will be automatically re-created but there will be no history. */ delete( options?: DeviceManagementDeleteGroupParameters, ): StreamableMethod< - DeviceManagementDeleteGroup204Response | DeviceManagementDeleteGroupdefaultResponse + DeviceManagementDeleteGroup204Response | DeviceManagementDeleteGroupDefaultResponse >; } @@ -376,7 +376,7 @@ export interface DeviceManagementGetUpdateComplianceForGroup { options?: DeviceManagementGetUpdateComplianceForGroupParameters, ): StreamableMethod< | DeviceManagementGetUpdateComplianceForGroup200Response - | DeviceManagementGetUpdateComplianceForGroupdefaultResponse + | DeviceManagementGetUpdateComplianceForGroupDefaultResponse >; } @@ -386,7 +386,7 @@ export interface DeviceManagementListBestUpdatesForGroup { options?: DeviceManagementListBestUpdatesForGroupParameters, ): StreamableMethod< | DeviceManagementListBestUpdatesForGroup200Response - | DeviceManagementListBestUpdatesForGroupdefaultResponse + | DeviceManagementListBestUpdatesForGroupDefaultResponse >; } @@ -396,7 +396,7 @@ export interface DeviceManagementListDeploymentsForGroup { options?: DeviceManagementListDeploymentsForGroupParameters, ): StreamableMethod< | DeviceManagementListDeploymentsForGroup200Response - | DeviceManagementListDeploymentsForGroupdefaultResponse + | DeviceManagementListDeploymentsForGroupDefaultResponse >; } @@ -405,20 +405,20 @@ export interface DeviceManagementGetDeployment { get( options?: DeviceManagementGetDeploymentParameters, ): StreamableMethod< - DeviceManagementGetDeployment200Response | DeviceManagementGetDeploymentdefaultResponse + DeviceManagementGetDeployment200Response | DeviceManagementGetDeploymentDefaultResponse >; /** Creates or updates a deployment. */ put( options: DeviceManagementCreateOrUpdateDeploymentParameters, ): StreamableMethod< | DeviceManagementCreateOrUpdateDeployment200Response - | DeviceManagementCreateOrUpdateDeploymentdefaultResponse + | DeviceManagementCreateOrUpdateDeploymentDefaultResponse >; /** Deletes a deployment. */ delete( options?: DeviceManagementDeleteDeploymentParameters, ): StreamableMethod< - DeviceManagementDeleteDeployment204Response | DeviceManagementDeleteDeploymentdefaultResponse + DeviceManagementDeleteDeployment204Response | DeviceManagementDeleteDeploymentDefaultResponse >; } @@ -428,7 +428,7 @@ export interface DeviceManagementGetDeploymentStatus { options?: DeviceManagementGetDeploymentStatusParameters, ): StreamableMethod< | DeviceManagementGetDeploymentStatus200Response - | DeviceManagementGetDeploymentStatusdefaultResponse + | DeviceManagementGetDeploymentStatusDefaultResponse >; } @@ -438,7 +438,7 @@ export interface DeviceManagementListDeviceClassSubgroupsForGroup { options?: DeviceManagementListDeviceClassSubgroupsForGroupParameters, ): StreamableMethod< | DeviceManagementListDeviceClassSubgroupsForGroup200Response - | DeviceManagementListDeviceClassSubgroupsForGroupdefaultResponse + | DeviceManagementListDeviceClassSubgroupsForGroupDefaultResponse >; } @@ -448,14 +448,14 @@ export interface DeviceManagementGetDeviceClassSubgroup { options?: DeviceManagementGetDeviceClassSubgroupParameters, ): StreamableMethod< | DeviceManagementGetDeviceClassSubgroup200Response - | DeviceManagementGetDeviceClassSubgroupdefaultResponse + | DeviceManagementGetDeviceClassSubgroupDefaultResponse >; /** Deletes a device class subgroup. This subgroup is automatically created when a Device Update-enabled device is connected to the hub and reports its properties. Groups, subgroups, and deployments are not automatically cleaned up but are retained for history purposes. Users can call this method to delete a subgroup if they do not need to retain any of the history of the subgroup and no longer need it. If a device is ever connected again for this subgroup after the subgroup was deleted it will be automatically re-created but there will be no history. */ delete( options?: DeviceManagementDeleteDeviceClassSubgroupParameters, ): StreamableMethod< | DeviceManagementDeleteDeviceClassSubgroup204Response - | DeviceManagementDeleteDeviceClassSubgroupdefaultResponse + | DeviceManagementDeleteDeviceClassSubgroupDefaultResponse >; } @@ -465,7 +465,7 @@ export interface DeviceManagementGetDeviceClassSubgroupUpdateCompliance { options?: DeviceManagementGetDeviceClassSubgroupUpdateComplianceParameters, ): StreamableMethod< | DeviceManagementGetDeviceClassSubgroupUpdateCompliance200Response - | DeviceManagementGetDeviceClassSubgroupUpdateCompliancedefaultResponse + | DeviceManagementGetDeviceClassSubgroupUpdateComplianceDefaultResponse >; } @@ -475,7 +475,7 @@ export interface DeviceManagementGetBestUpdatesForDeviceClassSubgroup { options?: DeviceManagementGetBestUpdatesForDeviceClassSubgroupParameters, ): StreamableMethod< | DeviceManagementGetBestUpdatesForDeviceClassSubgroup200Response - | DeviceManagementGetBestUpdatesForDeviceClassSubgroupdefaultResponse + | DeviceManagementGetBestUpdatesForDeviceClassSubgroupDefaultResponse >; } @@ -485,7 +485,7 @@ export interface DeviceManagementListDeploymentsForDeviceClassSubgroup { options?: DeviceManagementListDeploymentsForDeviceClassSubgroupParameters, ): StreamableMethod< | DeviceManagementListDeploymentsForDeviceClassSubgroup200Response - | DeviceManagementListDeploymentsForDeviceClassSubgroupdefaultResponse + | DeviceManagementListDeploymentsForDeviceClassSubgroupDefaultResponse >; } @@ -495,14 +495,14 @@ export interface DeviceManagementGetDeploymentForDeviceClassSubgroup { options?: DeviceManagementGetDeploymentForDeviceClassSubgroupParameters, ): StreamableMethod< | DeviceManagementGetDeploymentForDeviceClassSubgroup200Response - | DeviceManagementGetDeploymentForDeviceClassSubgroupdefaultResponse + | DeviceManagementGetDeploymentForDeviceClassSubgroupDefaultResponse >; /** Deletes a device class subgroup deployment. */ delete( options?: DeviceManagementDeleteDeploymentForDeviceClassSubgroupParameters, ): StreamableMethod< | DeviceManagementDeleteDeploymentForDeviceClassSubgroup204Response - | DeviceManagementDeleteDeploymentForDeviceClassSubgroupdefaultResponse + | DeviceManagementDeleteDeploymentForDeviceClassSubgroupDefaultResponse >; } @@ -511,7 +511,7 @@ export interface DeviceManagementStopDeployment { post( options?: DeviceManagementStopDeploymentParameters, ): StreamableMethod< - DeviceManagementStopDeployment200Response | DeviceManagementStopDeploymentdefaultResponse + DeviceManagementStopDeployment200Response | DeviceManagementStopDeploymentDefaultResponse >; } @@ -520,7 +520,7 @@ export interface DeviceManagementRetryDeployment { post( options?: DeviceManagementRetryDeploymentParameters, ): StreamableMethod< - DeviceManagementRetryDeployment200Response | DeviceManagementRetryDeploymentdefaultResponse + DeviceManagementRetryDeployment200Response | DeviceManagementRetryDeploymentDefaultResponse >; } @@ -530,7 +530,7 @@ export interface DeviceManagementGetDeviceClassSubgroupDeploymentStatus { options?: DeviceManagementGetDeviceClassSubgroupDeploymentStatusParameters, ): StreamableMethod< | DeviceManagementGetDeviceClassSubgroupDeploymentStatus200Response - | DeviceManagementGetDeviceClassSubgroupDeploymentStatusdefaultResponse + | DeviceManagementGetDeviceClassSubgroupDeploymentStatusDefaultResponse >; } @@ -540,7 +540,7 @@ export interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymen options?: DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentParameters, ): StreamableMethod< | DeviceManagementListDeviceStatesForDeviceClassSubgroupDeployment200Response - | DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentdefaultResponse + | DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentDefaultResponse >; } @@ -551,7 +551,7 @@ export interface DeviceManagementGetOperationStatus { ): StreamableMethod< | DeviceManagementGetOperationStatus200Response | DeviceManagementGetOperationStatus304Response - | DeviceManagementGetOperationStatusdefaultResponse + | DeviceManagementGetOperationStatusDefaultResponse >; } @@ -561,7 +561,7 @@ export interface DeviceManagementListOperationStatuses { options?: DeviceManagementListOperationStatusesParameters, ): StreamableMethod< | DeviceManagementListOperationStatuses200Response - | DeviceManagementListOperationStatusesdefaultResponse + | DeviceManagementListOperationStatusesDefaultResponse >; } @@ -571,13 +571,13 @@ export interface DeviceManagementStartLogCollection { options: DeviceManagementStartLogCollectionParameters, ): StreamableMethod< | DeviceManagementStartLogCollection201Response - | DeviceManagementStartLogCollectiondefaultResponse + | DeviceManagementStartLogCollectionDefaultResponse >; /** Get the device diagnostics log collection */ get( options?: DeviceManagementGetLogCollectionParameters, ): StreamableMethod< - DeviceManagementGetLogCollection200Response | DeviceManagementGetLogCollectiondefaultResponse + DeviceManagementGetLogCollection200Response | DeviceManagementGetLogCollectionDefaultResponse >; } @@ -587,7 +587,7 @@ export interface DeviceManagementListLogCollections { options?: DeviceManagementListLogCollectionsParameters, ): StreamableMethod< | DeviceManagementListLogCollections200Response - | DeviceManagementListLogCollectionsdefaultResponse + | DeviceManagementListLogCollectionsDefaultResponse >; } @@ -597,7 +597,7 @@ export interface DeviceManagementGetLogCollectionDetailedStatus { options?: DeviceManagementGetLogCollectionDetailedStatusParameters, ): StreamableMethod< | DeviceManagementGetLogCollectionDetailedStatus200Response - | DeviceManagementGetLogCollectionDetailedStatusdefaultResponse + | DeviceManagementGetLogCollectionDetailedStatusDefaultResponse >; } @@ -607,7 +607,7 @@ export interface DeviceManagementListHealthOfDevices { options: DeviceManagementListHealthOfDevicesParameters, ): StreamableMethod< | DeviceManagementListHealthOfDevices200Response - | DeviceManagementListHealthOfDevicesdefaultResponse + | DeviceManagementListHealthOfDevicesDefaultResponse >; } diff --git a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts index feb854cec238..22c0d8c41d98 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts @@ -1,25 +1,30 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. +// Licensed under the MIT license. import { getClient, ClientOptions } from "@azure-rest/core-client"; +import { logger } from "./logger"; import { TokenCredential } from "@azure/core-auth"; import { DeviceUpdateClient } from "./clientDefinitions"; +/** The optional parameters for the client */ +export interface DeviceUpdateClientOptions extends ClientOptions { + /** The api version option of the client */ + apiVersion?: string; +} + +/** + * Initialize a new instance of `DeviceUpdateClient` + * @param endpoint - The Device Update for IoT Hub account endpoint (hostname only, no protocol). + * @param credentials - uniquely identify client credential + * @param options - the parameter for all optional parameters + */ export default function createClient( endpoint: string, credentials: TokenCredential, - options: ClientOptions = {}, + { apiVersion = "2022-10-01", ...options }: DeviceUpdateClientOptions = {}, ): DeviceUpdateClient { - const baseUrl = options.baseUrl ?? `https://${endpoint}`; - options.apiVersion = options.apiVersion ?? "2022-10-01"; - options = { - ...options, - credentials: { - scopes: ["https://api.adu.microsoft.com/.default"], - }, - }; - - const userAgentInfo = `azsdk-js-iot-device-update-rest/1.0.0`; + const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://${endpoint}`; + const userAgentInfo = `azsdk-js-iot-device-update-rest/1.0.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` @@ -29,9 +34,31 @@ export default function createClient( userAgentOptions: { userAgentPrefix, }, + loggingOptions: { + logger: options.loggingOptions?.logger ?? logger.info, + }, + credentials: { + scopes: options.credentials?.scopes ?? ["https://api.adu.microsoft.com/.default"], + }, }; + const client = getClient(endpointUrl, credentials, options) as DeviceUpdateClient; + + client.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + client.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version") && apiVersion) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } - const client = getClient(baseUrl, credentials, options) as DeviceUpdateClient; + return next(req); + }, + }); return client; } diff --git a/sdk/deviceupdate/iot-device-update-rest/src/index.ts b/sdk/deviceupdate/iot-device-update-rest/src/index.ts index cf903e2cf87f..26b056160fa6 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/index.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. +// Licensed under the MIT license. import DeviceUpdate from "./deviceUpdate"; diff --git a/sdk/deviceupdate/iot-device-update-rest/src/isUnexpected.ts b/sdk/deviceupdate/iot-device-update-rest/src/isUnexpected.ts index 1a7ad2bb2046..257523a853e5 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/isUnexpected.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/isUnexpected.ts @@ -1,118 +1,118 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. +// Licensed under the MIT license. import { DeviceUpdateListUpdates200Response, - DeviceUpdateListUpdatesdefaultResponse, + DeviceUpdateListUpdatesDefaultResponse, DeviceUpdateImportUpdate200Response, DeviceUpdateImportUpdate202Response, - DeviceUpdateImportUpdatedefaultResponse, + DeviceUpdateImportUpdateDefaultResponse, DeviceUpdateGetUpdate200Response, DeviceUpdateGetUpdate304Response, - DeviceUpdateGetUpdatedefaultResponse, + DeviceUpdateGetUpdateDefaultResponse, DeviceUpdateDeleteUpdate202Response, - DeviceUpdateDeleteUpdatedefaultResponse, + DeviceUpdateDeleteUpdateDefaultResponse, DeviceUpdateListProviders200Response, - DeviceUpdateListProvidersdefaultResponse, + DeviceUpdateListProvidersDefaultResponse, DeviceUpdateListNames200Response, - DeviceUpdateListNamesdefaultResponse, + DeviceUpdateListNamesDefaultResponse, DeviceUpdateListVersions200Response, - DeviceUpdateListVersionsdefaultResponse, + DeviceUpdateListVersionsDefaultResponse, DeviceUpdateListFiles200Response, - DeviceUpdateListFilesdefaultResponse, + DeviceUpdateListFilesDefaultResponse, DeviceUpdateGetFile200Response, DeviceUpdateGetFile304Response, - DeviceUpdateGetFiledefaultResponse, + DeviceUpdateGetFileDefaultResponse, DeviceUpdateListOperationStatuses200Response, - DeviceUpdateListOperationStatusesdefaultResponse, + DeviceUpdateListOperationStatusesDefaultResponse, DeviceUpdateGetOperationStatus200Response, DeviceUpdateGetOperationStatus304Response, - DeviceUpdateGetOperationStatusdefaultResponse, + DeviceUpdateGetOperationStatusDefaultResponse, DeviceManagementListDeviceClasses200Response, - DeviceManagementListDeviceClassesdefaultResponse, + DeviceManagementListDeviceClassesDefaultResponse, DeviceManagementGetDeviceClass200Response, - DeviceManagementGetDeviceClassdefaultResponse, + DeviceManagementGetDeviceClassDefaultResponse, DeviceManagementUpdateDeviceClass200Response, - DeviceManagementUpdateDeviceClassdefaultResponse, + DeviceManagementUpdateDeviceClassDefaultResponse, DeviceManagementDeleteDeviceClass204Response, - DeviceManagementDeleteDeviceClassdefaultResponse, + DeviceManagementDeleteDeviceClassDefaultResponse, DeviceManagementListInstallableUpdatesForDeviceClass200Response, - DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse, + DeviceManagementListInstallableUpdatesForDeviceClassDefaultResponse, DeviceManagementListDevices200Response, - DeviceManagementListDevicesdefaultResponse, + DeviceManagementListDevicesDefaultResponse, DeviceManagementImportDevices202Response, - DeviceManagementImportDevicesdefaultResponse, + DeviceManagementImportDevicesDefaultResponse, DeviceManagementGetDevice200Response, - DeviceManagementGetDevicedefaultResponse, + DeviceManagementGetDeviceDefaultResponse, DeviceManagementGetDeviceModule200Response, - DeviceManagementGetDeviceModuledefaultResponse, + DeviceManagementGetDeviceModuleDefaultResponse, DeviceManagementGetUpdateCompliance200Response, - DeviceManagementGetUpdateCompliancedefaultResponse, + DeviceManagementGetUpdateComplianceDefaultResponse, DeviceManagementListGroups200Response, - DeviceManagementListGroupsdefaultResponse, + DeviceManagementListGroupsDefaultResponse, DeviceManagementGetGroup200Response, - DeviceManagementGetGroupdefaultResponse, + DeviceManagementGetGroupDefaultResponse, DeviceManagementDeleteGroup204Response, - DeviceManagementDeleteGroupdefaultResponse, + DeviceManagementDeleteGroupDefaultResponse, DeviceManagementGetUpdateComplianceForGroup200Response, - DeviceManagementGetUpdateComplianceForGroupdefaultResponse, + DeviceManagementGetUpdateComplianceForGroupDefaultResponse, DeviceManagementListBestUpdatesForGroup200Response, - DeviceManagementListBestUpdatesForGroupdefaultResponse, + DeviceManagementListBestUpdatesForGroupDefaultResponse, DeviceManagementListDeploymentsForGroup200Response, - DeviceManagementListDeploymentsForGroupdefaultResponse, + DeviceManagementListDeploymentsForGroupDefaultResponse, DeviceManagementGetDeployment200Response, - DeviceManagementGetDeploymentdefaultResponse, + DeviceManagementGetDeploymentDefaultResponse, DeviceManagementCreateOrUpdateDeployment200Response, - DeviceManagementCreateOrUpdateDeploymentdefaultResponse, + DeviceManagementCreateOrUpdateDeploymentDefaultResponse, DeviceManagementDeleteDeployment204Response, - DeviceManagementDeleteDeploymentdefaultResponse, + DeviceManagementDeleteDeploymentDefaultResponse, DeviceManagementGetDeploymentStatus200Response, - DeviceManagementGetDeploymentStatusdefaultResponse, + DeviceManagementGetDeploymentStatusDefaultResponse, DeviceManagementListDeviceClassSubgroupsForGroup200Response, - DeviceManagementListDeviceClassSubgroupsForGroupdefaultResponse, + DeviceManagementListDeviceClassSubgroupsForGroupDefaultResponse, DeviceManagementGetDeviceClassSubgroup200Response, - DeviceManagementGetDeviceClassSubgroupdefaultResponse, + DeviceManagementGetDeviceClassSubgroupDefaultResponse, DeviceManagementDeleteDeviceClassSubgroup204Response, - DeviceManagementDeleteDeviceClassSubgroupdefaultResponse, + DeviceManagementDeleteDeviceClassSubgroupDefaultResponse, DeviceManagementGetDeviceClassSubgroupUpdateCompliance200Response, - DeviceManagementGetDeviceClassSubgroupUpdateCompliancedefaultResponse, + DeviceManagementGetDeviceClassSubgroupUpdateComplianceDefaultResponse, DeviceManagementGetBestUpdatesForDeviceClassSubgroup200Response, - DeviceManagementGetBestUpdatesForDeviceClassSubgroupdefaultResponse, + DeviceManagementGetBestUpdatesForDeviceClassSubgroupDefaultResponse, DeviceManagementListDeploymentsForDeviceClassSubgroup200Response, - DeviceManagementListDeploymentsForDeviceClassSubgroupdefaultResponse, + DeviceManagementListDeploymentsForDeviceClassSubgroupDefaultResponse, DeviceManagementGetDeploymentForDeviceClassSubgroup200Response, - DeviceManagementGetDeploymentForDeviceClassSubgroupdefaultResponse, + DeviceManagementGetDeploymentForDeviceClassSubgroupDefaultResponse, DeviceManagementDeleteDeploymentForDeviceClassSubgroup204Response, - DeviceManagementDeleteDeploymentForDeviceClassSubgroupdefaultResponse, + DeviceManagementDeleteDeploymentForDeviceClassSubgroupDefaultResponse, DeviceManagementStopDeployment200Response, - DeviceManagementStopDeploymentdefaultResponse, + DeviceManagementStopDeploymentDefaultResponse, DeviceManagementRetryDeployment200Response, - DeviceManagementRetryDeploymentdefaultResponse, + DeviceManagementRetryDeploymentDefaultResponse, DeviceManagementGetDeviceClassSubgroupDeploymentStatus200Response, - DeviceManagementGetDeviceClassSubgroupDeploymentStatusdefaultResponse, + DeviceManagementGetDeviceClassSubgroupDeploymentStatusDefaultResponse, DeviceManagementListDeviceStatesForDeviceClassSubgroupDeployment200Response, - DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentdefaultResponse, + DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentDefaultResponse, DeviceManagementGetOperationStatus200Response, DeviceManagementGetOperationStatus304Response, - DeviceManagementGetOperationStatusdefaultResponse, + DeviceManagementGetOperationStatusDefaultResponse, DeviceManagementListOperationStatuses200Response, - DeviceManagementListOperationStatusesdefaultResponse, + DeviceManagementListOperationStatusesDefaultResponse, DeviceManagementStartLogCollection201Response, - DeviceManagementStartLogCollectiondefaultResponse, + DeviceManagementStartLogCollectionDefaultResponse, DeviceManagementGetLogCollection200Response, - DeviceManagementGetLogCollectiondefaultResponse, + DeviceManagementGetLogCollectionDefaultResponse, DeviceManagementListLogCollections200Response, - DeviceManagementListLogCollectionsdefaultResponse, + DeviceManagementListLogCollectionsDefaultResponse, DeviceManagementGetLogCollectionDetailedStatus200Response, - DeviceManagementGetLogCollectionDetailedStatusdefaultResponse, + DeviceManagementGetLogCollectionDetailedStatusDefaultResponse, DeviceManagementListHealthOfDevices200Response, - DeviceManagementListHealthOfDevicesdefaultResponse, + DeviceManagementListHealthOfDevicesDefaultResponse, } from "./responses"; const responseMap: Record = { "GET /deviceUpdate/{instanceId}/updates": ["200"], - "POST /deviceUpdate/{instanceId}/updates:import": ["200", "202"], "GET /deviceUpdate/{instanceId}/updates:import": ["200", "202"], + "POST /deviceUpdate/{instanceId}/updates:import": ["200", "202"], "GET /deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}": [ "200", "304", @@ -136,8 +136,8 @@ const responseMap: Record = { "200", ], "GET /deviceUpdate/{instanceId}/management/devices": ["200"], - "POST /deviceUpdate/{instanceId}/management/devices:import": ["202"], "GET /deviceUpdate/{instanceId}/management/devices:import": ["202"], + "POST /deviceUpdate/{instanceId}/management/devices:import": ["202"], "GET /deviceUpdate/{instanceId}/management/devices/{deviceId}": ["200"], "GET /deviceUpdate/{instanceId}/management/devices/{deviceId}/modules/{moduleId}": ["200"], "GET /deviceUpdate/{instanceId}/management/updateCompliance": ["200"], @@ -193,450 +193,461 @@ const responseMap: Record = { }; export function isUnexpected( - response: DeviceUpdateListUpdates200Response | DeviceUpdateListUpdatesdefaultResponse, -): response is DeviceUpdateListUpdatesdefaultResponse; + response: DeviceUpdateListUpdates200Response | DeviceUpdateListUpdatesDefaultResponse, +): response is DeviceUpdateListUpdatesDefaultResponse; export function isUnexpected( response: | DeviceUpdateImportUpdate200Response | DeviceUpdateImportUpdate202Response - | DeviceUpdateImportUpdatedefaultResponse, -): response is DeviceUpdateImportUpdatedefaultResponse; + | DeviceUpdateImportUpdateDefaultResponse, +): response is DeviceUpdateImportUpdateDefaultResponse; export function isUnexpected( response: | DeviceUpdateGetUpdate200Response | DeviceUpdateGetUpdate304Response - | DeviceUpdateGetUpdatedefaultResponse, -): response is DeviceUpdateGetUpdatedefaultResponse; + | DeviceUpdateGetUpdateDefaultResponse, +): response is DeviceUpdateGetUpdateDefaultResponse; export function isUnexpected( - response: DeviceUpdateDeleteUpdate202Response | DeviceUpdateDeleteUpdatedefaultResponse, -): response is DeviceUpdateDeleteUpdatedefaultResponse; + response: DeviceUpdateDeleteUpdate202Response | DeviceUpdateDeleteUpdateDefaultResponse, +): response is DeviceUpdateDeleteUpdateDefaultResponse; export function isUnexpected( - response: DeviceUpdateListProviders200Response | DeviceUpdateListProvidersdefaultResponse, -): response is DeviceUpdateListProvidersdefaultResponse; + response: DeviceUpdateListProviders200Response | DeviceUpdateListProvidersDefaultResponse, +): response is DeviceUpdateListProvidersDefaultResponse; export function isUnexpected( - response: DeviceUpdateListNames200Response | DeviceUpdateListNamesdefaultResponse, -): response is DeviceUpdateListNamesdefaultResponse; + response: DeviceUpdateListNames200Response | DeviceUpdateListNamesDefaultResponse, +): response is DeviceUpdateListNamesDefaultResponse; export function isUnexpected( - response: DeviceUpdateListVersions200Response | DeviceUpdateListVersionsdefaultResponse, -): response is DeviceUpdateListVersionsdefaultResponse; + response: DeviceUpdateListVersions200Response | DeviceUpdateListVersionsDefaultResponse, +): response is DeviceUpdateListVersionsDefaultResponse; export function isUnexpected( - response: DeviceUpdateListFiles200Response | DeviceUpdateListFilesdefaultResponse, -): response is DeviceUpdateListFilesdefaultResponse; + response: DeviceUpdateListFiles200Response | DeviceUpdateListFilesDefaultResponse, +): response is DeviceUpdateListFilesDefaultResponse; export function isUnexpected( response: | DeviceUpdateGetFile200Response | DeviceUpdateGetFile304Response - | DeviceUpdateGetFiledefaultResponse, -): response is DeviceUpdateGetFiledefaultResponse; + | DeviceUpdateGetFileDefaultResponse, +): response is DeviceUpdateGetFileDefaultResponse; export function isUnexpected( response: | DeviceUpdateListOperationStatuses200Response - | DeviceUpdateListOperationStatusesdefaultResponse, -): response is DeviceUpdateListOperationStatusesdefaultResponse; + | DeviceUpdateListOperationStatusesDefaultResponse, +): response is DeviceUpdateListOperationStatusesDefaultResponse; export function isUnexpected( response: | DeviceUpdateGetOperationStatus200Response | DeviceUpdateGetOperationStatus304Response - | DeviceUpdateGetOperationStatusdefaultResponse, -): response is DeviceUpdateGetOperationStatusdefaultResponse; + | DeviceUpdateGetOperationStatusDefaultResponse, +): response is DeviceUpdateGetOperationStatusDefaultResponse; export function isUnexpected( response: | DeviceManagementListDeviceClasses200Response - | DeviceManagementListDeviceClassesdefaultResponse, -): response is DeviceManagementListDeviceClassesdefaultResponse; + | DeviceManagementListDeviceClassesDefaultResponse, +): response is DeviceManagementListDeviceClassesDefaultResponse; export function isUnexpected( response: | DeviceManagementGetDeviceClass200Response - | DeviceManagementGetDeviceClassdefaultResponse, -): response is DeviceManagementGetDeviceClassdefaultResponse; + | DeviceManagementGetDeviceClassDefaultResponse, +): response is DeviceManagementGetDeviceClassDefaultResponse; export function isUnexpected( response: | DeviceManagementUpdateDeviceClass200Response - | DeviceManagementUpdateDeviceClassdefaultResponse, -): response is DeviceManagementUpdateDeviceClassdefaultResponse; + | DeviceManagementUpdateDeviceClassDefaultResponse, +): response is DeviceManagementUpdateDeviceClassDefaultResponse; export function isUnexpected( response: | DeviceManagementDeleteDeviceClass204Response - | DeviceManagementDeleteDeviceClassdefaultResponse, -): response is DeviceManagementDeleteDeviceClassdefaultResponse; + | DeviceManagementDeleteDeviceClassDefaultResponse, +): response is DeviceManagementDeleteDeviceClassDefaultResponse; export function isUnexpected( response: | DeviceManagementListInstallableUpdatesForDeviceClass200Response - | DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse, -): response is DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse; + | DeviceManagementListInstallableUpdatesForDeviceClassDefaultResponse, +): response is DeviceManagementListInstallableUpdatesForDeviceClassDefaultResponse; export function isUnexpected( - response: DeviceManagementListDevices200Response | DeviceManagementListDevicesdefaultResponse, -): response is DeviceManagementListDevicesdefaultResponse; + response: DeviceManagementListDevices200Response | DeviceManagementListDevicesDefaultResponse, +): response is DeviceManagementListDevicesDefaultResponse; export function isUnexpected( - response: DeviceManagementImportDevices202Response | DeviceManagementImportDevicesdefaultResponse, -): response is DeviceManagementImportDevicesdefaultResponse; + response: DeviceManagementImportDevices202Response | DeviceManagementImportDevicesDefaultResponse, +): response is DeviceManagementImportDevicesDefaultResponse; export function isUnexpected( - response: DeviceManagementGetDevice200Response | DeviceManagementGetDevicedefaultResponse, -): response is DeviceManagementGetDevicedefaultResponse; + response: DeviceManagementGetDevice200Response | DeviceManagementGetDeviceDefaultResponse, +): response is DeviceManagementGetDeviceDefaultResponse; export function isUnexpected( response: | DeviceManagementGetDeviceModule200Response - | DeviceManagementGetDeviceModuledefaultResponse, -): response is DeviceManagementGetDeviceModuledefaultResponse; + | DeviceManagementGetDeviceModuleDefaultResponse, +): response is DeviceManagementGetDeviceModuleDefaultResponse; export function isUnexpected( response: | DeviceManagementGetUpdateCompliance200Response - | DeviceManagementGetUpdateCompliancedefaultResponse, -): response is DeviceManagementGetUpdateCompliancedefaultResponse; + | DeviceManagementGetUpdateComplianceDefaultResponse, +): response is DeviceManagementGetUpdateComplianceDefaultResponse; export function isUnexpected( - response: DeviceManagementListGroups200Response | DeviceManagementListGroupsdefaultResponse, -): response is DeviceManagementListGroupsdefaultResponse; + response: DeviceManagementListGroups200Response | DeviceManagementListGroupsDefaultResponse, +): response is DeviceManagementListGroupsDefaultResponse; export function isUnexpected( - response: DeviceManagementGetGroup200Response | DeviceManagementGetGroupdefaultResponse, -): response is DeviceManagementGetGroupdefaultResponse; + response: DeviceManagementGetGroup200Response | DeviceManagementGetGroupDefaultResponse, +): response is DeviceManagementGetGroupDefaultResponse; export function isUnexpected( - response: DeviceManagementDeleteGroup204Response | DeviceManagementDeleteGroupdefaultResponse, -): response is DeviceManagementDeleteGroupdefaultResponse; + response: DeviceManagementDeleteGroup204Response | DeviceManagementDeleteGroupDefaultResponse, +): response is DeviceManagementDeleteGroupDefaultResponse; export function isUnexpected( response: | DeviceManagementGetUpdateComplianceForGroup200Response - | DeviceManagementGetUpdateComplianceForGroupdefaultResponse, -): response is DeviceManagementGetUpdateComplianceForGroupdefaultResponse; + | DeviceManagementGetUpdateComplianceForGroupDefaultResponse, +): response is DeviceManagementGetUpdateComplianceForGroupDefaultResponse; export function isUnexpected( response: | DeviceManagementListBestUpdatesForGroup200Response - | DeviceManagementListBestUpdatesForGroupdefaultResponse, -): response is DeviceManagementListBestUpdatesForGroupdefaultResponse; + | DeviceManagementListBestUpdatesForGroupDefaultResponse, +): response is DeviceManagementListBestUpdatesForGroupDefaultResponse; export function isUnexpected( response: | DeviceManagementListDeploymentsForGroup200Response - | DeviceManagementListDeploymentsForGroupdefaultResponse, -): response is DeviceManagementListDeploymentsForGroupdefaultResponse; + | DeviceManagementListDeploymentsForGroupDefaultResponse, +): response is DeviceManagementListDeploymentsForGroupDefaultResponse; export function isUnexpected( - response: DeviceManagementGetDeployment200Response | DeviceManagementGetDeploymentdefaultResponse, -): response is DeviceManagementGetDeploymentdefaultResponse; + response: DeviceManagementGetDeployment200Response | DeviceManagementGetDeploymentDefaultResponse, +): response is DeviceManagementGetDeploymentDefaultResponse; export function isUnexpected( response: | DeviceManagementCreateOrUpdateDeployment200Response - | DeviceManagementCreateOrUpdateDeploymentdefaultResponse, -): response is DeviceManagementCreateOrUpdateDeploymentdefaultResponse; + | DeviceManagementCreateOrUpdateDeploymentDefaultResponse, +): response is DeviceManagementCreateOrUpdateDeploymentDefaultResponse; export function isUnexpected( response: | DeviceManagementDeleteDeployment204Response - | DeviceManagementDeleteDeploymentdefaultResponse, -): response is DeviceManagementDeleteDeploymentdefaultResponse; + | DeviceManagementDeleteDeploymentDefaultResponse, +): response is DeviceManagementDeleteDeploymentDefaultResponse; export function isUnexpected( response: | DeviceManagementGetDeploymentStatus200Response - | DeviceManagementGetDeploymentStatusdefaultResponse, -): response is DeviceManagementGetDeploymentStatusdefaultResponse; + | DeviceManagementGetDeploymentStatusDefaultResponse, +): response is DeviceManagementGetDeploymentStatusDefaultResponse; export function isUnexpected( response: | DeviceManagementListDeviceClassSubgroupsForGroup200Response - | DeviceManagementListDeviceClassSubgroupsForGroupdefaultResponse, -): response is DeviceManagementListDeviceClassSubgroupsForGroupdefaultResponse; + | DeviceManagementListDeviceClassSubgroupsForGroupDefaultResponse, +): response is DeviceManagementListDeviceClassSubgroupsForGroupDefaultResponse; export function isUnexpected( response: | DeviceManagementGetDeviceClassSubgroup200Response - | DeviceManagementGetDeviceClassSubgroupdefaultResponse, -): response is DeviceManagementGetDeviceClassSubgroupdefaultResponse; + | DeviceManagementGetDeviceClassSubgroupDefaultResponse, +): response is DeviceManagementGetDeviceClassSubgroupDefaultResponse; export function isUnexpected( response: | DeviceManagementDeleteDeviceClassSubgroup204Response - | DeviceManagementDeleteDeviceClassSubgroupdefaultResponse, -): response is DeviceManagementDeleteDeviceClassSubgroupdefaultResponse; + | DeviceManagementDeleteDeviceClassSubgroupDefaultResponse, +): response is DeviceManagementDeleteDeviceClassSubgroupDefaultResponse; export function isUnexpected( response: | DeviceManagementGetDeviceClassSubgroupUpdateCompliance200Response - | DeviceManagementGetDeviceClassSubgroupUpdateCompliancedefaultResponse, -): response is DeviceManagementGetDeviceClassSubgroupUpdateCompliancedefaultResponse; + | DeviceManagementGetDeviceClassSubgroupUpdateComplianceDefaultResponse, +): response is DeviceManagementGetDeviceClassSubgroupUpdateComplianceDefaultResponse; export function isUnexpected( response: | DeviceManagementGetBestUpdatesForDeviceClassSubgroup200Response - | DeviceManagementGetBestUpdatesForDeviceClassSubgroupdefaultResponse, -): response is DeviceManagementGetBestUpdatesForDeviceClassSubgroupdefaultResponse; + | DeviceManagementGetBestUpdatesForDeviceClassSubgroupDefaultResponse, +): response is DeviceManagementGetBestUpdatesForDeviceClassSubgroupDefaultResponse; export function isUnexpected( response: | DeviceManagementListDeploymentsForDeviceClassSubgroup200Response - | DeviceManagementListDeploymentsForDeviceClassSubgroupdefaultResponse, -): response is DeviceManagementListDeploymentsForDeviceClassSubgroupdefaultResponse; + | DeviceManagementListDeploymentsForDeviceClassSubgroupDefaultResponse, +): response is DeviceManagementListDeploymentsForDeviceClassSubgroupDefaultResponse; export function isUnexpected( response: | DeviceManagementGetDeploymentForDeviceClassSubgroup200Response - | DeviceManagementGetDeploymentForDeviceClassSubgroupdefaultResponse, -): response is DeviceManagementGetDeploymentForDeviceClassSubgroupdefaultResponse; + | DeviceManagementGetDeploymentForDeviceClassSubgroupDefaultResponse, +): response is DeviceManagementGetDeploymentForDeviceClassSubgroupDefaultResponse; export function isUnexpected( response: | DeviceManagementDeleteDeploymentForDeviceClassSubgroup204Response - | DeviceManagementDeleteDeploymentForDeviceClassSubgroupdefaultResponse, -): response is DeviceManagementDeleteDeploymentForDeviceClassSubgroupdefaultResponse; + | DeviceManagementDeleteDeploymentForDeviceClassSubgroupDefaultResponse, +): response is DeviceManagementDeleteDeploymentForDeviceClassSubgroupDefaultResponse; export function isUnexpected( response: | DeviceManagementStopDeployment200Response - | DeviceManagementStopDeploymentdefaultResponse, -): response is DeviceManagementStopDeploymentdefaultResponse; + | DeviceManagementStopDeploymentDefaultResponse, +): response is DeviceManagementStopDeploymentDefaultResponse; export function isUnexpected( response: | DeviceManagementRetryDeployment200Response - | DeviceManagementRetryDeploymentdefaultResponse, -): response is DeviceManagementRetryDeploymentdefaultResponse; + | DeviceManagementRetryDeploymentDefaultResponse, +): response is DeviceManagementRetryDeploymentDefaultResponse; export function isUnexpected( response: | DeviceManagementGetDeviceClassSubgroupDeploymentStatus200Response - | DeviceManagementGetDeviceClassSubgroupDeploymentStatusdefaultResponse, -): response is DeviceManagementGetDeviceClassSubgroupDeploymentStatusdefaultResponse; + | DeviceManagementGetDeviceClassSubgroupDeploymentStatusDefaultResponse, +): response is DeviceManagementGetDeviceClassSubgroupDeploymentStatusDefaultResponse; export function isUnexpected( response: | DeviceManagementListDeviceStatesForDeviceClassSubgroupDeployment200Response - | DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentdefaultResponse, -): response is DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentdefaultResponse; + | DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentDefaultResponse, +): response is DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentDefaultResponse; export function isUnexpected( response: | DeviceManagementGetOperationStatus200Response | DeviceManagementGetOperationStatus304Response - | DeviceManagementGetOperationStatusdefaultResponse, -): response is DeviceManagementGetOperationStatusdefaultResponse; + | DeviceManagementGetOperationStatusDefaultResponse, +): response is DeviceManagementGetOperationStatusDefaultResponse; export function isUnexpected( response: | DeviceManagementListOperationStatuses200Response - | DeviceManagementListOperationStatusesdefaultResponse, -): response is DeviceManagementListOperationStatusesdefaultResponse; + | DeviceManagementListOperationStatusesDefaultResponse, +): response is DeviceManagementListOperationStatusesDefaultResponse; export function isUnexpected( response: | DeviceManagementStartLogCollection201Response - | DeviceManagementStartLogCollectiondefaultResponse, -): response is DeviceManagementStartLogCollectiondefaultResponse; + | DeviceManagementStartLogCollectionDefaultResponse, +): response is DeviceManagementStartLogCollectionDefaultResponse; export function isUnexpected( response: | DeviceManagementGetLogCollection200Response - | DeviceManagementGetLogCollectiondefaultResponse, -): response is DeviceManagementGetLogCollectiondefaultResponse; + | DeviceManagementGetLogCollectionDefaultResponse, +): response is DeviceManagementGetLogCollectionDefaultResponse; export function isUnexpected( response: | DeviceManagementListLogCollections200Response - | DeviceManagementListLogCollectionsdefaultResponse, -): response is DeviceManagementListLogCollectionsdefaultResponse; + | DeviceManagementListLogCollectionsDefaultResponse, +): response is DeviceManagementListLogCollectionsDefaultResponse; export function isUnexpected( response: | DeviceManagementGetLogCollectionDetailedStatus200Response - | DeviceManagementGetLogCollectionDetailedStatusdefaultResponse, -): response is DeviceManagementGetLogCollectionDetailedStatusdefaultResponse; + | DeviceManagementGetLogCollectionDetailedStatusDefaultResponse, +): response is DeviceManagementGetLogCollectionDetailedStatusDefaultResponse; export function isUnexpected( response: | DeviceManagementListHealthOfDevices200Response - | DeviceManagementListHealthOfDevicesdefaultResponse, -): response is DeviceManagementListHealthOfDevicesdefaultResponse; + | DeviceManagementListHealthOfDevicesDefaultResponse, +): response is DeviceManagementListHealthOfDevicesDefaultResponse; export function isUnexpected( response: | DeviceUpdateListUpdates200Response - | DeviceUpdateListUpdatesdefaultResponse + | DeviceUpdateListUpdatesDefaultResponse | DeviceUpdateImportUpdate200Response | DeviceUpdateImportUpdate202Response - | DeviceUpdateImportUpdatedefaultResponse + | DeviceUpdateImportUpdateDefaultResponse | DeviceUpdateGetUpdate200Response | DeviceUpdateGetUpdate304Response - | DeviceUpdateGetUpdatedefaultResponse + | DeviceUpdateGetUpdateDefaultResponse | DeviceUpdateDeleteUpdate202Response - | DeviceUpdateDeleteUpdatedefaultResponse + | DeviceUpdateDeleteUpdateDefaultResponse | DeviceUpdateListProviders200Response - | DeviceUpdateListProvidersdefaultResponse + | DeviceUpdateListProvidersDefaultResponse | DeviceUpdateListNames200Response - | DeviceUpdateListNamesdefaultResponse + | DeviceUpdateListNamesDefaultResponse | DeviceUpdateListVersions200Response - | DeviceUpdateListVersionsdefaultResponse + | DeviceUpdateListVersionsDefaultResponse | DeviceUpdateListFiles200Response - | DeviceUpdateListFilesdefaultResponse + | DeviceUpdateListFilesDefaultResponse | DeviceUpdateGetFile200Response | DeviceUpdateGetFile304Response - | DeviceUpdateGetFiledefaultResponse + | DeviceUpdateGetFileDefaultResponse | DeviceUpdateListOperationStatuses200Response - | DeviceUpdateListOperationStatusesdefaultResponse + | DeviceUpdateListOperationStatusesDefaultResponse | DeviceUpdateGetOperationStatus200Response | DeviceUpdateGetOperationStatus304Response - | DeviceUpdateGetOperationStatusdefaultResponse + | DeviceUpdateGetOperationStatusDefaultResponse | DeviceManagementListDeviceClasses200Response - | DeviceManagementListDeviceClassesdefaultResponse + | DeviceManagementListDeviceClassesDefaultResponse | DeviceManagementGetDeviceClass200Response - | DeviceManagementGetDeviceClassdefaultResponse + | DeviceManagementGetDeviceClassDefaultResponse | DeviceManagementUpdateDeviceClass200Response - | DeviceManagementUpdateDeviceClassdefaultResponse + | DeviceManagementUpdateDeviceClassDefaultResponse | DeviceManagementDeleteDeviceClass204Response - | DeviceManagementDeleteDeviceClassdefaultResponse + | DeviceManagementDeleteDeviceClassDefaultResponse | DeviceManagementListInstallableUpdatesForDeviceClass200Response - | DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse + | DeviceManagementListInstallableUpdatesForDeviceClassDefaultResponse | DeviceManagementListDevices200Response - | DeviceManagementListDevicesdefaultResponse + | DeviceManagementListDevicesDefaultResponse | DeviceManagementImportDevices202Response - | DeviceManagementImportDevicesdefaultResponse + | DeviceManagementImportDevicesDefaultResponse | DeviceManagementGetDevice200Response - | DeviceManagementGetDevicedefaultResponse + | DeviceManagementGetDeviceDefaultResponse | DeviceManagementGetDeviceModule200Response - | DeviceManagementGetDeviceModuledefaultResponse + | DeviceManagementGetDeviceModuleDefaultResponse | DeviceManagementGetUpdateCompliance200Response - | DeviceManagementGetUpdateCompliancedefaultResponse + | DeviceManagementGetUpdateComplianceDefaultResponse | DeviceManagementListGroups200Response - | DeviceManagementListGroupsdefaultResponse + | DeviceManagementListGroupsDefaultResponse | DeviceManagementGetGroup200Response - | DeviceManagementGetGroupdefaultResponse + | DeviceManagementGetGroupDefaultResponse | DeviceManagementDeleteGroup204Response - | DeviceManagementDeleteGroupdefaultResponse + | DeviceManagementDeleteGroupDefaultResponse | DeviceManagementGetUpdateComplianceForGroup200Response - | DeviceManagementGetUpdateComplianceForGroupdefaultResponse + | DeviceManagementGetUpdateComplianceForGroupDefaultResponse | DeviceManagementListBestUpdatesForGroup200Response - | DeviceManagementListBestUpdatesForGroupdefaultResponse + | DeviceManagementListBestUpdatesForGroupDefaultResponse | DeviceManagementListDeploymentsForGroup200Response - | DeviceManagementListDeploymentsForGroupdefaultResponse + | DeviceManagementListDeploymentsForGroupDefaultResponse | DeviceManagementGetDeployment200Response - | DeviceManagementGetDeploymentdefaultResponse + | DeviceManagementGetDeploymentDefaultResponse | DeviceManagementCreateOrUpdateDeployment200Response - | DeviceManagementCreateOrUpdateDeploymentdefaultResponse + | DeviceManagementCreateOrUpdateDeploymentDefaultResponse | DeviceManagementDeleteDeployment204Response - | DeviceManagementDeleteDeploymentdefaultResponse + | DeviceManagementDeleteDeploymentDefaultResponse | DeviceManagementGetDeploymentStatus200Response - | DeviceManagementGetDeploymentStatusdefaultResponse + | DeviceManagementGetDeploymentStatusDefaultResponse | DeviceManagementListDeviceClassSubgroupsForGroup200Response - | DeviceManagementListDeviceClassSubgroupsForGroupdefaultResponse + | DeviceManagementListDeviceClassSubgroupsForGroupDefaultResponse | DeviceManagementGetDeviceClassSubgroup200Response - | DeviceManagementGetDeviceClassSubgroupdefaultResponse + | DeviceManagementGetDeviceClassSubgroupDefaultResponse | DeviceManagementDeleteDeviceClassSubgroup204Response - | DeviceManagementDeleteDeviceClassSubgroupdefaultResponse + | DeviceManagementDeleteDeviceClassSubgroupDefaultResponse | DeviceManagementGetDeviceClassSubgroupUpdateCompliance200Response - | DeviceManagementGetDeviceClassSubgroupUpdateCompliancedefaultResponse + | DeviceManagementGetDeviceClassSubgroupUpdateComplianceDefaultResponse | DeviceManagementGetBestUpdatesForDeviceClassSubgroup200Response - | DeviceManagementGetBestUpdatesForDeviceClassSubgroupdefaultResponse + | DeviceManagementGetBestUpdatesForDeviceClassSubgroupDefaultResponse | DeviceManagementListDeploymentsForDeviceClassSubgroup200Response - | DeviceManagementListDeploymentsForDeviceClassSubgroupdefaultResponse + | DeviceManagementListDeploymentsForDeviceClassSubgroupDefaultResponse | DeviceManagementGetDeploymentForDeviceClassSubgroup200Response - | DeviceManagementGetDeploymentForDeviceClassSubgroupdefaultResponse + | DeviceManagementGetDeploymentForDeviceClassSubgroupDefaultResponse | DeviceManagementDeleteDeploymentForDeviceClassSubgroup204Response - | DeviceManagementDeleteDeploymentForDeviceClassSubgroupdefaultResponse + | DeviceManagementDeleteDeploymentForDeviceClassSubgroupDefaultResponse | DeviceManagementStopDeployment200Response - | DeviceManagementStopDeploymentdefaultResponse + | DeviceManagementStopDeploymentDefaultResponse | DeviceManagementRetryDeployment200Response - | DeviceManagementRetryDeploymentdefaultResponse + | DeviceManagementRetryDeploymentDefaultResponse | DeviceManagementGetDeviceClassSubgroupDeploymentStatus200Response - | DeviceManagementGetDeviceClassSubgroupDeploymentStatusdefaultResponse + | DeviceManagementGetDeviceClassSubgroupDeploymentStatusDefaultResponse | DeviceManagementListDeviceStatesForDeviceClassSubgroupDeployment200Response - | DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentdefaultResponse + | DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentDefaultResponse | DeviceManagementGetOperationStatus200Response | DeviceManagementGetOperationStatus304Response - | DeviceManagementGetOperationStatusdefaultResponse + | DeviceManagementGetOperationStatusDefaultResponse | DeviceManagementListOperationStatuses200Response - | DeviceManagementListOperationStatusesdefaultResponse + | DeviceManagementListOperationStatusesDefaultResponse | DeviceManagementStartLogCollection201Response - | DeviceManagementStartLogCollectiondefaultResponse + | DeviceManagementStartLogCollectionDefaultResponse | DeviceManagementGetLogCollection200Response - | DeviceManagementGetLogCollectiondefaultResponse + | DeviceManagementGetLogCollectionDefaultResponse | DeviceManagementListLogCollections200Response - | DeviceManagementListLogCollectionsdefaultResponse + | DeviceManagementListLogCollectionsDefaultResponse | DeviceManagementGetLogCollectionDetailedStatus200Response - | DeviceManagementGetLogCollectionDetailedStatusdefaultResponse + | DeviceManagementGetLogCollectionDetailedStatusDefaultResponse | DeviceManagementListHealthOfDevices200Response - | DeviceManagementListHealthOfDevicesdefaultResponse, + | DeviceManagementListHealthOfDevicesDefaultResponse, ): response is - | DeviceUpdateListUpdatesdefaultResponse - | DeviceUpdateImportUpdatedefaultResponse - | DeviceUpdateGetUpdatedefaultResponse - | DeviceUpdateDeleteUpdatedefaultResponse - | DeviceUpdateListProvidersdefaultResponse - | DeviceUpdateListNamesdefaultResponse - | DeviceUpdateListVersionsdefaultResponse - | DeviceUpdateListFilesdefaultResponse - | DeviceUpdateGetFiledefaultResponse - | DeviceUpdateListOperationStatusesdefaultResponse - | DeviceUpdateGetOperationStatusdefaultResponse - | DeviceManagementListDeviceClassesdefaultResponse - | DeviceManagementGetDeviceClassdefaultResponse - | DeviceManagementUpdateDeviceClassdefaultResponse - | DeviceManagementDeleteDeviceClassdefaultResponse - | DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse - | DeviceManagementListDevicesdefaultResponse - | DeviceManagementImportDevicesdefaultResponse - | DeviceManagementGetDevicedefaultResponse - | DeviceManagementGetDeviceModuledefaultResponse - | DeviceManagementGetUpdateCompliancedefaultResponse - | DeviceManagementListGroupsdefaultResponse - | DeviceManagementGetGroupdefaultResponse - | DeviceManagementDeleteGroupdefaultResponse - | DeviceManagementGetUpdateComplianceForGroupdefaultResponse - | DeviceManagementListBestUpdatesForGroupdefaultResponse - | DeviceManagementListDeploymentsForGroupdefaultResponse - | DeviceManagementGetDeploymentdefaultResponse - | DeviceManagementCreateOrUpdateDeploymentdefaultResponse - | DeviceManagementDeleteDeploymentdefaultResponse - | DeviceManagementGetDeploymentStatusdefaultResponse - | DeviceManagementListDeviceClassSubgroupsForGroupdefaultResponse - | DeviceManagementGetDeviceClassSubgroupdefaultResponse - | DeviceManagementDeleteDeviceClassSubgroupdefaultResponse - | DeviceManagementGetDeviceClassSubgroupUpdateCompliancedefaultResponse - | DeviceManagementGetBestUpdatesForDeviceClassSubgroupdefaultResponse - | DeviceManagementListDeploymentsForDeviceClassSubgroupdefaultResponse - | DeviceManagementGetDeploymentForDeviceClassSubgroupdefaultResponse - | DeviceManagementDeleteDeploymentForDeviceClassSubgroupdefaultResponse - | DeviceManagementStopDeploymentdefaultResponse - | DeviceManagementRetryDeploymentdefaultResponse - | DeviceManagementGetDeviceClassSubgroupDeploymentStatusdefaultResponse - | DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentdefaultResponse - | DeviceManagementGetOperationStatusdefaultResponse - | DeviceManagementListOperationStatusesdefaultResponse - | DeviceManagementStartLogCollectiondefaultResponse - | DeviceManagementGetLogCollectiondefaultResponse - | DeviceManagementListLogCollectionsdefaultResponse - | DeviceManagementGetLogCollectionDetailedStatusdefaultResponse - | DeviceManagementListHealthOfDevicesdefaultResponse { + | DeviceUpdateListUpdatesDefaultResponse + | DeviceUpdateImportUpdateDefaultResponse + | DeviceUpdateGetUpdateDefaultResponse + | DeviceUpdateDeleteUpdateDefaultResponse + | DeviceUpdateListProvidersDefaultResponse + | DeviceUpdateListNamesDefaultResponse + | DeviceUpdateListVersionsDefaultResponse + | DeviceUpdateListFilesDefaultResponse + | DeviceUpdateGetFileDefaultResponse + | DeviceUpdateListOperationStatusesDefaultResponse + | DeviceUpdateGetOperationStatusDefaultResponse + | DeviceManagementListDeviceClassesDefaultResponse + | DeviceManagementGetDeviceClassDefaultResponse + | DeviceManagementUpdateDeviceClassDefaultResponse + | DeviceManagementDeleteDeviceClassDefaultResponse + | DeviceManagementListInstallableUpdatesForDeviceClassDefaultResponse + | DeviceManagementListDevicesDefaultResponse + | DeviceManagementImportDevicesDefaultResponse + | DeviceManagementGetDeviceDefaultResponse + | DeviceManagementGetDeviceModuleDefaultResponse + | DeviceManagementGetUpdateComplianceDefaultResponse + | DeviceManagementListGroupsDefaultResponse + | DeviceManagementGetGroupDefaultResponse + | DeviceManagementDeleteGroupDefaultResponse + | DeviceManagementGetUpdateComplianceForGroupDefaultResponse + | DeviceManagementListBestUpdatesForGroupDefaultResponse + | DeviceManagementListDeploymentsForGroupDefaultResponse + | DeviceManagementGetDeploymentDefaultResponse + | DeviceManagementCreateOrUpdateDeploymentDefaultResponse + | DeviceManagementDeleteDeploymentDefaultResponse + | DeviceManagementGetDeploymentStatusDefaultResponse + | DeviceManagementListDeviceClassSubgroupsForGroupDefaultResponse + | DeviceManagementGetDeviceClassSubgroupDefaultResponse + | DeviceManagementDeleteDeviceClassSubgroupDefaultResponse + | DeviceManagementGetDeviceClassSubgroupUpdateComplianceDefaultResponse + | DeviceManagementGetBestUpdatesForDeviceClassSubgroupDefaultResponse + | DeviceManagementListDeploymentsForDeviceClassSubgroupDefaultResponse + | DeviceManagementGetDeploymentForDeviceClassSubgroupDefaultResponse + | DeviceManagementDeleteDeploymentForDeviceClassSubgroupDefaultResponse + | DeviceManagementStopDeploymentDefaultResponse + | DeviceManagementRetryDeploymentDefaultResponse + | DeviceManagementGetDeviceClassSubgroupDeploymentStatusDefaultResponse + | DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentDefaultResponse + | DeviceManagementGetOperationStatusDefaultResponse + | DeviceManagementListOperationStatusesDefaultResponse + | DeviceManagementStartLogCollectionDefaultResponse + | DeviceManagementGetLogCollectionDefaultResponse + | DeviceManagementListLogCollectionsDefaultResponse + | DeviceManagementGetLogCollectionDetailedStatusDefaultResponse + | DeviceManagementListHealthOfDevicesDefaultResponse { const lroOriginal = response.headers["x-ms-original-url"]; const url = new URL(lroOriginal ?? response.request.url); const method = response.request.method; let pathDetails = responseMap[`${method} ${url.pathname}`]; if (!pathDetails) { - pathDetails = geParametrizedPathSuccess(url.pathname); + pathDetails = getParametrizedPathSuccess(method, url.pathname); } return !pathDetails.includes(response.status); } -function geParametrizedPathSuccess(path: string): string[] { +function getParametrizedPathSuccess(method: string, path: string): string[] { const pathParts = path.split("/"); + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: string[] = []; + // Iterate the responseMap to find a match for (const [key, value] of Object.entries(responseMap)) { // Extracting the path from the map key which is in format // GET /path/foo + if (!key.startsWith(method)) { + continue; + } const candidatePath = getPathFromMapKey(key); // Get each part of the url path const candidateParts = candidatePath.split("/"); - // If the candidate and actual paths don't match in size - // we move on to the next candidate path - if (candidateParts.length === pathParts.length && hasParametrizedPath(key)) { - // track if we have found a match to return the values found. - let found = true; - for (let i = 0; i < candidateParts.length; i++) { - if (candidateParts[i].startsWith("{") && candidateParts[i].endsWith("}")) { - // If the current part of the candidate is a "template" part - // it is a match with the actual path part on hand - // skip as the parameterized part can match anything - continue; - } + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); - // If the candidate part is not a template and - // the parts don't match mark the candidate as not found - // to move on with the next candidate path. - if (candidateParts[i] !== pathParts[i]) { + if (!isMatched) { found = false; break; } + continue; } - // We finished evaluating the current candidate parts - // if all parts matched we return the success values form - // the path mapping. - if (found) { - return value; + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; } } - } - // No match was found, return an empty array. - return []; -} + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } -function hasParametrizedPath(path: string): boolean { - return path.includes("/{"); + return matchedValue; } function getPathFromMapKey(mapKey: string): string { diff --git a/sdk/deviceupdate/iot-device-update-rest/src/logger.ts b/sdk/deviceupdate/iot-device-update-rest/src/logger.ts new file mode 100644 index 000000000000..b906c8113cf8 --- /dev/null +++ b/sdk/deviceupdate/iot-device-update-rest/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("iot-device-update"); diff --git a/sdk/deviceupdate/iot-device-update-rest/src/models.ts b/sdk/deviceupdate/iot-device-update-rest/src/models.ts index e8811a006368..d947cd7ae09f 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/models.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/models.ts @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. +// Licensed under the MIT license. +/** Update identifier. */ export interface UpdateId { /** Update provider. */ provider: string; @@ -10,6 +11,7 @@ export interface UpdateId { version: string; } +/** Import update input item metadata. */ export interface ImportUpdateInputItem { /** Import manifest metadata like source URL, file size/hashes, etc. */ importManifest: ImportManifestMetadata; @@ -19,6 +21,7 @@ export interface ImportUpdateInputItem { files?: Array; } +/** 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; @@ -28,6 +31,7 @@ export interface ImportManifestMetadata { hashes: Record; } +/** Metadata describing an update file. */ export interface FileImportMetadata { /** Update file name as specified inside import manifest. */ filename: string; @@ -35,20 +39,19 @@ export interface FileImportMetadata { url: string; } +/** Update information. */ export interface UpdateInfo { /** Update identifier. */ updateId: UpdateId; - /** Update description. */ - description?: string; - /** Friendly update name. */ - friendlyName?: string; } +/** Device Class JSON Merge Patch request body */ export interface PatchBody { /** The device class friendly name. Friendly name can be 1-100 characters, alphanumeric, dot, and dash. */ friendlyName: string; } +/** Deployment metadata. */ export interface Deployment { /** The caller-provided deployment identifier. This cannot be longer than 73 characters, must be all lower-case, and cannot contain '&', '^', '[', ']', '{', '}', '|', '<', '>', forward slash, backslash, or double quote. The Updates view in the Azure Portal IoT Hub resource generates a GUID for deploymentId when you create a deployment. */ deploymentId: string; @@ -70,6 +73,7 @@ export interface Deployment { isCloudInitiatedRollback?: boolean; } +/** Rollback policy for deployment */ export interface CloudInitiatedRollbackPolicy { /** Update to rollback to. */ update: UpdateInfo; @@ -77,6 +81,7 @@ export interface CloudInitiatedRollbackPolicy { failure: CloudInitiatedRollbackPolicyFailure; } +/** Failure conditions to initiate rollback policy */ export interface CloudInitiatedRollbackPolicyFailure { /** Percentage of devices that failed. */ devicesFailedPercentage: number; @@ -84,6 +89,7 @@ export interface CloudInitiatedRollbackPolicyFailure { devicesFailedCount: number; } +/** Diagnostics request body */ export interface LogCollection { /** The log collection id. */ operationId?: string; @@ -91,14 +97,9 @@ export interface LogCollection { deviceList: Array; /** Description of the diagnostics operation. */ description?: string; - /** The timestamp when the operation was created. */ - createdDateTime?: string; - /** A timestamp for when the current state was entered. */ - lastActionDateTime?: string; - /** Operation status. */ - status?: "NotStarted" | "Running" | "Succeeded" | "Failed"; } +/** Device Update agent id */ export interface DeviceUpdateAgentId { /** Device Id */ deviceId: string; diff --git a/sdk/deviceupdate/iot-device-update-rest/src/outputModels.ts b/sdk/deviceupdate/iot-device-update-rest/src/outputModels.ts index 0aa6f7ec8a65..7bc43df6a374 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/outputModels.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/outputModels.ts @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. +// Licensed under the MIT license. +/** The list of updates. */ export interface UpdateListOutput { /** The collection of pageable items. */ value: Array; @@ -8,6 +9,7 @@ export interface UpdateListOutput { nextLink?: string; } +/** Update metadata. */ export interface UpdateOutput { /** Update identity. */ updateId: UpdateIdOutput; @@ -39,6 +41,7 @@ export interface UpdateOutput { etag?: string; } +/** Update identifier. */ export interface UpdateIdOutput { /** Update provider. */ provider: string; @@ -53,6 +56,7 @@ export interface InstructionsOutput { steps: Array; } +/** Update install instruction step. */ export interface StepOutput { /** Step type. */ type?: "Inline" | "Reference"; @@ -68,11 +72,13 @@ export interface StepOutput { updateId?: UpdateIdOutput; } +/** Common error response. */ export interface ErrorResponseOutput { /** The error details. */ error: ErrorModelOutput; } +/** Error details. */ export interface ErrorModelOutput { /** Server defined error code. */ code: string; @@ -88,6 +94,7 @@ export interface ErrorModelOutput { occurredDateTime?: string; } +/** An object containing more specific information than the current object about the error. */ export interface InnerErrorOutput { /** A more specific error code than what was provided by the containing error. */ code: string; @@ -99,6 +106,7 @@ export interface InnerErrorOutput { innerError?: InnerErrorOutput; } +/** The list of strings with server paging support. */ export interface StringsListOutput { /** The collection of pageable items. */ value: Array; @@ -106,6 +114,7 @@ export interface StringsListOutput { nextLink?: string; } +/** Update file metadata. */ export interface UpdateFileOutput extends UpdateFileBaseOutput { /** File identity, generated by server at import time. */ fileId: string; @@ -117,6 +126,7 @@ export interface UpdateFileOutput extends UpdateFileBaseOutput { etag?: string; } +/** Update file basic metadata. */ export interface UpdateFileBaseOutput { /** File name. */ fileName: string; @@ -134,11 +144,13 @@ export interface UpdateFileBaseOutput { properties?: Record; } +/** Download handler for utilizing related files to download payload file. */ export interface UpdateFileDownloadHandlerOutput { /** Download handler identifier. */ id: string; } +/** The list of operations with server paging support. */ export interface UpdateOperationsListOutput { /** The collection of pageable items. */ value: Array; @@ -146,6 +158,7 @@ export interface UpdateOperationsListOutput { nextLink?: string; } +/** Operation metadata. */ export interface UpdateOperationOutput { /** Operation Id. */ operationId: string; @@ -167,15 +180,17 @@ export interface UpdateOperationOutput { etag?: string; } +/** Update information. */ export interface UpdateInfoOutput { /** Update identifier. */ updateId: UpdateIdOutput; /** Update description. */ - description?: string; + readonly description?: string; /** Friendly update name. */ - friendlyName?: string; + readonly friendlyName?: string; } +/** The list of device classes. */ export interface DeviceClassesListOutput { /** The collection of pageable items. */ value: Array; @@ -183,6 +198,7 @@ export interface DeviceClassesListOutput { nextLink?: string; } +/** Device class metadata. */ export interface DeviceClassOutput { /** The device class identifier. This is generated from the model Id and the compat properties reported by the device update agent in the Device Update PnP interface in IoT Hub. It is a hex-encoded SHA1 hash. */ deviceClassId: string; @@ -194,6 +210,7 @@ export interface DeviceClassOutput { bestCompatibleUpdate?: UpdateInfoOutput; } +/** The device class properties that are used to calculate the device class Id */ export interface DeviceClassPropertiesOutput { /** The Device Update agent contract model. */ contractModel?: ContractModelOutput; @@ -201,6 +218,7 @@ export interface DeviceClassPropertiesOutput { compatProperties: Record; } +/** The Device Update agent contract model. */ export interface ContractModelOutput { /** The Device Update agent contract model Id of the device class. This is also used to calculate the device class Id. */ id: string; @@ -208,6 +226,7 @@ export interface ContractModelOutput { name: string; } +/** List of update information. */ export interface UpdateInfoListOutput { /** The collection of pageable items. */ value: Array; @@ -215,6 +234,7 @@ export interface UpdateInfoListOutput { nextLink?: string; } +/** The list of devices. */ export interface DevicesListOutput { /** The collection of pageable items. */ value: Array; @@ -222,6 +242,7 @@ export interface DevicesListOutput { nextLink?: string; } +/** Device metadata. */ export interface DeviceOutput { /** Device identity. */ deviceId: string; @@ -245,6 +266,7 @@ export interface DeviceOutput { lastInstallResult?: InstallResultOutput; } +/** The install result of an update and any step results under it. */ export interface InstallResultOutput { /** Install result code. */ resultCode: number; @@ -256,6 +278,7 @@ export interface InstallResultOutput { stepResults?: Array; } +/** The step result under an update. */ export interface StepResultOutput { /** The update that this step installs if it is of reference type. */ update?: UpdateInfoOutput; @@ -269,6 +292,7 @@ export interface StepResultOutput { resultDetails?: string; } +/** Update compliance information. */ export interface UpdateComplianceOutput { /** Total number of devices. */ totalDeviceCount: number; @@ -280,6 +304,7 @@ export interface UpdateComplianceOutput { updatesInProgressDeviceCount: number; } +/** The list of groups. */ export interface GroupsListOutput { /** The collection of pageable items. */ value: Array; @@ -287,6 +312,7 @@ export interface GroupsListOutput { nextLink?: string; } +/** Group details. */ export interface GroupOutput { /** Group identity. This is created from the value of the ADUGroup tag in the Iot Hub's device/module twin or $default for devices with no tag. */ groupId: string; @@ -306,6 +332,7 @@ export interface GroupOutput { deployments?: Array; } +/** The list of updatable devices for a device class subgroup. */ export interface DeviceClassSubgroupUpdatableDevicesListOutput { /** The collection of pageable items. */ value: Array; @@ -313,6 +340,7 @@ export interface DeviceClassSubgroupUpdatableDevicesListOutput { nextLink?: string; } +/** Device class subgroup, update information, and the number of devices for which the update is applicable. */ export interface DeviceClassSubgroupUpdatableDevicesOutput { /** The group Id */ groupId: string; @@ -324,6 +352,7 @@ export interface DeviceClassSubgroupUpdatableDevicesOutput { deviceCount: number; } +/** The list of deployments. */ export interface DeploymentsListOutput { /** The collection of pageable items. */ value: Array; @@ -331,6 +360,7 @@ export interface DeploymentsListOutput { nextLink?: string; } +/** Deployment metadata. */ export interface DeploymentOutput { /** The caller-provided deployment identifier. This cannot be longer than 73 characters, must be all lower-case, and cannot contain '&', '^', '[', ']', '{', '}', '|', '<', '>', forward slash, backslash, or double quote. The Updates view in the Azure Portal IoT Hub resource generates a GUID for deploymentId when you create a deployment. */ deploymentId: string; @@ -352,6 +382,7 @@ export interface DeploymentOutput { isCloudInitiatedRollback?: boolean; } +/** Rollback policy for deployment */ export interface CloudInitiatedRollbackPolicyOutput { /** Update to rollback to. */ update: UpdateInfoOutput; @@ -359,6 +390,7 @@ export interface CloudInitiatedRollbackPolicyOutput { failure: CloudInitiatedRollbackPolicyFailureOutput; } +/** Failure conditions to initiate rollback policy */ export interface CloudInitiatedRollbackPolicyFailureOutput { /** Percentage of devices that failed. */ devicesFailedPercentage: number; @@ -366,6 +398,7 @@ export interface CloudInitiatedRollbackPolicyFailureOutput { devicesFailedCount: number; } +/** Deployment status metadata. */ export interface DeploymentStatusOutput { /** The group identity */ groupId: string; @@ -377,6 +410,7 @@ export interface DeploymentStatusOutput { subgroupStatus: Array; } +/** Device class subgroup deployment status metadata. */ export interface DeviceClassSubgroupDeploymentStatusOutput { /** The group identity */ groupId: string; @@ -398,6 +432,7 @@ export interface DeviceClassSubgroupDeploymentStatusOutput { devicesCanceledCount?: number; } +/** The list of device class subgroups within a group. */ export interface DeviceClassSubgroupsListOutput { /** The collection of pageable items. */ value: Array; @@ -405,6 +440,7 @@ export interface DeviceClassSubgroupsListOutput { nextLink?: string; } +/** Device class subgroup details. A device class subgroup is a subset of devices in a group that share the same device class id. */ export interface DeviceClassSubgroupOutput { /** Device class subgroup identity. This is generated from the model Id and the compat properties reported by the device update agent in the Device Update PnP interface in IoT Hub. It is a hex-encoded SHA1 hash. */ deviceClassId: string; @@ -418,6 +454,7 @@ export interface DeviceClassSubgroupOutput { deploymentId?: string; } +/** The list of deployment device states. */ export interface DeploymentDeviceStatesListOutput { /** The collection of pageable items. */ value: Array; @@ -425,6 +462,7 @@ export interface DeploymentDeviceStatesListOutput { nextLink?: string; } +/** Deployment device status. */ export interface DeploymentDeviceStateOutput { /** Device identity. */ deviceId: string; @@ -438,6 +476,7 @@ export interface DeploymentDeviceStateOutput { deviceState: "Succeeded" | "InProgress" | "Canceled" | "Failed"; } +/** Operation metadata. */ export interface DeviceOperationOutput { /** Operation Id. */ operationId: string; @@ -455,6 +494,7 @@ export interface DeviceOperationOutput { etag?: string; } +/** The list of device operations with server paging support. */ export interface DeviceOperationsListOutput { /** The collection of pageable items. */ value: Array; @@ -462,6 +502,7 @@ export interface DeviceOperationsListOutput { nextLink?: string; } +/** Diagnostics request body */ export interface LogCollectionOutput { /** The log collection id. */ operationId?: string; @@ -470,13 +511,14 @@ export interface LogCollectionOutput { /** Description of the diagnostics operation. */ description?: string; /** The timestamp when the operation was created. */ - createdDateTime?: string; + readonly createdDateTime?: string; /** A timestamp for when the current state was entered. */ - lastActionDateTime?: string; + readonly lastActionDateTime?: string; /** Operation status. */ - status?: "NotStarted" | "Running" | "Succeeded" | "Failed"; + readonly status?: "NotStarted" | "Running" | "Succeeded" | "Failed"; } +/** Device Update agent id */ export interface DeviceUpdateAgentIdOutput { /** Device Id */ deviceId: string; @@ -484,6 +526,7 @@ export interface DeviceUpdateAgentIdOutput { moduleId?: string; } +/** The list of log collections with server paging support. */ export interface LogCollectionListOutput { /** The collection of pageable items. */ value: Array; @@ -491,6 +534,7 @@ export interface LogCollectionListOutput { nextLink?: string; } +/** Device diagnostics operation detailed status */ export interface LogCollectionOperationDetailedStatusOutput { /** The device diagnostics operation id. */ operationId?: string; @@ -506,6 +550,7 @@ export interface LogCollectionOperationDetailedStatusOutput { description?: string; } +/** Diagnostics operation device status */ export interface LogCollectionOperationDeviceStatusOutput { /** Device id */ deviceId: string; @@ -521,6 +566,7 @@ export interface LogCollectionOperationDeviceStatusOutput { logLocation?: string; } +/** Array of Device Health, with server paging support. */ export interface DeviceHealthListOutput { /** The collection of pageable items. */ value: Array; @@ -528,6 +574,7 @@ export interface DeviceHealthListOutput { nextLink?: string; } +/** Device Health */ export interface DeviceHealthOutput { /** Device id */ deviceId: string; @@ -541,6 +588,7 @@ export interface DeviceHealthOutput { healthChecks: Array; } +/** Health check */ export interface HealthCheckOutput { /** Health check name */ name?: string; diff --git a/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts b/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts index e27846d32a90..f0d91c952cda 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. +// Licensed under the MIT license. import { getPagedAsyncIterator, PagedAsyncIterableIterator, PagedResult } from "@azure/core-paging"; import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client"; diff --git a/sdk/deviceupdate/iot-device-update-rest/src/parameters.ts b/sdk/deviceupdate/iot-device-update-rest/src/parameters.ts index 4a67d6e8976a..ed862f15b46b 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/parameters.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/parameters.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. +// Licensed under the MIT license. import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; import { RequestParameters } from "@azure-rest/core-client"; @@ -39,7 +39,7 @@ export interface DeviceUpdateGetUpdateHeaders { } export interface DeviceUpdateGetUpdateHeaderParam { - headers: RawHttpHeadersInput & DeviceUpdateGetUpdateHeaders; + headers?: RawHttpHeadersInput & DeviceUpdateGetUpdateHeaders; } export type DeviceUpdateGetUpdateParameters = DeviceUpdateGetUpdateHeaderParam & RequestParameters; @@ -66,7 +66,7 @@ export interface DeviceUpdateGetFileHeaders { } export interface DeviceUpdateGetFileHeaderParam { - headers: RawHttpHeadersInput & DeviceUpdateGetFileHeaders; + headers?: RawHttpHeadersInput & DeviceUpdateGetFileHeaders; } export type DeviceUpdateGetFileParameters = DeviceUpdateGetFileHeaderParam & RequestParameters; @@ -91,7 +91,7 @@ export interface DeviceUpdateGetOperationStatusHeaders { } export interface DeviceUpdateGetOperationStatusHeaderParam { - headers: RawHttpHeadersInput & DeviceUpdateGetOperationStatusHeaders; + headers?: RawHttpHeadersInput & DeviceUpdateGetOperationStatusHeaders; } export type DeviceUpdateGetOperationStatusParameters = DeviceUpdateGetOperationStatusHeaderParam & @@ -109,10 +109,12 @@ export interface DeviceManagementListDeviceClassesQueryParam { export type DeviceManagementListDeviceClassesParameters = DeviceManagementListDeviceClassesQueryParam & RequestParameters; export type DeviceManagementGetDeviceClassParameters = RequestParameters; +/** The device class json merge patch body. Currently only supports patching friendlyName. */ +export type PatchBodyResourceMergeAndPatch = Partial; export interface DeviceManagementUpdateDeviceClassBodyParam { /** The device class json merge patch body. Currently only supports patching friendlyName. */ - body: PatchBody; + body: PatchBodyResourceMergeAndPatch; } export interface DeviceManagementUpdateDeviceClassMediaTypesParam { @@ -253,7 +255,7 @@ export interface DeviceManagementGetOperationStatusHeaders { } export interface DeviceManagementGetOperationStatusHeaderParam { - headers: RawHttpHeadersInput & DeviceManagementGetOperationStatusHeaders; + headers?: RawHttpHeadersInput & DeviceManagementGetOperationStatusHeaders; } export type DeviceManagementGetOperationStatusParameters = diff --git a/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts b/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts index 31ecd85a0307..65fb8e1eb40f 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts @@ -1,16 +1,83 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. +// Licensed under the MIT license. import { Client, HttpResponse } from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; import { - LongRunningOperation, - LroEngine, - LroEngineOptions, - LroResponse, - PollerLike, - PollOperationState, + CancelOnProgress, + CreateHttpPollerOptions, + RunningOperation, + OperationResponse, + OperationState, + createHttpPoller, } from "@azure/core-lro"; +/** + * A simple poller that can be used to poll a long running operation. + */ +export interface SimplePollerLike, TResult> { + /** + * Returns true if the poller has finished polling. + */ + isDone(): boolean; + /** + * Returns the state of the operation. + */ + getOperationState(): TState; + /** + * Returns the result value of the operation, + * regardless of the state of the poller. + * It can return undefined or an incomplete form of the final TResult value + * depending on the implementation. + */ + getResult(): TResult | undefined; + /** + * Returns a promise that will resolve once a single polling request finishes. + * It does this by calling the update method of the Poller's operation. + */ + poll(options?: { abortSignal?: AbortSignalLike }): Promise; + /** + * Returns a promise that will resolve once the underlying operation is completed. + */ + pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise; + /** + * Invokes the provided callback after each polling is completed, + * sending the current state of the poller's operation. + * + * It returns a method that can be used to stop receiving updates on the given callback function. + */ + onProgress(callback: (state: TState) => void): CancelOnProgress; + + /** + * Returns a promise that could be used for serialized version of the poller's operation + * by invoking the operation's serialize method. + */ + serialize(): Promise; + + /** + * Wait the poller to be submitted. + */ + submitted(): Promise; + + /** + * Returns a string representation of the poller's operation. Similar to serialize but returns a string. + * @deprecated Use serialize() instead. + */ + toString(): string; + + /** + * Stops the poller from continuing to poll. Please note this will only stop the client-side polling + * @deprecated Use abortSignal to stop polling instead. + */ + stopPolling(): void; + + /** + * Returns true if the poller is stopped. + * @deprecated Use abortSignal status to track this instead. + */ + isStopped(): boolean; +} + /** * Helper function that builds a Poller object to help polling a long running operation. * @param client - Client to use for sending the request to get additional pages. @@ -18,41 +85,100 @@ import { * @param options - Options to set a resume state or custom polling interval. * @returns - A poller object to poll for operation state updates and eventually get the final response. */ -export function getLongRunningPoller( +export async function getLongRunningPoller( client: Client, initialResponse: TResult, - options: LroEngineOptions> = {}, -): PollerLike, TResult> { - const poller: LongRunningOperation = { - requestMethod: initialResponse.request.method, - requestPath: initialResponse.request.url, + options: CreateHttpPollerOptions> = {}, +): Promise, TResult>> { + const abortController = new AbortController(); + const poller: RunningOperation = { sendInitialRequest: async () => { // In the case of Rest Clients we are building the LRO poller object from a response that's the reason // we are not triggering the initial request here, just extracting the information from the // response we were provided. return getLroResponse(initialResponse); }, - sendPollRequest: async (path) => { + sendPollRequest: async (path: string, pollOptions?: { abortSignal?: AbortSignalLike }) => { // This is the callback that is going to be called to poll the service // to get the latest status. We use the client provided and the polling path // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location // depending on the lro pattern that the service implements. If non is provided we default to the initial path. - const response = await client.pathUnchecked(path ?? initialResponse.request.url).get(); + function abortListener(): void { + abortController.abort(); + } + const inputAbortSignal = pollOptions?.abortSignal; + const abortSignal = abortController.signal; + if (inputAbortSignal?.aborted) { + abortController.abort(); + } else if (!abortSignal.aborted) { + inputAbortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + response = await client + .pathUnchecked(path ?? initialResponse.request.url) + .get({ abortSignal }); + } finally { + inputAbortSignal?.removeEventListener("abort", abortListener); + } const lroResponse = getLroResponse(response as TResult); lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url; return lroResponse; }, }; - return new LroEngine(poller, options); + options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true; + const httpPoller = createHttpPoller(poller, options); + const simplePoller: SimplePollerLike, TResult> = { + isDone() { + return httpPoller.isDone; + }, + isStopped() { + return abortController.signal.aborted; + }, + getOperationState() { + if (!httpPoller.operationState) { + throw new Error( + "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", + ); + } + return httpPoller.operationState; + }, + getResult() { + return httpPoller.result; + }, + toString() { + if (!httpPoller.operationState) { + throw new Error( + "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", + ); + } + return JSON.stringify({ + state: httpPoller.operationState, + }); + }, + stopPolling() { + abortController.abort(); + }, + onProgress: httpPoller.onProgress, + poll: httpPoller.poll, + pollUntilDone: httpPoller.pollUntilDone, + serialize: httpPoller.serialize, + submitted: httpPoller.submitted, + }; + return simplePoller; } /** - * Converts a Rest Client response to a response that the LRO engine knows about + * Converts a Rest Client response to a response that the LRO implementation understands * @param response - a rest client http response - * @returns - An LRO response that the LRO engine can work with + * @returns - An LRO response that the LRO implementation understands */ -function getLroResponse(response: TResult): LroResponse { +function getLroResponse( + response: TResult, +): OperationResponse { if (Number.isNaN(response.status)) { throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`); } diff --git a/sdk/deviceupdate/iot-device-update-rest/src/responses.ts b/sdk/deviceupdate/iot-device-update-rest/src/responses.ts index b882610a0777..f218250ba2a4 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/responses.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/responses.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. +// Licensed under the MIT license. import { RawHttpHeaders } from "@azure/core-rest-pipeline"; import { HttpResponse } from "@azure-rest/core-client"; @@ -43,7 +43,7 @@ export interface DeviceUpdateListUpdates200Response extends HttpResponse { } /** Get a list of all updates that have been imported to Device Update for IoT Hub. */ -export interface DeviceUpdateListUpdatesdefaultResponse extends HttpResponse { +export interface DeviceUpdateListUpdatesDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -62,12 +62,11 @@ export interface DeviceUpdateImportUpdate202Headers { /** Import new update version. This is a long-running-operation; use Operation-Location response header value to check for operation status. */ export interface DeviceUpdateImportUpdate202Response extends HttpResponse { status: "202"; - body: Record; headers: RawHttpHeaders & DeviceUpdateImportUpdate202Headers; } /** Import new update version. This is a long-running-operation; use Operation-Location response header value to check for operation status. */ -export interface DeviceUpdateImportUpdatedefaultResponse extends HttpResponse { +export interface DeviceUpdateImportUpdateDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -81,11 +80,10 @@ export interface DeviceUpdateGetUpdate200Response extends HttpResponse { /** Get a specific update version. */ export interface DeviceUpdateGetUpdate304Response extends HttpResponse { status: "304"; - body: Record; } /** Get a specific update version. */ -export interface DeviceUpdateGetUpdatedefaultResponse extends HttpResponse { +export interface DeviceUpdateGetUpdateDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -98,12 +96,11 @@ export interface DeviceUpdateDeleteUpdate202Headers { /** Delete a specific update version. This is a long-running-operation; use Operation-Location response header value to check for operation status. */ export interface DeviceUpdateDeleteUpdate202Response extends HttpResponse { status: "202"; - body: Record; headers: RawHttpHeaders & DeviceUpdateDeleteUpdate202Headers; } /** Delete a specific update version. This is a long-running-operation; use Operation-Location response header value to check for operation status. */ -export interface DeviceUpdateDeleteUpdatedefaultResponse extends HttpResponse { +export interface DeviceUpdateDeleteUpdateDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -115,7 +112,7 @@ export interface DeviceUpdateListProviders200Response extends HttpResponse { } /** Get a list of all update providers that have been imported to Device Update for IoT Hub. */ -export interface DeviceUpdateListProvidersdefaultResponse extends HttpResponse { +export interface DeviceUpdateListProvidersDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -127,7 +124,7 @@ export interface DeviceUpdateListNames200Response extends HttpResponse { } /** Get a list of all update names that match the specified provider. */ -export interface DeviceUpdateListNamesdefaultResponse extends HttpResponse { +export interface DeviceUpdateListNamesDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -139,7 +136,7 @@ export interface DeviceUpdateListVersions200Response extends HttpResponse { } /** Get a list of all update versions that match the specified provider and name. */ -export interface DeviceUpdateListVersionsdefaultResponse extends HttpResponse { +export interface DeviceUpdateListVersionsDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -151,7 +148,7 @@ export interface DeviceUpdateListFiles200Response extends HttpResponse { } /** Get a list of all update file identifiers for the specified version. */ -export interface DeviceUpdateListFilesdefaultResponse extends HttpResponse { +export interface DeviceUpdateListFilesDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -165,11 +162,10 @@ export interface DeviceUpdateGetFile200Response extends HttpResponse { /** Get a specific update file from the version. */ export interface DeviceUpdateGetFile304Response extends HttpResponse { status: "304"; - body: Record; } /** Get a specific update file from the version. */ -export interface DeviceUpdateGetFiledefaultResponse extends HttpResponse { +export interface DeviceUpdateGetFileDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -181,7 +177,7 @@ export interface DeviceUpdateListOperationStatuses200Response extends HttpRespon } /** 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. */ -export interface DeviceUpdateListOperationStatusesdefaultResponse extends HttpResponse { +export interface DeviceUpdateListOperationStatusesDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -201,11 +197,10 @@ export interface DeviceUpdateGetOperationStatus200Response extends HttpResponse /** Retrieve operation status. */ export interface DeviceUpdateGetOperationStatus304Response extends HttpResponse { status: "304"; - body: Record; } /** Retrieve operation status. */ -export interface DeviceUpdateGetOperationStatusdefaultResponse extends HttpResponse { +export interface DeviceUpdateGetOperationStatusDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -217,7 +212,7 @@ export interface DeviceManagementListDeviceClasses200Response extends HttpRespon } /** Gets a list of all device classes (sets of devices compatible with the same updates based on the model Id and compat properties reported in the Device Update PnP interface in IoT Hub) for all devices connected to Device Update for IoT Hub. */ -export interface DeviceManagementListDeviceClassesdefaultResponse extends HttpResponse { +export interface DeviceManagementListDeviceClassesDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -229,7 +224,7 @@ export interface DeviceManagementGetDeviceClass200Response extends HttpResponse } /** Gets the properties of a device class. */ -export interface DeviceManagementGetDeviceClassdefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeviceClassDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -241,7 +236,7 @@ export interface DeviceManagementUpdateDeviceClass200Response extends HttpRespon } /** Update device class details. */ -export interface DeviceManagementUpdateDeviceClassdefaultResponse extends HttpResponse { +export interface DeviceManagementUpdateDeviceClassDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -249,11 +244,10 @@ export interface DeviceManagementUpdateDeviceClassdefaultResponse extends HttpRe /** Deletes a device class. Device classes are created automatically when Device Update-enabled devices are connected to the hub but are not automatically cleaned up since they are referenced by DeviceClassSubgroups. If the user has deleted all DeviceClassSubgroups for a device class they can also delete the device class to remove the records from the system and to stop checking the compatibility of this device class with new updates. If a device is ever reconnected for this device class it will be re-created. */ export interface DeviceManagementDeleteDeviceClass204Response extends HttpResponse { status: "204"; - body: Record; } /** Deletes a device class. Device classes are created automatically when Device Update-enabled devices are connected to the hub but are not automatically cleaned up since they are referenced by DeviceClassSubgroups. If the user has deleted all DeviceClassSubgroups for a device class they can also delete the device class to remove the records from the system and to stop checking the compatibility of this device class with new updates. If a device is ever reconnected for this device class it will be re-created. */ -export interface DeviceManagementDeleteDeviceClassdefaultResponse extends HttpResponse { +export interface DeviceManagementDeleteDeviceClassDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -266,7 +260,7 @@ export interface DeviceManagementListInstallableUpdatesForDeviceClass200Response } /** Gets a list of installable updates for a device class. */ -export interface DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse +export interface DeviceManagementListInstallableUpdatesForDeviceClassDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; @@ -279,7 +273,7 @@ export interface DeviceManagementListDevices200Response extends HttpResponse { } /** Gets a list of devices connected to Device Update for IoT Hub. */ -export interface DeviceManagementListDevicesdefaultResponse extends HttpResponse { +export interface DeviceManagementListDevicesDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -292,12 +286,11 @@ export interface DeviceManagementImportDevices202Headers { /** Import existing devices from IoT Hub. This is a long-running-operation; use Operation-Location response header value to check for operation status. */ export interface DeviceManagementImportDevices202Response extends HttpResponse { status: "202"; - body: Record; headers: RawHttpHeaders & DeviceManagementImportDevices202Headers; } /** Import existing devices from IoT Hub. This is a long-running-operation; use Operation-Location response header value to check for operation status. */ -export interface DeviceManagementImportDevicesdefaultResponse extends HttpResponse { +export interface DeviceManagementImportDevicesDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -309,7 +302,7 @@ export interface DeviceManagementGetDevice200Response extends HttpResponse { } /** Gets the device properties and latest deployment status for a device connected to Device Update for IoT Hub. */ -export interface DeviceManagementGetDevicedefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeviceDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -321,7 +314,7 @@ export interface DeviceManagementGetDeviceModule200Response extends HttpResponse } /** Gets the device module properties and latest deployment status for a device module connected to Device Update for IoT Hub. */ -export interface DeviceManagementGetDeviceModuledefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeviceModuleDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -333,7 +326,7 @@ export interface DeviceManagementGetUpdateCompliance200Response extends HttpResp } /** Gets the breakdown of how many devices are on their latest update, have new updates available, or are in progress receiving new updates. */ -export interface DeviceManagementGetUpdateCompliancedefaultResponse extends HttpResponse { +export interface DeviceManagementGetUpdateComplianceDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -345,7 +338,7 @@ export interface DeviceManagementListGroups200Response extends HttpResponse { } /** Gets a list of all device groups. The $default group will always be returned first. */ -export interface DeviceManagementListGroupsdefaultResponse extends HttpResponse { +export interface DeviceManagementListGroupsDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -357,7 +350,7 @@ export interface DeviceManagementGetGroup200Response extends HttpResponse { } /** Gets the device group properties. */ -export interface DeviceManagementGetGroupdefaultResponse extends HttpResponse { +export interface DeviceManagementGetGroupDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -365,11 +358,10 @@ export interface DeviceManagementGetGroupdefaultResponse extends HttpResponse { /** Deletes a device group. This group is automatically created when a Device Update-enabled device is connected to the hub and reports its properties. Groups, subgroups, and deployments are not automatically cleaned up but are retained for history purposes. Users can call this method to delete a group if they do not need to retain any of the history of the group and no longer need it. If a device is ever connected again for this group after the group was deleted it will be automatically re-created but there will be no history. */ export interface DeviceManagementDeleteGroup204Response extends HttpResponse { status: "204"; - body: Record; } /** Deletes a device group. This group is automatically created when a Device Update-enabled device is connected to the hub and reports its properties. Groups, subgroups, and deployments are not automatically cleaned up but are retained for history purposes. Users can call this method to delete a group if they do not need to retain any of the history of the group and no longer need it. If a device is ever connected again for this group after the group was deleted it will be automatically re-created but there will be no history. */ -export interface DeviceManagementDeleteGroupdefaultResponse extends HttpResponse { +export interface DeviceManagementDeleteGroupDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -381,7 +373,7 @@ export interface DeviceManagementGetUpdateComplianceForGroup200Response extends } /** 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. */ -export interface DeviceManagementGetUpdateComplianceForGroupdefaultResponse extends HttpResponse { +export interface DeviceManagementGetUpdateComplianceForGroupDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -393,7 +385,7 @@ export interface DeviceManagementListBestUpdatesForGroup200Response extends Http } /** Get the best available updates for a device group and a count of how many devices need each update. */ -export interface DeviceManagementListBestUpdatesForGroupdefaultResponse extends HttpResponse { +export interface DeviceManagementListBestUpdatesForGroupDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -405,7 +397,7 @@ export interface DeviceManagementListDeploymentsForGroup200Response extends Http } /** Gets a list of deployments for a device group. */ -export interface DeviceManagementListDeploymentsForGroupdefaultResponse extends HttpResponse { +export interface DeviceManagementListDeploymentsForGroupDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -417,7 +409,7 @@ export interface DeviceManagementGetDeployment200Response extends HttpResponse { } /** Gets the deployment properties. */ -export interface DeviceManagementGetDeploymentdefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeploymentDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -429,7 +421,7 @@ export interface DeviceManagementCreateOrUpdateDeployment200Response extends Htt } /** Creates or updates a deployment. */ -export interface DeviceManagementCreateOrUpdateDeploymentdefaultResponse extends HttpResponse { +export interface DeviceManagementCreateOrUpdateDeploymentDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -437,11 +429,10 @@ export interface DeviceManagementCreateOrUpdateDeploymentdefaultResponse extends /** Deletes a deployment. */ export interface DeviceManagementDeleteDeployment204Response extends HttpResponse { status: "204"; - body: Record; } /** Deletes a deployment. */ -export interface DeviceManagementDeleteDeploymentdefaultResponse extends HttpResponse { +export interface DeviceManagementDeleteDeploymentDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -453,7 +444,7 @@ export interface DeviceManagementGetDeploymentStatus200Response extends HttpResp } /** Gets the status of a deployment including a breakdown of how many devices in the deployment are in progress, completed, or failed. */ -export interface DeviceManagementGetDeploymentStatusdefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeploymentStatusDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -465,7 +456,7 @@ export interface DeviceManagementListDeviceClassSubgroupsForGroup200Response ext } /** Get the device class subgroups for the group. A device class subgroup is the set of devices within the group that share the same device class. All devices within the same device class are compatible with the same updates. */ -export interface DeviceManagementListDeviceClassSubgroupsForGroupdefaultResponse +export interface DeviceManagementListDeviceClassSubgroupsForGroupDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; @@ -478,7 +469,7 @@ export interface DeviceManagementGetDeviceClassSubgroup200Response extends HttpR } /** Gets device class subgroup details. A device class subgroup is the set of devices within the group that share the same device class. All devices within the same device class are compatible with the same updates. */ -export interface DeviceManagementGetDeviceClassSubgroupdefaultResponse extends HttpResponse { +export interface DeviceManagementGetDeviceClassSubgroupDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -486,11 +477,10 @@ export interface DeviceManagementGetDeviceClassSubgroupdefaultResponse extends H /** Deletes a device class subgroup. This subgroup is automatically created when a Device Update-enabled device is connected to the hub and reports its properties. Groups, subgroups, and deployments are not automatically cleaned up but are retained for history purposes. Users can call this method to delete a subgroup if they do not need to retain any of the history of the subgroup and no longer need it. If a device is ever connected again for this subgroup after the subgroup was deleted it will be automatically re-created but there will be no history. */ export interface DeviceManagementDeleteDeviceClassSubgroup204Response extends HttpResponse { status: "204"; - body: Record; } /** Deletes a device class subgroup. This subgroup is automatically created when a Device Update-enabled device is connected to the hub and reports its properties. Groups, subgroups, and deployments are not automatically cleaned up but are retained for history purposes. Users can call this method to delete a subgroup if they do not need to retain any of the history of the subgroup and no longer need it. If a device is ever connected again for this subgroup after the subgroup was deleted it will be automatically re-created but there will be no history. */ -export interface DeviceManagementDeleteDeviceClassSubgroupdefaultResponse extends HttpResponse { +export interface DeviceManagementDeleteDeviceClassSubgroupDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -503,7 +493,7 @@ export interface DeviceManagementGetDeviceClassSubgroupUpdateCompliance200Respon } /** 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. */ -export interface DeviceManagementGetDeviceClassSubgroupUpdateCompliancedefaultResponse +export interface DeviceManagementGetDeviceClassSubgroupUpdateComplianceDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; @@ -517,7 +507,7 @@ export interface DeviceManagementGetBestUpdatesForDeviceClassSubgroup200Response } /** Get the best available update for a device class subgroup and a count of how many devices need this update. */ -export interface DeviceManagementGetBestUpdatesForDeviceClassSubgroupdefaultResponse +export interface DeviceManagementGetBestUpdatesForDeviceClassSubgroupDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; @@ -531,7 +521,7 @@ export interface DeviceManagementListDeploymentsForDeviceClassSubgroup200Respons } /** Gets a list of deployments for a device class subgroup. */ -export interface DeviceManagementListDeploymentsForDeviceClassSubgroupdefaultResponse +export interface DeviceManagementListDeploymentsForDeviceClassSubgroupDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; @@ -545,7 +535,7 @@ export interface DeviceManagementGetDeploymentForDeviceClassSubgroup200Response } /** Gets the deployment properties. */ -export interface DeviceManagementGetDeploymentForDeviceClassSubgroupdefaultResponse +export interface DeviceManagementGetDeploymentForDeviceClassSubgroupDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; @@ -555,11 +545,10 @@ export interface DeviceManagementGetDeploymentForDeviceClassSubgroupdefaultRespo export interface DeviceManagementDeleteDeploymentForDeviceClassSubgroup204Response extends HttpResponse { status: "204"; - body: Record; } /** Deletes a device class subgroup deployment. */ -export interface DeviceManagementDeleteDeploymentForDeviceClassSubgroupdefaultResponse +export interface DeviceManagementDeleteDeploymentForDeviceClassSubgroupDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; @@ -572,7 +561,7 @@ export interface DeviceManagementStopDeployment200Response extends HttpResponse } /** Stops a deployment. */ -export interface DeviceManagementStopDeploymentdefaultResponse extends HttpResponse { +export interface DeviceManagementStopDeploymentDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -584,7 +573,7 @@ export interface DeviceManagementRetryDeployment200Response extends HttpResponse } /** Retries a deployment with failed devices. */ -export interface DeviceManagementRetryDeploymentdefaultResponse extends HttpResponse { +export interface DeviceManagementRetryDeploymentDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -597,7 +586,7 @@ export interface DeviceManagementGetDeviceClassSubgroupDeploymentStatus200Respon } /** Gets the status of a deployment including a breakdown of how many devices in the deployment are in progress, completed, or failed. */ -export interface DeviceManagementGetDeviceClassSubgroupDeploymentStatusdefaultResponse +export interface DeviceManagementGetDeviceClassSubgroupDeploymentStatusDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; @@ -611,7 +600,7 @@ export interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymen } /** Gets a list of devices in a deployment along with their state. Useful for getting a list of failed devices. */ -export interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentdefaultResponse +export interface DeviceManagementListDeviceStatesForDeviceClassSubgroupDeploymentDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; @@ -632,11 +621,10 @@ export interface DeviceManagementGetOperationStatus200Response extends HttpRespo /** Retrieve operation status. */ export interface DeviceManagementGetOperationStatus304Response extends HttpResponse { status: "304"; - body: Record; } /** Retrieve operation status. */ -export interface DeviceManagementGetOperationStatusdefaultResponse extends HttpResponse { +export interface DeviceManagementGetOperationStatusDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -648,7 +636,7 @@ export interface DeviceManagementListOperationStatuses200Response extends HttpRe } /** Get a list of all device import operations. Completed operations are kept for 7 days before auto-deleted. */ -export interface DeviceManagementListOperationStatusesdefaultResponse extends HttpResponse { +export interface DeviceManagementListOperationStatusesDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -660,7 +648,7 @@ export interface DeviceManagementStartLogCollection201Response extends HttpRespo } /** Start the device diagnostics log collection on specified devices. */ -export interface DeviceManagementStartLogCollectiondefaultResponse extends HttpResponse { +export interface DeviceManagementStartLogCollectionDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -672,7 +660,7 @@ export interface DeviceManagementGetLogCollection200Response extends HttpRespons } /** Get the device diagnostics log collection */ -export interface DeviceManagementGetLogCollectiondefaultResponse extends HttpResponse { +export interface DeviceManagementGetLogCollectionDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -684,7 +672,7 @@ export interface DeviceManagementListLogCollections200Response extends HttpRespo } /** Get all device diagnostics log collections */ -export interface DeviceManagementListLogCollectionsdefaultResponse extends HttpResponse { +export interface DeviceManagementListLogCollectionsDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } @@ -696,7 +684,7 @@ export interface DeviceManagementGetLogCollectionDetailedStatus200Response exten } /** Get log collection with detailed status */ -export interface DeviceManagementGetLogCollectionDetailedStatusdefaultResponse +export interface DeviceManagementGetLogCollectionDetailedStatusDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; @@ -709,7 +697,7 @@ export interface DeviceManagementListHealthOfDevices200Response extends HttpResp } /** Get list of device health */ -export interface DeviceManagementListHealthOfDevicesdefaultResponse extends HttpResponse { +export interface DeviceManagementListHealthOfDevicesDefaultResponse extends HttpResponse { status: string; body: ErrorResponseOutput; } diff --git a/sdk/deviceupdate/iot-device-update-rest/swagger/README.md b/sdk/deviceupdate/iot-device-update-rest/swagger/README.md index e2001b44f22d..515c68d96659 100644 --- a/sdk/deviceupdate/iot-device-update-rest/swagger/README.md +++ b/sdk/deviceupdate/iot-device-update-rest/swagger/README.md @@ -5,12 +5,15 @@ ## Configuration ```yaml +flavor: azure +openapi-type: data-plane +generate-test: true package-name: "@azure-rest/iot-device-update" title: DeviceUpdate description: Iot Device Update Client generate-metadata: false license-header: MICROSOFT_MIT_NO_VERSION -output-folder: ../ +output-folder: $(typescript-sdks-folder)/sdk/deviceupdate/iot-device-update-rest source-code-folder-path: ./src input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/d7c9be23749467be1aea18f02ba2f4948a39db6a/specification/deviceupdate/data-plane/Microsoft.DeviceUpdate/stable/2022-10-01/deviceupdate.json package-version: 1.0.1 @@ -49,4 +52,3 @@ directive: "description": "The condition specified using HTTP conditional header(s) is not met." }; ``` - From 09c1460cbc9fa49078b084eadadfcb44f6eb77cc Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Wed, 4 Sep 2024 10:12:49 +0800 Subject: [PATCH 02/13] update --- .../samples-dev/deleteUpdate.ts | 4 ++-- .../samples-dev/deployUpdate.ts | 4 ++-- .../samples-dev/importUpdate.ts | 4 ++-- .../samples/v1/javascript/deleteUpdate.js | 4 ++-- .../samples/v1/javascript/deployUpdate.js | 10 +++++----- .../samples/v1/javascript/getUpdate.js | 8 ++++---- .../samples/v1/javascript/importUpdate.js | 2 +- .../samples/v1/javascript/listUpdates.js | 2 +- .../samples/v1/javascript/package.json | 5 ++--- .../samples/v1/typescript/package.json | 6 ++---- .../samples/v1/typescript/src/deleteUpdate.ts | 4 ++-- .../samples/v1/typescript/src/deployUpdate.ts | 12 ++++++------ .../samples/v1/typescript/src/getUpdate.ts | 8 ++++---- .../samples/v1/typescript/src/importUpdate.ts | 2 +- .../samples/v1/typescript/src/listUpdates.ts | 2 +- .../samples/v1/typescript/tsconfig.json | 2 +- 16 files changed, 38 insertions(+), 41 deletions(-) diff --git a/sdk/deviceupdate/iot-device-update-rest/samples-dev/deleteUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/samples-dev/deleteUpdate.ts index 83c3f7692b59..ccf209f35c01 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples-dev/deleteUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/samples-dev/deleteUpdate.ts @@ -38,8 +38,8 @@ async function main() { ) .delete(); - const poller = getLongRunningPoller(client, initialResponse); - const result = await (await poller).pollUntilDone(); + const poller = await getLongRunningPoller(client, initialResponse); + const result = await poller.pollUntilDone(); if (isUnexpected(result)) { throw result.body.error; diff --git a/sdk/deviceupdate/iot-device-update-rest/samples-dev/deployUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/samples-dev/deployUpdate.ts index bb2d429b4315..c4a288431c94 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples-dev/deployUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/samples-dev/deployUpdate.ts @@ -54,8 +54,8 @@ async function main(): Promise { }, }); - const poller = getLongRunningPoller(client, initialResponse); - const result = await (await poller).pollUntilDone(); + const poller = await getLongRunningPoller(client, initialResponse); + const result = await poller.pollUntilDone(); if (isUnexpected(result)) { throw result.body.error; diff --git a/sdk/deviceupdate/iot-device-update-rest/samples-dev/importUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/samples-dev/importUpdate.ts index 480a0605565a..692c551178b9 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples-dev/importUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/samples-dev/importUpdate.ts @@ -57,8 +57,8 @@ async function main() { ], }); - const poller = getLongRunningPoller(client, initialResponse); - const result = await (await poller).pollUntilDone(); + const poller = await getLongRunningPoller(client, initialResponse); + const result = await poller.pollUntilDone(); if (isUnexpected(result)) { throw result.body.error; diff --git a/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/deleteUpdate.js b/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/deleteUpdate.js index 57a6377845a6..f866807834bd 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/deleteUpdate.js +++ b/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/deleteUpdate.js @@ -32,11 +32,11 @@ async function main() { instanceId, updateProvider, updateName, - updateVersion + updateVersion, ) .delete(); - const poller = getLongRunningPoller(client, initialResponse); + const poller = await getLongRunningPoller(client, initialResponse); const result = await poller.pollUntilDone(); if (isUnexpected(result)) { diff --git a/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/deployUpdate.js b/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/deployUpdate.js index 1ef4c2750e78..e09485540a71 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/deployUpdate.js +++ b/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/deployUpdate.js @@ -12,7 +12,7 @@ const DeviceUpdate = require("@azure-rest/iot-device-update").default, const { DefaultAzureCredential } = require("@azure/identity"); const dotenv = require("dotenv"); -const { v4 } = require("uuid"); +const { randomUUID } = require("@azure/core-util"); dotenv.config(); @@ -29,7 +29,7 @@ async function main() { const credentials = new DefaultAzureCredential(); const client = DeviceUpdate(endpoint, credentials); - const deploymentId = v4(); + const deploymentId = randomUUID(); const startAt = new Date().toISOString(); const initialResponse = await client @@ -37,7 +37,7 @@ async function main() { "/deviceUpdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}", instanceId, groupId, - deploymentId + deploymentId, ) .put({ body: { @@ -54,7 +54,7 @@ async function main() { }, }); - const poller = getLongRunningPoller(client, initialResponse); + const poller = await getLongRunningPoller(client, initialResponse); const result = await poller.pollUntilDone(); if (isUnexpected(result)) { @@ -68,7 +68,7 @@ async function main() { "/deviceUpdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}/status", instanceId, groupId, - deploymentId + deploymentId, ) .get(); diff --git a/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/getUpdate.js b/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/getUpdate.js index 11c62770eaf9..8dc42f51289d 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/getUpdate.js +++ b/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/getUpdate.js @@ -32,7 +32,7 @@ async function main() { name + "' and version '" + version + - "'..." + "'...", ); const updateResult = await client .path( @@ -40,7 +40,7 @@ async function main() { instanceId, provider, name, - version + version, ) .get(); @@ -67,7 +67,7 @@ async function main() { instanceId, provider, name, - version + version, ) .get(); @@ -87,7 +87,7 @@ async function main() { provider, name, version, - fileId + fileId, ) .get(); diff --git a/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/importUpdate.js b/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/importUpdate.js index cd52ed349c27..e14ca078c434 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/importUpdate.js +++ b/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/importUpdate.js @@ -57,7 +57,7 @@ async function main() { ], }); - const poller = getLongRunningPoller(client, initialResponse); + const poller = await getLongRunningPoller(client, initialResponse); const result = await poller.pollUntilDone(); if (isUnexpected(result)) { diff --git a/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/listUpdates.js b/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/listUpdates.js index f648fd04e20c..14b96053f369 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/listUpdates.js +++ b/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/listUpdates.js @@ -60,7 +60,7 @@ async function main() { "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions", instanceId, provider, - name + name, ) .get(); diff --git a/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/package.json b/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/package.json index 5b09c7e9075b..e76ad8050280 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/package.json +++ b/sdk/deviceupdate/iot-device-update-rest/samples/v1/javascript/package.json @@ -28,8 +28,7 @@ "dependencies": { "@azure-rest/iot-device-update": "latest", "dotenv": "latest", - "@azure/identity": "^4.2.1", - "uuid": "^8.3.0", - "@azure/core-util": "^1.0.1" + "@azure/identity": "^4.0.1", + "@azure/core-util": "^1.6.1" } } diff --git a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/package.json b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/package.json index 18a9ff0b3de9..3f85cb10077b 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/package.json +++ b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/package.json @@ -32,12 +32,10 @@ "dependencies": { "@azure-rest/iot-device-update": "latest", "dotenv": "latest", - "@azure/identity": "^4.2.1", - "uuid": "^8.3.0", - "@azure/core-util": "^1.0.1" + "@azure/identity": "^4.0.1", + "@azure/core-util": "^1.6.1" }, "devDependencies": { - "@types/uuid": "^8.0.0", "@types/node": "^18.0.0", "typescript": "~5.5.3", "rimraf": "latest" diff --git a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/deleteUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/deleteUpdate.ts index e6bab6a2d76b..db4fe95a8427 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/deleteUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/deleteUpdate.ts @@ -33,11 +33,11 @@ async function main() { instanceId, updateProvider, updateName, - updateVersion + updateVersion, ) .delete(); - const poller = getLongRunningPoller(client, initialResponse); + const poller = await getLongRunningPoller(client, initialResponse); const result = await poller.pollUntilDone(); if (isUnexpected(result)) { diff --git a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/deployUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/deployUpdate.ts index 7d8a0141a62e..5097ab93275b 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/deployUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/deployUpdate.ts @@ -11,14 +11,14 @@ import DeviceUpdate, { getLongRunningPoller, isUnexpected } from "@azure-rest/io import { DefaultAzureCredential } from "@azure/identity"; import dotenv from "dotenv"; -import { v4 } from "uuid"; +import { randomUUID } from "@azure/core-util"; dotenv.config(); const endpoint = process.env["ENDPOINT"] || ""; const instanceId = process.env["INSTANCE_ID"] || ""; -async function main() { +async function main(): Promise { console.log("== Deploy update =="); const updateProvider = process.env["DEVICEUPDATE_UPDATE_PROVIDER"] || ""; const updateName = process.env["DEVICEUPDATE_UPDATE_NAME"] || ""; @@ -28,7 +28,7 @@ async function main() { const credentials = new DefaultAzureCredential(); const client = DeviceUpdate(endpoint, credentials); - const deploymentId = v4(); + const deploymentId = randomUUID(); const startAt = new Date().toISOString(); const initialResponse = await client @@ -36,7 +36,7 @@ async function main() { "/deviceUpdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}", instanceId, groupId, - deploymentId + deploymentId, ) .put({ body: { @@ -53,7 +53,7 @@ async function main() { }, }); - const poller = getLongRunningPoller(client, initialResponse); + const poller = await getLongRunningPoller(client, initialResponse); const result = await poller.pollUntilDone(); if (isUnexpected(result)) { @@ -67,7 +67,7 @@ async function main() { "/deviceUpdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}/status", instanceId, groupId, - deploymentId + deploymentId, ) .get(); diff --git a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/getUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/getUpdate.ts index 34c512a45f8a..5ce5278d4e96 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/getUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/getUpdate.ts @@ -33,7 +33,7 @@ async function main() { name + "' and version '" + version + - "'..." + "'...", ); const updateResult = await client .path( @@ -41,7 +41,7 @@ async function main() { instanceId, provider, name, - version + version, ) .get(); @@ -68,7 +68,7 @@ async function main() { instanceId, provider, name, - version + version, ) .get(); @@ -88,7 +88,7 @@ async function main() { provider, name, version, - fileId + fileId, ) .get(); diff --git a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/importUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/importUpdate.ts index 12757627dca2..24872b17d2e6 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/importUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/importUpdate.ts @@ -56,7 +56,7 @@ async function main() { ], }); - const poller = getLongRunningPoller(client, initialResponse); + const poller = await getLongRunningPoller(client, initialResponse); const result = await poller.pollUntilDone(); if (isUnexpected(result)) { diff --git a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/listUpdates.ts b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/listUpdates.ts index c1ee6ec006dd..f980f119019f 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/listUpdates.ts +++ b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/src/listUpdates.ts @@ -61,7 +61,7 @@ async function main() { "/deviceUpdate/{instanceId}/updates/providers/{provider}/names/{name}/versions", instanceId, provider, - name + name, ) .get(); diff --git a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/tsconfig.json b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/tsconfig.json index ad5ff9a19d36..984eed535aa8 100644 --- a/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/tsconfig.json +++ b/sdk/deviceupdate/iot-device-update-rest/samples/v1/typescript/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "ES2018", + "target": "ES2020", "module": "commonjs", "moduleResolution": "node", "resolveJsonModule": true, From f3066b3832cc6af88b5f2293deb79998a8b16839 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Wed, 4 Sep 2024 10:59:48 +0800 Subject: [PATCH 03/13] update --- .../src/clientDefinitions.ts | 2 +- .../src/deviceUpdate.ts | 7 +++--- .../iot-device-update-rest/src/index.ts | 2 +- .../src/isUnexpected.ts | 2 +- .../iot-device-update-rest/src/logger.ts | 2 +- .../iot-device-update-rest/src/models.ts | 2 +- .../src/outputModels.ts | 2 +- .../src/paginateHelper.ts | 22 +++++++++---------- .../iot-device-update-rest/src/parameters.ts | 14 ++++++------ .../src/pollingHelper.ts | 2 +- .../iot-device-update-rest/src/responses.ts | 2 +- 11 files changed, 29 insertions(+), 30 deletions(-) diff --git a/sdk/deviceupdate/iot-device-update-rest/src/clientDefinitions.ts b/sdk/deviceupdate/iot-device-update-rest/src/clientDefinitions.ts index 9f907aaafaea..996690cb8977 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/clientDefinitions.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/clientDefinitions.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. import { DeviceUpdateListUpdatesParameters, diff --git a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts index 22c0d8c41d98..7517fd9f99f8 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. import { getClient, ClientOptions } from "@azure-rest/core-client"; import { logger } from "./logger"; @@ -51,9 +51,8 @@ export default function createClient( // Append one if there is no apiVersion and we have one at client options const url = new URL(req.url); if (!url.searchParams.get("api-version") && apiVersion) { - req.url = `${req.url}${ - Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" - }api-version=${apiVersion}`; + req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; } return next(req); diff --git a/sdk/deviceupdate/iot-device-update-rest/src/index.ts b/sdk/deviceupdate/iot-device-update-rest/src/index.ts index 26b056160fa6..cf903e2cf87f 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/index.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/index.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. import DeviceUpdate from "./deviceUpdate"; diff --git a/sdk/deviceupdate/iot-device-update-rest/src/isUnexpected.ts b/sdk/deviceupdate/iot-device-update-rest/src/isUnexpected.ts index 257523a853e5..642036f3e851 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/isUnexpected.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/isUnexpected.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. import { DeviceUpdateListUpdates200Response, diff --git a/sdk/deviceupdate/iot-device-update-rest/src/logger.ts b/sdk/deviceupdate/iot-device-update-rest/src/logger.ts index b906c8113cf8..decf9a4b6147 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/logger.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/logger.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. import { createClientLogger } from "@azure/logger"; export const logger = createClientLogger("iot-device-update"); diff --git a/sdk/deviceupdate/iot-device-update-rest/src/models.ts b/sdk/deviceupdate/iot-device-update-rest/src/models.ts index d947cd7ae09f..f70877b435bc 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/models.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/models.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. /** Update identifier. */ export interface UpdateId { diff --git a/sdk/deviceupdate/iot-device-update-rest/src/outputModels.ts b/sdk/deviceupdate/iot-device-update-rest/src/outputModels.ts index 7bc43df6a374..bb1e76d917f4 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/outputModels.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/outputModels.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. /** The list of updates. */ export interface UpdateListOutput { diff --git a/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts b/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts index f0d91c952cda..ad918dd40d30 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. import { getPagedAsyncIterator, PagedAsyncIterableIterator, PagedResult } from "@azure/core-paging"; import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client"; @@ -67,16 +67,16 @@ export function paginate( typeof customGetPage === "function" ? customGetPage : async (pageLink: string) => { - const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get(); - firstRun = false; - checkPagingRequest(result); - const nextLink = getNextLink(result.body, nextLinkName); - const values = getElements(result.body, itemName); - return { - page: values, - nextPageLink: nextLink, - }; - }, + const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get(); + firstRun = false; + checkPagingRequest(result); + const nextLink = getNextLink(result.body, nextLinkName); + const values = getElements(result.body, itemName); + return { + page: values, + nextPageLink: nextLink, + }; + }, }; return getPagedAsyncIterator(pagedResult); diff --git a/sdk/deviceupdate/iot-device-update-rest/src/parameters.ts b/sdk/deviceupdate/iot-device-update-rest/src/parameters.ts index ed862f15b46b..89ad5e7d1a78 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/parameters.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/parameters.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; import { RequestParameters } from "@azure-rest/core-client"; @@ -124,8 +124,8 @@ export interface DeviceManagementUpdateDeviceClassMediaTypesParam { export type DeviceManagementUpdateDeviceClassParameters = DeviceManagementUpdateDeviceClassMediaTypesParam & - DeviceManagementUpdateDeviceClassBodyParam & - RequestParameters; + DeviceManagementUpdateDeviceClassBodyParam & + RequestParameters; export type DeviceManagementDeleteDeviceClassParameters = RequestParameters; export type DeviceManagementListInstallableUpdatesForDeviceClassParameters = RequestParameters; @@ -199,8 +199,8 @@ export interface DeviceManagementCreateOrUpdateDeploymentMediaTypesParam { export type DeviceManagementCreateOrUpdateDeploymentParameters = DeviceManagementCreateOrUpdateDeploymentMediaTypesParam & - DeviceManagementCreateOrUpdateDeploymentBodyParam & - RequestParameters; + DeviceManagementCreateOrUpdateDeploymentBodyParam & + RequestParameters; export type DeviceManagementDeleteDeploymentParameters = RequestParameters; export type DeviceManagementGetDeploymentStatusParameters = RequestParameters; @@ -287,8 +287,8 @@ export interface DeviceManagementStartLogCollectionMediaTypesParam { export type DeviceManagementStartLogCollectionParameters = DeviceManagementStartLogCollectionMediaTypesParam & - DeviceManagementStartLogCollectionBodyParam & - RequestParameters; + DeviceManagementStartLogCollectionBodyParam & + RequestParameters; export type DeviceManagementGetLogCollectionParameters = RequestParameters; export type DeviceManagementListLogCollectionsParameters = RequestParameters; export type DeviceManagementGetLogCollectionDetailedStatusParameters = RequestParameters; diff --git a/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts b/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts index 65fb8e1eb40f..0ff7c2fe9be1 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. import { Client, HttpResponse } from "@azure-rest/core-client"; import { AbortSignalLike } from "@azure/abort-controller"; diff --git a/sdk/deviceupdate/iot-device-update-rest/src/responses.ts b/sdk/deviceupdate/iot-device-update-rest/src/responses.ts index f218250ba2a4..c6d63db1332a 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/responses.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/responses.ts @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. import { RawHttpHeaders } from "@azure/core-rest-pipeline"; import { HttpResponse } from "@azure-rest/core-client"; From 26e0355e42ea2dbbb82e91eef5e05ed66b41ca20 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:17:01 +0800 Subject: [PATCH 04/13] fix format --- .../src/deviceUpdate.ts | 5 +++-- .../src/paginateHelper.ts | 20 +++++++++---------- .../iot-device-update-rest/src/parameters.ts | 12 +++++------ 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts index 7517fd9f99f8..39d6107fbef5 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts @@ -51,8 +51,9 @@ export default function createClient( // Append one if there is no apiVersion and we have one at client options const url = new URL(req.url); if (!url.searchParams.get("api-version") && apiVersion) { - req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" - }api-version=${apiVersion}`; + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; } return next(req); diff --git a/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts b/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts index ad918dd40d30..e27846d32a90 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts @@ -67,16 +67,16 @@ export function paginate( typeof customGetPage === "function" ? customGetPage : async (pageLink: string) => { - const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get(); - firstRun = false; - checkPagingRequest(result); - const nextLink = getNextLink(result.body, nextLinkName); - const values = getElements(result.body, itemName); - return { - page: values, - nextPageLink: nextLink, - }; - }, + const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get(); + firstRun = false; + checkPagingRequest(result); + const nextLink = getNextLink(result.body, nextLinkName); + const values = getElements(result.body, itemName); + return { + page: values, + nextPageLink: nextLink, + }; + }, }; return getPagedAsyncIterator(pagedResult); diff --git a/sdk/deviceupdate/iot-device-update-rest/src/parameters.ts b/sdk/deviceupdate/iot-device-update-rest/src/parameters.ts index 89ad5e7d1a78..95f07f615058 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/parameters.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/parameters.ts @@ -124,8 +124,8 @@ export interface DeviceManagementUpdateDeviceClassMediaTypesParam { export type DeviceManagementUpdateDeviceClassParameters = DeviceManagementUpdateDeviceClassMediaTypesParam & - DeviceManagementUpdateDeviceClassBodyParam & - RequestParameters; + DeviceManagementUpdateDeviceClassBodyParam & + RequestParameters; export type DeviceManagementDeleteDeviceClassParameters = RequestParameters; export type DeviceManagementListInstallableUpdatesForDeviceClassParameters = RequestParameters; @@ -199,8 +199,8 @@ export interface DeviceManagementCreateOrUpdateDeploymentMediaTypesParam { export type DeviceManagementCreateOrUpdateDeploymentParameters = DeviceManagementCreateOrUpdateDeploymentMediaTypesParam & - DeviceManagementCreateOrUpdateDeploymentBodyParam & - RequestParameters; + DeviceManagementCreateOrUpdateDeploymentBodyParam & + RequestParameters; export type DeviceManagementDeleteDeploymentParameters = RequestParameters; export type DeviceManagementGetDeploymentStatusParameters = RequestParameters; @@ -287,8 +287,8 @@ export interface DeviceManagementStartLogCollectionMediaTypesParam { export type DeviceManagementStartLogCollectionParameters = DeviceManagementStartLogCollectionMediaTypesParam & - DeviceManagementStartLogCollectionBodyParam & - RequestParameters; + DeviceManagementStartLogCollectionBodyParam & + RequestParameters; export type DeviceManagementGetLogCollectionParameters = RequestParameters; export type DeviceManagementListLogCollectionsParameters = RequestParameters; export type DeviceManagementGetLogCollectionDetailedStatusParameters = RequestParameters; From e7428fe15315d3b0ae53ce1a29c01446ef1c8ec8 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:07:59 +0800 Subject: [PATCH 05/13] Update CHANGELOG.md --- sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md b/sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md index 15d057bad76b..e9aadf7ebd9a 100644 --- a/sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md +++ b/sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md @@ -1,14 +1,9 @@ # Release History -## 1.0.1 (Unreleased) +## 1.0.1 (2024-09-09) ### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- refresh @azure-rest/iot-device-update sdk ## 1.0.0 (2022-09-09) From adcf56634c84b1fad5d8b1ac3e3189809dd0d9be Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Fri, 8 Nov 2024 13:38:51 +0800 Subject: [PATCH 06/13] update --- sdk/deviceupdate/iot-device-update-rest/karma.conf.js | 2 +- sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts | 5 +++-- sdk/deviceupdate/iot-device-update-rest/swagger/README.md | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sdk/deviceupdate/iot-device-update-rest/karma.conf.js b/sdk/deviceupdate/iot-device-update-rest/karma.conf.js index a9d5f1b5fc59..4fdf26c79ac0 100644 --- a/sdk/deviceupdate/iot-device-update-rest/karma.conf.js +++ b/sdk/deviceupdate/iot-device-update-rest/karma.conf.js @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. +// Licensed under the MIT License. // https://github.com/karma-runner/karma-chrome-launcher process.env.CHROME_BIN = require("puppeteer").executablePath(); diff --git a/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts b/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts index a2668fc5d9c7..75a3d3db6e98 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts @@ -8,9 +8,10 @@ import type { CreateHttpPollerOptions, RunningOperation, OperationResponse, - OperationState, + OperationState} from "@azure/core-lro"; +import { + createHttpPoller, } from "@azure/core-lro"; -import { createHttpPoller } from "@azure/core-lro"; /** * A simple poller that can be used to poll a long running operation. diff --git a/sdk/deviceupdate/iot-device-update-rest/swagger/README.md b/sdk/deviceupdate/iot-device-update-rest/swagger/README.md index 515c68d96659..2fc2380d290d 100644 --- a/sdk/deviceupdate/iot-device-update-rest/swagger/README.md +++ b/sdk/deviceupdate/iot-device-update-rest/swagger/README.md @@ -13,7 +13,7 @@ title: DeviceUpdate description: Iot Device Update Client generate-metadata: false license-header: MICROSOFT_MIT_NO_VERSION -output-folder: $(typescript-sdks-folder)/sdk/deviceupdate/iot-device-update-rest +output-folder: ../ source-code-folder-path: ./src input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/d7c9be23749467be1aea18f02ba2f4948a39db6a/specification/deviceupdate/data-plane/Microsoft.DeviceUpdate/stable/2022-10-01/deviceupdate.json package-version: 1.0.1 @@ -21,7 +21,7 @@ rest-level-client: true add-credentials: true credential-scopes: https://api.adu.microsoft.com/.default use-extension: - "@autorest/typescript": "6.0.0-rc.1" + "@autorest/typescript": "latest" ``` ### Fix 304s From 47e178f4d9f9b19ab8495b57737683cc7976c4ff Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:39:16 +0800 Subject: [PATCH 07/13] Update pollingHelper.ts --- sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts b/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts index 75a3d3db6e98..a2668fc5d9c7 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/pollingHelper.ts @@ -8,10 +8,9 @@ import type { CreateHttpPollerOptions, RunningOperation, OperationResponse, - OperationState} from "@azure/core-lro"; -import { - createHttpPoller, + OperationState, } from "@azure/core-lro"; +import { createHttpPoller } from "@azure/core-lro"; /** * A simple poller that can be used to poll a long running operation. From 7bfe78a26f4347adcad2cf89e6524a7866e1a3de Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Wed, 13 Nov 2024 16:50:50 +0800 Subject: [PATCH 08/13] update --- .../iot-device-update-rest/package.json | 3 +- .../review/iot-device-update.api.md | 15 +- .../src/paginateHelper.ts | 146 +++++++++++++++++- 3 files changed, 154 insertions(+), 10 deletions(-) diff --git a/sdk/deviceupdate/iot-device-update-rest/package.json b/sdk/deviceupdate/iot-device-update-rest/package.json index 47ba12a3a460..2877093e28d8 100644 --- a/sdk/deviceupdate/iot-device-update-rest/package.json +++ b/sdk/deviceupdate/iot-device-update-rest/package.json @@ -86,8 +86,7 @@ "dependencies": { "@azure-rest/core-client": "^1.0.0", "@azure/core-auth": "^1.3.0", - "@azure/core-paging": "^1.5.0", - "@azure/core-lro": "^3.0.0", + "@azure/core-lro": "^3.1.0", "@azure/abort-controller": "^2.1.2", "@azure/core-rest-pipeline": "^1.8.0", "@azure/logger": "^1.0.0", diff --git a/sdk/deviceupdate/iot-device-update-rest/review/iot-device-update.api.md b/sdk/deviceupdate/iot-device-update-rest/review/iot-device-update.api.md index 2c01c1df4f73..43d686133dfa 100644 --- a/sdk/deviceupdate/iot-device-update-rest/review/iot-device-update.api.md +++ b/sdk/deviceupdate/iot-device-update-rest/review/iot-device-update.api.md @@ -11,7 +11,6 @@ import type { ClientOptions } from '@azure-rest/core-client'; import type { CreateHttpPollerOptions } from '@azure/core-lro'; import type { HttpResponse } from '@azure-rest/core-client'; import type { OperationState } from '@azure/core-lro'; -import type { PagedAsyncIterableIterator } from '@azure/core-paging'; import type { PathUncheckedResponse } from '@azure-rest/core-client'; import type { RawHttpHeaders } from '@azure/core-rest-pipeline'; import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline'; @@ -1716,7 +1715,7 @@ export type GetArrayType = T extends Array ? TData : never; export function getLongRunningPoller(client: Client, initialResponse: TResult, options?: CreateHttpPollerOptions>): Promise, TResult>>; // @public -export type GetPage = (pageLink: string, maxPageSize?: number) => Promise<{ +export type GetPage = (pageLink: string) => Promise<{ page: TPage; nextPageLink?: string; }>; @@ -1973,6 +1972,18 @@ export interface LogCollectionOutput { readonly status?: "NotStarted" | "Running" | "Succeeded" | "Failed"; } +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator; + next(): Promise>; +} + +// @public +export interface PageSettings { + continuationToken?: string; +} + // @public export function paginate(client: Client, initialResponse: TResponse, options?: PagingOptions): PagedAsyncIterableIterator>; diff --git a/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts b/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts index 5d541b4e406d..9ea946d9d6c5 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/paginateHelper.ts @@ -1,11 +1,148 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { PagedAsyncIterableIterator, PagedResult } from "@azure/core-paging"; -import { getPagedAsyncIterator } from "@azure/core-paging"; import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; import { createRestError } from "@azure-rest/core-client"; +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings = PageSettings, + TLink = string, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + (((settings?: PageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken as unknown as TLink | undefined, + }); + }) as unknown as (settings?: TPageSettings) => AsyncIterableIterator), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + const firstVal = await pages.next(); + // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is + if (!Array.isArray(firstVal.value)) { + // can extract elements from this page + const { toElements } = pagedResult; + if (toElements) { + yield* toElements(firstVal.value) as TElement[]; + for await (const page of pages) { + yield* toElements(page) as TElement[]; + } + } else { + yield firstVal.value; + // `pages` is of type `AsyncIterableIterator` but TPage = TElement in this case + yield* pages as unknown as AsyncIterableIterator; + } + } else { + yield* firstVal.value; + for await (const page of pages) { + // pages is of type `AsyncIterableIterator` so `page` is of type `TPage`. In this branch, + // it must be the case that `TPage = TElement[]` + yield* page as unknown as TElement[]; + } + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: TLink; + } = {}, +): AsyncIterableIterator { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + yield response.page; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + yield response.page; + } +} + +/** + * An interface that tracks the settings for paged iteration + */ +export interface PageSettings { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +} + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator; +} + +/** + * An interface that describes how to communicate with the service. + */ +interface PagedResult { + /** + * Link to the first page of results. + */ + firstPageLink: TLink; + /** + * A method that returns a page of results. + */ + getPage: (pageLink: TLink) => Promise<{ page: TPage; nextPageLink?: TLink } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => unknown[]; +} + /** * Helper type to extract the type of an array */ @@ -14,10 +151,7 @@ export type GetArrayType = T extends Array ? TData : never; /** * The type of a custom function that defines how to get a page and a link to the next one if any. */ -export type GetPage = ( - pageLink: string, - maxPageSize?: number, -) => Promise<{ +export type GetPage = (pageLink: string) => Promise<{ page: TPage; nextPageLink?: string; }>; From 062cb3edb1477acbd56eba4b8793cb831b71dfac Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 16 Dec 2024 10:49:37 +0800 Subject: [PATCH 09/13] Update deviceUpdate.ts --- .../iot-device-update-rest/src/deviceUpdate.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts index 5510fd746855..e273d0e95338 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts @@ -3,7 +3,7 @@ import type { ClientOptions } from "@azure-rest/core-client"; import { getClient } from "@azure-rest/core-client"; -import { logger } from "./logger"; +import { logger } from "./logger.js"; import type { TokenCredential } from "@azure/core-auth"; import type { DeviceUpdateClient } from "./clientDefinitions.js"; @@ -52,9 +52,8 @@ export default function createClient( // Append one if there is no apiVersion and we have one at client options const url = new URL(req.url); if (!url.searchParams.get("api-version") && apiVersion) { - req.url = `${req.url}${ - Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" - }api-version=${apiVersion}`; + req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; } return next(req); From 1479036e531cc0d418198350488119156e3e27b6 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:20:28 +0800 Subject: [PATCH 10/13] format --- .../iot-device-update-rest/src/clientDefinitions.ts | 2 +- sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sdk/deviceupdate/iot-device-update-rest/src/clientDefinitions.ts b/sdk/deviceupdate/iot-device-update-rest/src/clientDefinitions.ts index 069c287b386a..734e1f941efb 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/clientDefinitions.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/clientDefinitions.ts @@ -159,7 +159,7 @@ import type { DeviceManagementGetLogCollectionDetailedStatusDefaultResponse, DeviceManagementListHealthOfDevices200Response, DeviceManagementListHealthOfDevicesDefaultResponse, -} from "./responses.js" +} from "./responses.js"; import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface DeviceUpdateListUpdates { diff --git a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts index e273d0e95338..0192580aefa8 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts @@ -52,8 +52,9 @@ export default function createClient( // Append one if there is no apiVersion and we have one at client options const url = new URL(req.url); if (!url.searchParams.get("api-version") && apiVersion) { - req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" - }api-version=${apiVersion}`; + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; } return next(req); From a81468628e8a4b13870e770b36dfb5bd85b090fa Mon Sep 17 00:00:00 2001 From: ZiWei Chen <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:56:42 +0800 Subject: [PATCH 11/13] Update sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md --- sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md b/sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md index e9aadf7ebd9a..d4075b28888e 100644 --- a/sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md +++ b/sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.1 (2024-09-09) +## 1.0.1 (2024-12-16) ### Features Added - refresh @azure-rest/iot-device-update sdk From 9215e99a87517fff119e35fa022391d317e8bad6 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Thu, 19 Dec 2024 17:14:11 +0800 Subject: [PATCH 12/13] update --- sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md | 2 +- sdk/deviceupdate/iot-device-update-rest/package.json | 2 +- .../iot-device-update-rest/src/deviceUpdate.ts | 7 +++---- sdk/deviceupdate/iot-device-update-rest/swagger/README.md | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md b/sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md index d4075b28888e..6754a58894d1 100644 --- a/sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md +++ b/sdk/deviceupdate/iot-device-update-rest/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.1 (2024-12-16) +## 1.1.0 (2024-12-16) ### Features Added - refresh @azure-rest/iot-device-update sdk diff --git a/sdk/deviceupdate/iot-device-update-rest/package.json b/sdk/deviceupdate/iot-device-update-rest/package.json index 84c147840ac8..3185f338aacf 100644 --- a/sdk/deviceupdate/iot-device-update-rest/package.json +++ b/sdk/deviceupdate/iot-device-update-rest/package.json @@ -3,7 +3,7 @@ "sdk-type": "client", "author": "Microsoft Corporation", "description": "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.", - "version": "1.0.1", + "version": "1.1.0", "keywords": [ "node", "azure", diff --git a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts index 0192580aefa8..5caf4a677bb4 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts @@ -25,7 +25,7 @@ export default function createClient( { apiVersion = "2022-10-01", ...options }: DeviceUpdateClientOptions = {}, ): DeviceUpdateClient { const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://${endpoint}`; - const userAgentInfo = `azsdk-js-iot-device-update-rest/1.0.1`; + const userAgentInfo = `azsdk-js-iot-device-update-rest/1.1.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` @@ -52,9 +52,8 @@ export default function createClient( // Append one if there is no apiVersion and we have one at client options const url = new URL(req.url); if (!url.searchParams.get("api-version") && apiVersion) { - req.url = `${req.url}${ - Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" - }api-version=${apiVersion}`; + req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; } return next(req); diff --git a/sdk/deviceupdate/iot-device-update-rest/swagger/README.md b/sdk/deviceupdate/iot-device-update-rest/swagger/README.md index 2fc2380d290d..6f147e3497fb 100644 --- a/sdk/deviceupdate/iot-device-update-rest/swagger/README.md +++ b/sdk/deviceupdate/iot-device-update-rest/swagger/README.md @@ -16,7 +16,7 @@ license-header: MICROSOFT_MIT_NO_VERSION output-folder: ../ source-code-folder-path: ./src input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/d7c9be23749467be1aea18f02ba2f4948a39db6a/specification/deviceupdate/data-plane/Microsoft.DeviceUpdate/stable/2022-10-01/deviceupdate.json -package-version: 1.0.1 +package-version: 1.1.0 rest-level-client: true add-credentials: true credential-scopes: https://api.adu.microsoft.com/.default From 2d5a369b79feb16f01b6459b78cb3f6e90fb773b Mon Sep 17 00:00:00 2001 From: Jeremy Meng Date: Thu, 19 Dec 2024 16:17:57 -0800 Subject: [PATCH 13/13] format --- sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts index 5caf4a677bb4..e792f767f58e 100644 --- a/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts +++ b/sdk/deviceupdate/iot-device-update-rest/src/deviceUpdate.ts @@ -52,8 +52,9 @@ export default function createClient( // Append one if there is no apiVersion and we have one at client options const url = new URL(req.url); if (!url.searchParams.get("api-version") && apiVersion) { - req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" - }api-version=${apiVersion}`; + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; } return next(req);