@azure-rest/iot-device-update 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Release History
2
+
3
+ ## 1.0.0-beta.1 (2022-01-21)
4
+
5
+ - Initial Release
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Microsoft
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # Azure Device Update for IoT Hub Rest Client library for JavaScript
2
+
3
+ The library provides access to the Device Update for IoT Hub service that enables customers to publish updates for their IoT devices to the cloud, and then deploy these updates to their devices (approve updates to groups of devices managed and provisioned in IoT Hub).
4
+
5
+ **Please rely heavily on the [service's documentation][device_update_product_documentation] and our [REST client docs][rest_client] to use this library**
6
+
7
+ Key links:
8
+ - [Source code][source_code]
9
+ - [Package (NPM)][npm]
10
+ - [API reference documentation][ref_docs]
11
+ - [Product documentation][device_update_product_documentation]
12
+
13
+ ## Getting started
14
+
15
+ ### Currently supported environments
16
+
17
+ - Node.js version 14.x.x or higher
18
+
19
+ ### Prerequisites
20
+
21
+ - Microsoft Azure Subscription: To call Microsoft Azure services, you need to create an [Azure subscription][azure_subscription]
22
+ - Device Update for IoT Hub instance
23
+ - Azure IoT Hub instance
24
+
25
+ ### Install the `@azure-rest/iot-device-update` package
26
+
27
+ Install the Azure Iot Device Update client library for JavaScript with `npm`:
28
+
29
+ ```bash
30
+ npm install @azure-rest/iot-device-update
31
+ ```
32
+
33
+ ### Create and authenticate a `DeviceUpdate`
34
+
35
+ To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
36
+ provide an instance of the desired credential type obtained from the
37
+ [@azure/identity][azure_identity_credentials] library.
38
+
39
+ To authenticate with AAD, you must first `npm` install [`@azure/identity`][azure_identity_npm].
40
+
41
+ After installation, you can choose which type of [credential][azure_identity_credentials] from `@azure/identity` to use.
42
+ As an example, [DefaultAzureCredential][default_azure_credential]
43
+ can be used to authenticate the client:
44
+
45
+ Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
46
+ AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
47
+
48
+ Use the returned token credential to authenticate the client:
49
+
50
+ ```typescript
51
+ import DeviceUpdate from "@azure-rest/iot-device-update";
52
+ import { DefaultAzureCredential } from "@azure/identity";
53
+ const client = DeviceUpdate(
54
+ "https://<my-instance-id>.api.adu.microsoft.com",
55
+ new DefaultAzureCredential()
56
+ );
57
+ ```
58
+
59
+ ## Key concepts
60
+
61
+ ### REST Client
62
+
63
+ This client is one of our REST clients. We highly recommend you read how to use a REST client [here][rest_client].
64
+
65
+ ## Examples
66
+
67
+ The following section shows you how to initialize and authenticate your client, then get all devices.
68
+
69
+ - [Get All Devices](#get-all-devices "Get All Devices")
70
+
71
+ ```typescript
72
+ import DeviceUpdate from "@azure-rest/iot-device-update";
73
+ import { DefaultAzureCredential } from "@azure/identity";
74
+
75
+ async function main() {
76
+ console.log("== List devices ==");
77
+ const client = DeviceUpdate(endpoint, new DefaultAzureCredential());
78
+
79
+ const result = await client
80
+ .path("/deviceupdate/{instanceId}/management/devices", instanceId)
81
+ .get();
82
+
83
+ console.log(result);
84
+ }
85
+
86
+ main().catch(console.error);
87
+ ```
88
+
89
+ ## Troubleshooting
90
+
91
+ ### Logging
92
+
93
+ Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
94
+
95
+ ```javascript
96
+ import { setLogLevel } from "@azure/logger";
97
+
98
+ setLogLevel("info");
99
+ ```
100
+
101
+ For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
102
+
103
+ ## Next steps
104
+
105
+ ## Contributing
106
+
107
+ If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
108
+
109
+ ## Related projects
110
+
111
+ - [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
112
+
113
+ ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fdeviceupdate%2Fiot-device-update%2FREADME.png)
114
+
115
+ [device_update_product_documentation]: https://docs.microsoft.com/azure/iot-hub-device-update/
116
+ [rest_client]: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md
117
+ [source_code]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceupdate/iot-device-update-rest
118
+ [npm]: https://www.npmjs.com/org/azure-rest
119
+ [ref_docs]: https://azure.github.io/azure-sdk-for-js
120
+ [azure_subscription]: https://azure.microsoft.com/free/
121
+ [authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
122
+ [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials
123
+ [azure_identity_npm]: https://www.npmjs.com/package/@azure/identity
124
+ [default_azure_credential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
package/dist/index.js ADDED
@@ -0,0 +1,136 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var coreClient = require('@azure-rest/core-client');
6
+ var corePaging = require('@azure/core-paging');
7
+ var coreLro = require('@azure/core-lro');
8
+
9
+ // Copyright (c) Microsoft Corporation.
10
+ function DeviceUpdate(endpoint, credentials, options = {}) {
11
+ var _a, _b;
12
+ const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `https://${endpoint}`;
13
+ options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2021-06-01-preview";
14
+ options = Object.assign(Object.assign({}, options), { credentials: {
15
+ scopes: ["https://api.adu.microsoft.com/.default"],
16
+ } });
17
+ return coreClient.getClient(baseUrl, credentials, options);
18
+ }
19
+
20
+ // Copyright (c) Microsoft Corporation.
21
+ /**
22
+ * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
23
+ * @param client - Client to use for sending the next page requests
24
+ * @param initialResponse - Initial response containing the nextLink and current page of elements
25
+ * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
26
+ * @returns - PagedAsyncIterableIterator to iterate the elements
27
+ */
28
+ function paginate(client, initialResponse, options = {}) {
29
+ let firstRun = true;
30
+ const itemName = "value";
31
+ const nextLinkName = "nextLink";
32
+ const { customGetPage } = options;
33
+ const pagedResult = {
34
+ firstPageLink: "",
35
+ getPage: typeof customGetPage === "function"
36
+ ? customGetPage
37
+ : async (pageLink) => {
38
+ const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();
39
+ firstRun = false;
40
+ checkPagingRequest(result);
41
+ const nextLink = getNextLink(result.body, nextLinkName);
42
+ const values = getElements(result.body, itemName);
43
+ return {
44
+ page: values,
45
+ nextPageLink: nextLink,
46
+ };
47
+ },
48
+ };
49
+ return corePaging.getPagedAsyncIterator(pagedResult);
50
+ }
51
+ /**
52
+ * Gets for the value of nextLink in the body
53
+ */
54
+ function getNextLink(body, nextLinkName) {
55
+ if (!nextLinkName) {
56
+ return undefined;
57
+ }
58
+ const nextLink = body[nextLinkName];
59
+ if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
60
+ throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
61
+ }
62
+ return nextLink;
63
+ }
64
+ /**
65
+ * Gets the elements of the current request in the body.
66
+ */
67
+ function getElements(body, itemName) {
68
+ const value = body[itemName];
69
+ // value has to be an array according to the x-ms-pageable extension.
70
+ // The fact that this must be an array is used above to calculate the
71
+ // type of elements in the page in PaginateReturn
72
+ if (!Array.isArray(value)) {
73
+ throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
74
+ }
75
+ return value !== null && value !== void 0 ? value : [];
76
+ }
77
+ /**
78
+ * Checks if a request failed
79
+ */
80
+ function checkPagingRequest(response) {
81
+ const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"];
82
+ if (!Http2xxStatusCodes.includes(response.status)) {
83
+ throw coreClient.createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
84
+ }
85
+ }
86
+
87
+ // Copyright (c) Microsoft Corporation.
88
+ /**
89
+ * Helper function that builds a Poller object to help polling a long running operation.
90
+ * @param client - Client to use for sending the request to get additional pages.
91
+ * @param initialResponse - The initial response.
92
+ * @param options - Options to set a resume state or custom polling interval.
93
+ * @returns - A poller object to poll for operation state updates and eventually get the final response.
94
+ */
95
+ function getLongRunningPoller(client, initialResponse, options = {}) {
96
+ const poller = {
97
+ requestMethod: initialResponse.request.method,
98
+ requestPath: initialResponse.request.url,
99
+ sendInitialRequest: async () => {
100
+ // In the case of Rest Clients we are building the LRO poller object from a response that's the reason
101
+ // we are not triggering the initial request here, just extracting the information from the
102
+ // response we were provided.
103
+ return getLroResponse(initialResponse);
104
+ },
105
+ sendPollRequest: async (path) => {
106
+ // This is the callback that is going to be called to poll the service
107
+ // to get the latest status. We use the client provided and the polling path
108
+ // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
109
+ // depending on the lro pattern that the service implements. If non is provided we default to the initial path.
110
+ const response = await client.pathUnchecked(path !== null && path !== void 0 ? path : initialResponse.request.url).get();
111
+ return getLroResponse(response);
112
+ },
113
+ };
114
+ return new coreLro.LroEngine(poller, options);
115
+ }
116
+ /**
117
+ * Converts a Rest Client response to a response that the LRO engine knows about
118
+ * @param response - a rest client http response
119
+ * @returns - An LRO response that the LRO engine can work with
120
+ */
121
+ function getLroResponse(response) {
122
+ if (Number.isNaN(response.status)) {
123
+ throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);
124
+ }
125
+ return {
126
+ flatResponse: response,
127
+ rawResponse: Object.assign(Object.assign({}, response), { statusCode: Number.parseInt(response.status), body: response.body }),
128
+ };
129
+ }
130
+
131
+ // Copyright (c) Microsoft Corporation.
132
+
133
+ exports.default = DeviceUpdate;
134
+ exports.getLongRunningPoller = getLongRunningPoller;
135
+ exports.paginate = paginate;
136
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/deviceUpdate.ts","../src/paginateHelper.ts","../src/pollingHelper.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n DeviceManagementCollectLogsParameters,\n DeviceManagementCreateOrUpdateDeploymentParameters,\n DeviceManagementCreateOrUpdateGroupParameters,\n DeviceManagementDeleteDeploymentParameters,\n DeviceManagementDeleteGroupParameters,\n DeviceManagementGetDeploymentParameters,\n DeviceManagementGetDeploymentStatusParameters,\n DeviceManagementGetDeviceClassParameters,\n DeviceManagementGetDeviceModuleParameters,\n DeviceManagementGetDeviceParameters,\n DeviceManagementGetDeviceTagParameters,\n DeviceManagementGetGroupParameters,\n DeviceManagementGetGroupUpdateComplianceParameters,\n DeviceManagementGetLogCollectionOperationDetailedStatusParameters,\n DeviceManagementGetLogCollectionOperationParameters,\n DeviceManagementGetOperationParameters,\n DeviceManagementGetUpdateComplianceParameters,\n DeviceManagementImportDevicesParameters,\n DeviceManagementListBestUpdatesForGroupParameters,\n DeviceManagementListDeploymentDevicesParameters,\n DeviceManagementListDeploymentsForGroupParameters,\n DeviceManagementListDeviceClassesParameters,\n DeviceManagementListDeviceTagsParameters,\n DeviceManagementListDevicesParameters,\n DeviceManagementListGroupsParameters,\n DeviceManagementListInstallableUpdatesForDeviceClassParameters,\n DeviceManagementListLogCollectionOperationsParameters,\n DeviceManagementListOperationsParameters,\n DeviceManagementRetryDeploymentParameters,\n DeviceManagementStopDeploymentParameters,\n DeviceUpdateDeleteUpdateParameters,\n DeviceUpdateGetFileParameters,\n DeviceUpdateGetOperationParameters,\n DeviceUpdateGetUpdateParameters,\n DeviceUpdateImportUpdateParameters,\n DeviceUpdateListFilesParameters,\n DeviceUpdateListNamesParameters,\n DeviceUpdateListOperationsParameters,\n DeviceUpdateListProvidersParameters,\n DeviceUpdateListUpdatesParameters,\n DeviceUpdateListVersionsParameters,\n} from \"./parameters\";\nimport {\n DeviceManagementCollectLogs201Response,\n DeviceManagementCollectLogsdefaultResponse,\n DeviceManagementCreateOrUpdateDeployment200Response,\n DeviceManagementCreateOrUpdateDeploymentdefaultResponse,\n DeviceManagementCreateOrUpdateGroup200Response,\n DeviceManagementCreateOrUpdateGroupdefaultResponse,\n DeviceManagementDeleteDeployment204Response,\n DeviceManagementDeleteDeploymentdefaultResponse,\n DeviceManagementDeleteGroup204Response,\n DeviceManagementDeleteGroupdefaultResponse,\n DeviceManagementGetDeployment200Response,\n DeviceManagementGetDeploymentStatus200Response,\n DeviceManagementGetDeploymentStatusdefaultResponse,\n DeviceManagementGetDeploymentdefaultResponse,\n DeviceManagementGetDevice200Response,\n DeviceManagementGetDeviceClass200Response,\n DeviceManagementGetDeviceClassdefaultResponse,\n DeviceManagementGetDeviceModule200Response,\n DeviceManagementGetDeviceModuledefaultResponse,\n DeviceManagementGetDeviceTag200Response,\n DeviceManagementGetDeviceTagdefaultResponse,\n DeviceManagementGetDevicedefaultResponse,\n DeviceManagementGetGroup200Response,\n DeviceManagementGetGroupUpdateCompliance200Response,\n DeviceManagementGetGroupUpdateCompliancedefaultResponse,\n DeviceManagementGetGroupdefaultResponse,\n DeviceManagementGetLogCollectionOperation200Response,\n DeviceManagementGetLogCollectionOperationDetailedStatus200Response,\n DeviceManagementGetLogCollectionOperationDetailedStatusdefaultResponse,\n DeviceManagementGetLogCollectionOperationdefaultResponse,\n DeviceManagementGetOperation200Response,\n DeviceManagementGetOperation304Response,\n DeviceManagementGetOperationdefaultResponse,\n DeviceManagementGetUpdateCompliance200Response,\n DeviceManagementGetUpdateCompliancedefaultResponse,\n DeviceManagementImportDevices202Response,\n DeviceManagementImportDevicesdefaultResponse,\n DeviceManagementListBestUpdatesForGroup200Response,\n DeviceManagementListBestUpdatesForGroupdefaultResponse,\n DeviceManagementListDeploymentDevices200Response,\n DeviceManagementListDeploymentDevicesdefaultResponse,\n DeviceManagementListDeploymentsForGroup200Response,\n DeviceManagementListDeploymentsForGroupdefaultResponse,\n DeviceManagementListDeviceClasses200Response,\n DeviceManagementListDeviceClassesdefaultResponse,\n DeviceManagementListDeviceTags200Response,\n DeviceManagementListDeviceTagsdefaultResponse,\n DeviceManagementListDevices200Response,\n DeviceManagementListDevicesdefaultResponse,\n DeviceManagementListGroups200Response,\n DeviceManagementListGroupsdefaultResponse,\n DeviceManagementListInstallableUpdatesForDeviceClass200Response,\n DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse,\n DeviceManagementListLogCollectionOperations200Response,\n DeviceManagementListLogCollectionOperationsdefaultResponse,\n DeviceManagementListOperations200Response,\n DeviceManagementListOperationsdefaultResponse,\n DeviceManagementRetryDeployment200Response,\n DeviceManagementRetryDeploymentdefaultResponse,\n DeviceManagementStopDeployment200Response,\n DeviceManagementStopDeploymentdefaultResponse,\n DeviceUpdateDeleteUpdate202Response,\n DeviceUpdateDeleteUpdatedefaultResponse,\n DeviceUpdateGetFile200Response,\n DeviceUpdateGetFile304Response,\n DeviceUpdateGetFiledefaultResponse,\n DeviceUpdateGetOperation200Response,\n DeviceUpdateGetOperation304Response,\n DeviceUpdateGetOperationdefaultResponse,\n DeviceUpdateGetUpdate200Response,\n DeviceUpdateGetUpdate304Response,\n DeviceUpdateGetUpdatedefaultResponse,\n DeviceUpdateImportUpdate202Response,\n DeviceUpdateImportUpdatedefaultResponse,\n DeviceUpdateListFiles200Response,\n DeviceUpdateListFilesdefaultResponse,\n DeviceUpdateListNames200Response,\n DeviceUpdateListNamesdefaultResponse,\n DeviceUpdateListOperations200Response,\n DeviceUpdateListOperationsdefaultResponse,\n DeviceUpdateListProviders200Response,\n DeviceUpdateListProvidersdefaultResponse,\n DeviceUpdateListUpdates200Response,\n DeviceUpdateListUpdatesdefaultResponse,\n DeviceUpdateListVersions200Response,\n DeviceUpdateListVersionsdefaultResponse,\n} from \"./responses\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport interface DeviceUpdateImportUpdate {\n /** Import new update version. */\n post(\n options: DeviceUpdateImportUpdateParameters\n ): Promise<DeviceUpdateImportUpdate202Response | DeviceUpdateImportUpdatedefaultResponse>;\n /** Get a list of all updates that have been imported to Device Update for IoT Hub. */\n get(\n options?: DeviceUpdateListUpdatesParameters\n ): Promise<DeviceUpdateListUpdates200Response | DeviceUpdateListUpdatesdefaultResponse>;\n}\n\nexport interface DeviceUpdateGetUpdate {\n /** Get a specific update version. */\n get(\n options?: DeviceUpdateGetUpdateParameters\n ): Promise<\n | DeviceUpdateGetUpdate200Response\n | DeviceUpdateGetUpdate304Response\n | DeviceUpdateGetUpdatedefaultResponse\n >;\n /** Delete a specific update version. */\n delete(\n options?: DeviceUpdateDeleteUpdateParameters\n ): Promise<DeviceUpdateDeleteUpdate202Response | DeviceUpdateDeleteUpdatedefaultResponse>;\n}\n\nexport interface DeviceUpdateListProviders {\n /** Get a list of all update providers that have been imported to Device Update for IoT Hub. */\n get(\n options?: DeviceUpdateListProvidersParameters\n ): Promise<DeviceUpdateListProviders200Response | DeviceUpdateListProvidersdefaultResponse>;\n}\n\nexport interface DeviceUpdateListNames {\n /** Get a list of all update names that match the specified provider. */\n get(\n options?: DeviceUpdateListNamesParameters\n ): Promise<DeviceUpdateListNames200Response | DeviceUpdateListNamesdefaultResponse>;\n}\n\nexport interface DeviceUpdateListVersions {\n /** Get a list of all update versions that match the specified provider and name. */\n get(\n options?: DeviceUpdateListVersionsParameters\n ): Promise<DeviceUpdateListVersions200Response | DeviceUpdateListVersionsdefaultResponse>;\n}\n\nexport interface DeviceUpdateListFiles {\n /** Get a list of all update file identifiers for the specified version. */\n get(\n options?: DeviceUpdateListFilesParameters\n ): Promise<DeviceUpdateListFiles200Response | DeviceUpdateListFilesdefaultResponse>;\n}\n\nexport interface DeviceUpdateGetFile {\n /** Get a specific update file from the version. */\n get(\n options?: DeviceUpdateGetFileParameters\n ): Promise<\n | DeviceUpdateGetFile200Response\n | DeviceUpdateGetFile304Response\n | DeviceUpdateGetFiledefaultResponse\n >;\n}\n\nexport interface DeviceUpdateListOperations {\n /** 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. */\n get(\n options?: DeviceUpdateListOperationsParameters\n ): Promise<DeviceUpdateListOperations200Response | DeviceUpdateListOperationsdefaultResponse>;\n}\n\nexport interface DeviceUpdateGetOperation {\n /** Retrieve operation status. */\n get(\n options?: DeviceUpdateGetOperationParameters\n ): Promise<\n | DeviceUpdateGetOperation200Response\n | DeviceUpdateGetOperation304Response\n | DeviceUpdateGetOperationdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListDeviceClasses {\n /** Gets a list of all device classes (unique combinations of device manufacturer and model) for all devices connected to Device Update for IoT Hub. */\n get(\n options?: DeviceManagementListDeviceClassesParameters\n ): Promise<\n DeviceManagementListDeviceClasses200Response | DeviceManagementListDeviceClassesdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetDeviceClass {\n /** Gets the properties of a device class. */\n get(\n options?: DeviceManagementGetDeviceClassParameters\n ): Promise<\n DeviceManagementGetDeviceClass200Response | DeviceManagementGetDeviceClassdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListInstallableUpdatesForDeviceClass {\n /** Gets a list of installable updates for a device class. */\n get(\n options?: DeviceManagementListInstallableUpdatesForDeviceClassParameters\n ): Promise<\n | DeviceManagementListInstallableUpdatesForDeviceClass200Response\n | DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListDevices {\n /** Gets a list of devices connected to Device Update for IoT Hub. */\n get(\n options?: DeviceManagementListDevicesParameters\n ): Promise<DeviceManagementListDevices200Response | DeviceManagementListDevicesdefaultResponse>;\n /** Import existing devices from IoT Hub. */\n post(\n options: DeviceManagementImportDevicesParameters\n ): Promise<\n DeviceManagementImportDevices202Response | DeviceManagementImportDevicesdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetDevice {\n /** Gets the device properties and latest deployment status for a device connected to Device Update for IoT Hub. */\n get(\n options?: DeviceManagementGetDeviceParameters\n ): Promise<DeviceManagementGetDevice200Response | DeviceManagementGetDevicedefaultResponse>;\n}\n\nexport interface DeviceManagementGetDeviceModule {\n /** Gets the device module properties and latest deployment status for a device module connected to Device Update for IoT Hub. */\n get(\n options?: DeviceManagementGetDeviceModuleParameters\n ): Promise<\n DeviceManagementGetDeviceModule200Response | DeviceManagementGetDeviceModuledefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetUpdateCompliance {\n /** Gets the breakdown of how many devices are on their latest update, have new updates available, or are in progress receiving new updates. */\n get(\n options?: DeviceManagementGetUpdateComplianceParameters\n ): Promise<\n | DeviceManagementGetUpdateCompliance200Response\n | DeviceManagementGetUpdateCompliancedefaultResponse\n >;\n}\n\nexport interface DeviceManagementListDeviceTags {\n /** Gets a list of available group device tags for all devices connected to Device Update for IoT Hub. */\n get(\n options?: DeviceManagementListDeviceTagsParameters\n ): Promise<\n DeviceManagementListDeviceTags200Response | DeviceManagementListDeviceTagsdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetDeviceTag {\n /** Gets a count of how many devices have a device tag. */\n get(\n options?: DeviceManagementGetDeviceTagParameters\n ): Promise<DeviceManagementGetDeviceTag200Response | DeviceManagementGetDeviceTagdefaultResponse>;\n}\n\nexport interface DeviceManagementListGroups {\n /** Gets a list of all device groups. */\n get(\n options?: DeviceManagementListGroupsParameters\n ): Promise<DeviceManagementListGroups200Response | DeviceManagementListGroupsdefaultResponse>;\n}\n\nexport interface DeviceManagementGetGroup {\n /** Gets the properties of a group. */\n get(\n options?: DeviceManagementGetGroupParameters\n ): Promise<DeviceManagementGetGroup200Response | DeviceManagementGetGroupdefaultResponse>;\n /** Create or update a device group. */\n put(\n options: DeviceManagementCreateOrUpdateGroupParameters\n ): Promise<\n | DeviceManagementCreateOrUpdateGroup200Response\n | DeviceManagementCreateOrUpdateGroupdefaultResponse\n >;\n /** Deletes a device group. */\n delete(\n options?: DeviceManagementDeleteGroupParameters\n ): Promise<DeviceManagementDeleteGroup204Response | DeviceManagementDeleteGroupdefaultResponse>;\n}\n\nexport interface DeviceManagementGetGroupUpdateCompliance {\n /** Get 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. */\n get(\n options?: DeviceManagementGetGroupUpdateComplianceParameters\n ): Promise<\n | DeviceManagementGetGroupUpdateCompliance200Response\n | DeviceManagementGetGroupUpdateCompliancedefaultResponse\n >;\n}\n\nexport interface DeviceManagementListBestUpdatesForGroup {\n /** Get the best available updates for a group and a count of how many devices need each update. */\n get(\n options?: DeviceManagementListBestUpdatesForGroupParameters\n ): Promise<\n | DeviceManagementListBestUpdatesForGroup200Response\n | DeviceManagementListBestUpdatesForGroupdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListDeploymentsForGroup {\n /** Gets a list of deployments for a group. */\n get(\n options?: DeviceManagementListDeploymentsForGroupParameters\n ): Promise<\n | DeviceManagementListDeploymentsForGroup200Response\n | DeviceManagementListDeploymentsForGroupdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetDeployment {\n /** Gets the properties of a deployment. */\n get(\n options?: DeviceManagementGetDeploymentParameters\n ): Promise<\n DeviceManagementGetDeployment200Response | DeviceManagementGetDeploymentdefaultResponse\n >;\n /** Creates or updates a deployment. */\n put(\n options: DeviceManagementCreateOrUpdateDeploymentParameters\n ): Promise<\n | DeviceManagementCreateOrUpdateDeployment200Response\n | DeviceManagementCreateOrUpdateDeploymentdefaultResponse\n >;\n /** Deletes a deployment. */\n delete(\n options?: DeviceManagementDeleteDeploymentParameters\n ): Promise<\n DeviceManagementDeleteDeployment204Response | DeviceManagementDeleteDeploymentdefaultResponse\n >;\n /** Stops a deployment. */\n post(\n options: DeviceManagementStopDeploymentParameters | DeviceManagementRetryDeploymentParameters\n ):\n | Promise<\n DeviceManagementStopDeployment200Response | DeviceManagementStopDeploymentdefaultResponse\n >\n | Promise<\n DeviceManagementRetryDeployment200Response | DeviceManagementRetryDeploymentdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetDeploymentStatus {\n /** Gets the status of a deployment including a breakdown of how many devices in the deployment are in progress, completed, or failed. */\n get(\n options?: DeviceManagementGetDeploymentStatusParameters\n ): Promise<\n | DeviceManagementGetDeploymentStatus200Response\n | DeviceManagementGetDeploymentStatusdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListDeploymentDevices {\n /** Gets a list of devices in a deployment along with their state. Useful for getting a list of failed devices. */\n get(\n options?: DeviceManagementListDeploymentDevicesParameters\n ): Promise<\n | DeviceManagementListDeploymentDevices200Response\n | DeviceManagementListDeploymentDevicesdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetOperation {\n /** Retrieve operation status. */\n get(\n options?: DeviceManagementGetOperationParameters\n ): Promise<\n | DeviceManagementGetOperation200Response\n | DeviceManagementGetOperation304Response\n | DeviceManagementGetOperationdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListOperations {\n /** Get a list of all device import operations. Completed operations are kept for 7 days before auto-deleted. */\n get(\n options?: DeviceManagementListOperationsParameters\n ): Promise<\n DeviceManagementListOperations200Response | DeviceManagementListOperationsdefaultResponse\n >;\n}\n\nexport interface DeviceManagementCollectLogs {\n /** Start the device diagnostics log collection operation on specified devices. */\n put(\n options: DeviceManagementCollectLogsParameters\n ): Promise<DeviceManagementCollectLogs201Response | DeviceManagementCollectLogsdefaultResponse>;\n /** Get the device diagnostics log collection operation */\n get(\n options?: DeviceManagementGetLogCollectionOperationParameters\n ): Promise<\n | DeviceManagementGetLogCollectionOperation200Response\n | DeviceManagementGetLogCollectionOperationdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListLogCollectionOperations {\n /** Get all device diagnostics log collection operations */\n get(\n options?: DeviceManagementListLogCollectionOperationsParameters\n ): Promise<\n | DeviceManagementListLogCollectionOperations200Response\n | DeviceManagementListLogCollectionOperationsdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetLogCollectionOperationDetailedStatus {\n /** Get device diagnostics log collection operation with detailed status */\n get(\n options?: DeviceManagementGetLogCollectionOperationDetailedStatusParameters\n ): Promise<\n | DeviceManagementGetLogCollectionOperationDetailedStatus200Response\n | DeviceManagementGetLogCollectionOperationDetailedStatusdefaultResponse\n >;\n}\n\nexport interface Routes {\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates' has methods for the following verbs: post, get */\n (path: \"/deviceupdate/{instanceId}/updates\", instanceId: string): DeviceUpdateImportUpdate;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/providers/\\{provider\\}/names/\\{name\\}/versions/\\{version\\}' has methods for the following verbs: get, delete */\n (\n path: \"/deviceupdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}\",\n instanceId: string,\n provider: string,\n name: string,\n version: string\n ): DeviceUpdateGetUpdate;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/providers' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/providers\",\n instanceId: string\n ): DeviceUpdateListProviders;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/providers/\\{provider\\}/names' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/providers/{provider}/names\",\n instanceId: string,\n provider: string\n ): DeviceUpdateListNames;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/providers/\\{provider\\}/names/\\{name\\}/versions' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/providers/{provider}/names/{name}/versions\",\n instanceId: string,\n provider: string,\n name: string\n ): DeviceUpdateListVersions;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/providers/\\{provider\\}/names/\\{name\\}/versions/\\{version\\}/files' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}/files\",\n instanceId: string,\n provider: string,\n name: string,\n version: string\n ): DeviceUpdateListFiles;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/providers/\\{provider\\}/names/\\{name\\}/versions/\\{version\\}/files/\\{fileId\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}/files/{fileId}\",\n instanceId: string,\n provider: string,\n name: string,\n version: string,\n fileId: string\n ): DeviceUpdateGetFile;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/operations' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/operations\",\n instanceId: string\n ): DeviceUpdateListOperations;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/operations/\\{operationId\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/operations/{operationId}\",\n instanceId: string,\n operationId: string\n ): DeviceUpdateGetOperation;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/deviceclasses' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/deviceclasses\",\n instanceId: string\n ): DeviceManagementListDeviceClasses;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/deviceclasses/\\{deviceClassId\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/deviceclasses/{deviceClassId}\",\n instanceId: string,\n deviceClassId: string\n ): DeviceManagementGetDeviceClass;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/deviceclasses/\\{deviceClassId\\}/installableupdates' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/deviceclasses/{deviceClassId}/installableupdates\",\n instanceId: string,\n deviceClassId: string\n ): DeviceManagementListInstallableUpdatesForDeviceClass;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/devices' has methods for the following verbs: get, post */\n (\n path: \"/deviceupdate/{instanceId}/management/devices\",\n instanceId: string\n ): DeviceManagementListDevices;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/devices/\\{deviceId\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/devices/{deviceId}\",\n instanceId: string,\n deviceId: string\n ): DeviceManagementGetDevice;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/devices/\\{deviceId\\}/modules/\\{moduleId\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/devices/{deviceId}/modules/{moduleId}\",\n instanceId: string,\n deviceId: string,\n moduleId: string\n ): DeviceManagementGetDeviceModule;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/updatecompliance' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/updatecompliance\",\n instanceId: string\n ): DeviceManagementGetUpdateCompliance;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/devicetags' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/devicetags\",\n instanceId: string\n ): DeviceManagementListDeviceTags;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/devicetags/\\{tagName\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/devicetags/{tagName}\",\n instanceId: string,\n tagName: string\n ): DeviceManagementGetDeviceTag;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/groups\",\n instanceId: string\n ): DeviceManagementListGroups;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}' has methods for the following verbs: get, put, delete */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}\",\n instanceId: string,\n groupId: string\n ): DeviceManagementGetGroup;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}/updateCompliance' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}/updateCompliance\",\n instanceId: string,\n groupId: string\n ): DeviceManagementGetGroupUpdateCompliance;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}/bestUpdates' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}/bestUpdates\",\n instanceId: string,\n groupId: string\n ): DeviceManagementListBestUpdatesForGroup;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}/deployments' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}/deployments\",\n instanceId: string,\n groupId: string\n ): DeviceManagementListDeploymentsForGroup;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}/deployments/\\{deploymentId\\}' has methods for the following verbs: get, put, delete, post */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}\",\n instanceId: string,\n groupId: string,\n deploymentId: string\n ): DeviceManagementGetDeployment;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}/deployments/\\{deploymentId\\}/status' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}/status\",\n instanceId: string,\n groupId: string,\n deploymentId: string\n ): DeviceManagementGetDeploymentStatus;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}/deployments/\\{deploymentId\\}/devicestates' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}/devicestates\",\n instanceId: string,\n groupId: string,\n deploymentId: string\n ): DeviceManagementListDeploymentDevices;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/operations/\\{operationId\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/operations/{operationId}\",\n instanceId: string,\n operationId: string\n ): DeviceManagementGetOperation;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/operations' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/operations\",\n instanceId: string\n ): DeviceManagementListOperations;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/deviceDiagnostics/logCollections/\\{operationId\\}' has methods for the following verbs: put, get */\n (\n path: \"/deviceupdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}\",\n instanceId: string,\n operationId: string\n ): DeviceManagementCollectLogs;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/deviceDiagnostics/logCollections' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/deviceDiagnostics/logCollections\",\n instanceId: string\n ): DeviceManagementListLogCollectionOperations;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/deviceDiagnostics/logCollections/\\{operationId\\}/detailedStatus' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}/detailedStatus\",\n instanceId: string,\n operationId: string\n ): DeviceManagementGetLogCollectionOperationDetailedStatus;\n}\n\nexport type DeviceUpdateRestClient = Client & {\n path: Routes;\n};\n\nexport default function DeviceUpdate(\n endpoint: string,\n credentials: TokenCredential,\n options: ClientOptions = {}\n): DeviceUpdateRestClient {\n const baseUrl = options.baseUrl ?? `https://${endpoint}`;\n options.apiVersion = options.apiVersion ?? \"2021-06-01-preview\";\n options = {\n ...options,\n credentials: {\n scopes: [\"https://api.adu.microsoft.com/.default\"],\n },\n };\n\n return getClient(baseUrl, credentials, options) as DeviceUpdateRestClient;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { PagedAsyncIterableIterator, PagedResult, getPagedAsyncIterator } from \"@azure/core-paging\";\nimport { Client, PathUncheckedResponse, createRestError } from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends {\n body: { value?: infer TPage };\n}\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {}\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n const itemName = \"value\";\n const nextLinkName = \"nextLink\";\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink,\n };\n },\n };\n\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\") {\n throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse): void {\n const Http2xxStatusCodes = [\"200\", \"201\", \"202\", \"203\", \"204\", \"205\", \"206\", \"207\", \"208\", \"226\"];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport {\n LongRunningOperation,\n LroEngine,\n LroEngineOptions,\n LroResponse,\n PollOperationState,\n PollerLike,\n} from \"@azure/core-lro\";\n\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: LroEngineOptions<TResult, PollOperationState<TResult>> = {}\n): PollerLike<PollOperationState<TResult>, TResult> {\n const poller: LongRunningOperation<TResult> = {\n requestMethod: initialResponse.request.method,\n requestPath: initialResponse.request.url,\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n const response = await client.pathUnchecked(path ?? initialResponse.request.url).get();\n return getLroResponse(response as TResult);\n },\n };\n\n return new LroEngine(poller, options);\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO engine knows about\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO engine can work with\n */\nfunction getLroResponse<TResult extends HttpResponse>(response: TResult): LroResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport DeviceUpdate from \"./deviceUpdate\";\n\nexport * from \"./deviceUpdate\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./paginateHelper\";\nexport * from \"./pollingHelper\";\n\nexport default DeviceUpdate;\n"],"names":["getClient","getPagedAsyncIterator","createRestError","LroEngine"],"mappings":";;;;;;;;AAAA;SAgpBwB,YAAY,CAClC,QAAgB,EAChB,WAA4B,EAC5B,UAAyB,EAAE;;IAE3B,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,WAAW,QAAQ,EAAE,CAAC;IACzD,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,oBAAoB,CAAC;IAChE,OAAO,mCACF,OAAO,KACV,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,wCAAwC,CAAC;SACnD,GACF,CAAC;IAEF,OAAOA,oBAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAA2B,CAAC;AAC5E;;AC/pBA;AACA,AA4CA;;;;;;;AAOA,SAAgB,QAAQ,CACtB,MAAc,EACd,eAA0B,EAC1B,UAAoC,EAAE;IAItC,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,MAAM,QAAQ,GAAG,OAAO,CAAC;IACzB,MAAM,YAAY,GAAG,UAAU,CAAC;IAChC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAClC,MAAM,WAAW,GAA4B;QAC3C,aAAa,EAAE,EAAE;QACjB,OAAO,EACL,OAAO,aAAa,KAAK,UAAU;cAC/B,aAAa;cACb,OAAO,QAAgB;gBACrB,MAAM,MAAM,GAAG,QAAQ,GAAG,eAAe,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;gBACvF,QAAQ,GAAG,KAAK,CAAC;gBACjB,kBAAkB,CAAC,MAAM,CAAC,CAAC;gBAC3B,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;gBACxD,MAAM,MAAM,GAAG,WAAW,CAAW,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAC5D,OAAO;oBACL,IAAI,EAAE,MAAM;oBACZ,YAAY,EAAE,QAAQ;iBACvB,CAAC;aACH;KACR,CAAC;IAEF,OAAOC,gCAAqB,CAAC,WAAW,CAAC,CAAC;AAC5C,CAAC;AAED;;;AAGA,SAAS,WAAW,CAAC,IAAa,EAAE,YAAqB;IACvD,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,QAAQ,GAAI,IAAgC,CAAC,YAAY,CAAC,CAAC;IAEjE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACnE,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,kCAAkC,CAAC,CAAC;KAClF;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;AAGA,SAAS,WAAW,CAAc,IAAa,EAAE,QAAgB;IAC/D,MAAM,KAAK,GAAI,IAAgC,CAAC,QAAQ,CAAQ,CAAC;;;;IAKjE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACzB,MAAM,IAAI,KAAK,CACb,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;KACH;IAED,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;AACrB,CAAC;AAED;;;AAGA,SAAS,kBAAkB,CAAC,QAA+B;IACzD,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAClG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjD,MAAMC,0BAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;KACH;AACH,CAAC;;AClID;AACA,AAYA;;;;;;;AAOA,SAAgB,oBAAoB,CAClC,MAAc,EACd,eAAwB,EACxB,UAAkE,EAAE;IAEpE,MAAM,MAAM,GAAkC;QAC5C,aAAa,EAAE,eAAe,CAAC,OAAO,CAAC,MAAM;QAC7C,WAAW,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG;QACxC,kBAAkB,EAAE;;;;YAIlB,OAAO,cAAc,CAAC,eAAe,CAAC,CAAC;SACxC;QACD,eAAe,EAAE,OAAO,IAAI;;;;;YAK1B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;YACvF,OAAO,cAAc,CAAC,QAAmB,CAAC,CAAC;SAC5C;KACF,CAAC;IAEF,OAAO,IAAIC,iBAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED;;;;;AAKA,SAAS,cAAc,CAA+B,QAAiB;IACrE,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjC,MAAM,IAAI,SAAS,CAAC,uDAAuD,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;KAC/F;IAED,OAAO;QACL,YAAY,EAAE,QAAQ;QACtB,WAAW,kCACN,QAAQ,KACX,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI,GACpB;KACF,CAAC;AACJ,CAAC;;ACjED,uCAAuC;;;;;;"}
@@ -0,0 +1,13 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { getClient } from "@azure-rest/core-client";
4
+ export default function DeviceUpdate(endpoint, credentials, options = {}) {
5
+ var _a, _b;
6
+ const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `https://${endpoint}`;
7
+ options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2021-06-01-preview";
8
+ options = Object.assign(Object.assign({}, options), { credentials: {
9
+ scopes: ["https://api.adu.microsoft.com/.default"],
10
+ } });
11
+ return getClient(baseUrl, credentials, options);
12
+ }
13
+ //# sourceMappingURL=deviceUpdate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceUpdate.js","sourceRoot":"","sources":["../../src/deviceUpdate.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAqIlC,OAAO,EAAyB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AA0gB3E,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,QAAgB,EAChB,WAA4B,EAC5B,UAAyB,EAAE;;IAE3B,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,WAAW,QAAQ,EAAE,CAAC;IACzD,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,oBAAoB,CAAC;IAChE,OAAO,mCACF,OAAO,KACV,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,wCAAwC,CAAC;SACnD,GACF,CAAC;IAEF,OAAO,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAA2B,CAAC;AAC5E,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n DeviceManagementCollectLogsParameters,\n DeviceManagementCreateOrUpdateDeploymentParameters,\n DeviceManagementCreateOrUpdateGroupParameters,\n DeviceManagementDeleteDeploymentParameters,\n DeviceManagementDeleteGroupParameters,\n DeviceManagementGetDeploymentParameters,\n DeviceManagementGetDeploymentStatusParameters,\n DeviceManagementGetDeviceClassParameters,\n DeviceManagementGetDeviceModuleParameters,\n DeviceManagementGetDeviceParameters,\n DeviceManagementGetDeviceTagParameters,\n DeviceManagementGetGroupParameters,\n DeviceManagementGetGroupUpdateComplianceParameters,\n DeviceManagementGetLogCollectionOperationDetailedStatusParameters,\n DeviceManagementGetLogCollectionOperationParameters,\n DeviceManagementGetOperationParameters,\n DeviceManagementGetUpdateComplianceParameters,\n DeviceManagementImportDevicesParameters,\n DeviceManagementListBestUpdatesForGroupParameters,\n DeviceManagementListDeploymentDevicesParameters,\n DeviceManagementListDeploymentsForGroupParameters,\n DeviceManagementListDeviceClassesParameters,\n DeviceManagementListDeviceTagsParameters,\n DeviceManagementListDevicesParameters,\n DeviceManagementListGroupsParameters,\n DeviceManagementListInstallableUpdatesForDeviceClassParameters,\n DeviceManagementListLogCollectionOperationsParameters,\n DeviceManagementListOperationsParameters,\n DeviceManagementRetryDeploymentParameters,\n DeviceManagementStopDeploymentParameters,\n DeviceUpdateDeleteUpdateParameters,\n DeviceUpdateGetFileParameters,\n DeviceUpdateGetOperationParameters,\n DeviceUpdateGetUpdateParameters,\n DeviceUpdateImportUpdateParameters,\n DeviceUpdateListFilesParameters,\n DeviceUpdateListNamesParameters,\n DeviceUpdateListOperationsParameters,\n DeviceUpdateListProvidersParameters,\n DeviceUpdateListUpdatesParameters,\n DeviceUpdateListVersionsParameters,\n} from \"./parameters\";\nimport {\n DeviceManagementCollectLogs201Response,\n DeviceManagementCollectLogsdefaultResponse,\n DeviceManagementCreateOrUpdateDeployment200Response,\n DeviceManagementCreateOrUpdateDeploymentdefaultResponse,\n DeviceManagementCreateOrUpdateGroup200Response,\n DeviceManagementCreateOrUpdateGroupdefaultResponse,\n DeviceManagementDeleteDeployment204Response,\n DeviceManagementDeleteDeploymentdefaultResponse,\n DeviceManagementDeleteGroup204Response,\n DeviceManagementDeleteGroupdefaultResponse,\n DeviceManagementGetDeployment200Response,\n DeviceManagementGetDeploymentStatus200Response,\n DeviceManagementGetDeploymentStatusdefaultResponse,\n DeviceManagementGetDeploymentdefaultResponse,\n DeviceManagementGetDevice200Response,\n DeviceManagementGetDeviceClass200Response,\n DeviceManagementGetDeviceClassdefaultResponse,\n DeviceManagementGetDeviceModule200Response,\n DeviceManagementGetDeviceModuledefaultResponse,\n DeviceManagementGetDeviceTag200Response,\n DeviceManagementGetDeviceTagdefaultResponse,\n DeviceManagementGetDevicedefaultResponse,\n DeviceManagementGetGroup200Response,\n DeviceManagementGetGroupUpdateCompliance200Response,\n DeviceManagementGetGroupUpdateCompliancedefaultResponse,\n DeviceManagementGetGroupdefaultResponse,\n DeviceManagementGetLogCollectionOperation200Response,\n DeviceManagementGetLogCollectionOperationDetailedStatus200Response,\n DeviceManagementGetLogCollectionOperationDetailedStatusdefaultResponse,\n DeviceManagementGetLogCollectionOperationdefaultResponse,\n DeviceManagementGetOperation200Response,\n DeviceManagementGetOperation304Response,\n DeviceManagementGetOperationdefaultResponse,\n DeviceManagementGetUpdateCompliance200Response,\n DeviceManagementGetUpdateCompliancedefaultResponse,\n DeviceManagementImportDevices202Response,\n DeviceManagementImportDevicesdefaultResponse,\n DeviceManagementListBestUpdatesForGroup200Response,\n DeviceManagementListBestUpdatesForGroupdefaultResponse,\n DeviceManagementListDeploymentDevices200Response,\n DeviceManagementListDeploymentDevicesdefaultResponse,\n DeviceManagementListDeploymentsForGroup200Response,\n DeviceManagementListDeploymentsForGroupdefaultResponse,\n DeviceManagementListDeviceClasses200Response,\n DeviceManagementListDeviceClassesdefaultResponse,\n DeviceManagementListDeviceTags200Response,\n DeviceManagementListDeviceTagsdefaultResponse,\n DeviceManagementListDevices200Response,\n DeviceManagementListDevicesdefaultResponse,\n DeviceManagementListGroups200Response,\n DeviceManagementListGroupsdefaultResponse,\n DeviceManagementListInstallableUpdatesForDeviceClass200Response,\n DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse,\n DeviceManagementListLogCollectionOperations200Response,\n DeviceManagementListLogCollectionOperationsdefaultResponse,\n DeviceManagementListOperations200Response,\n DeviceManagementListOperationsdefaultResponse,\n DeviceManagementRetryDeployment200Response,\n DeviceManagementRetryDeploymentdefaultResponse,\n DeviceManagementStopDeployment200Response,\n DeviceManagementStopDeploymentdefaultResponse,\n DeviceUpdateDeleteUpdate202Response,\n DeviceUpdateDeleteUpdatedefaultResponse,\n DeviceUpdateGetFile200Response,\n DeviceUpdateGetFile304Response,\n DeviceUpdateGetFiledefaultResponse,\n DeviceUpdateGetOperation200Response,\n DeviceUpdateGetOperation304Response,\n DeviceUpdateGetOperationdefaultResponse,\n DeviceUpdateGetUpdate200Response,\n DeviceUpdateGetUpdate304Response,\n DeviceUpdateGetUpdatedefaultResponse,\n DeviceUpdateImportUpdate202Response,\n DeviceUpdateImportUpdatedefaultResponse,\n DeviceUpdateListFiles200Response,\n DeviceUpdateListFilesdefaultResponse,\n DeviceUpdateListNames200Response,\n DeviceUpdateListNamesdefaultResponse,\n DeviceUpdateListOperations200Response,\n DeviceUpdateListOperationsdefaultResponse,\n DeviceUpdateListProviders200Response,\n DeviceUpdateListProvidersdefaultResponse,\n DeviceUpdateListUpdates200Response,\n DeviceUpdateListUpdatesdefaultResponse,\n DeviceUpdateListVersions200Response,\n DeviceUpdateListVersionsdefaultResponse,\n} from \"./responses\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport interface DeviceUpdateImportUpdate {\n /** Import new update version. */\n post(\n options: DeviceUpdateImportUpdateParameters\n ): Promise<DeviceUpdateImportUpdate202Response | DeviceUpdateImportUpdatedefaultResponse>;\n /** Get a list of all updates that have been imported to Device Update for IoT Hub. */\n get(\n options?: DeviceUpdateListUpdatesParameters\n ): Promise<DeviceUpdateListUpdates200Response | DeviceUpdateListUpdatesdefaultResponse>;\n}\n\nexport interface DeviceUpdateGetUpdate {\n /** Get a specific update version. */\n get(\n options?: DeviceUpdateGetUpdateParameters\n ): Promise<\n | DeviceUpdateGetUpdate200Response\n | DeviceUpdateGetUpdate304Response\n | DeviceUpdateGetUpdatedefaultResponse\n >;\n /** Delete a specific update version. */\n delete(\n options?: DeviceUpdateDeleteUpdateParameters\n ): Promise<DeviceUpdateDeleteUpdate202Response | DeviceUpdateDeleteUpdatedefaultResponse>;\n}\n\nexport interface DeviceUpdateListProviders {\n /** Get a list of all update providers that have been imported to Device Update for IoT Hub. */\n get(\n options?: DeviceUpdateListProvidersParameters\n ): Promise<DeviceUpdateListProviders200Response | DeviceUpdateListProvidersdefaultResponse>;\n}\n\nexport interface DeviceUpdateListNames {\n /** Get a list of all update names that match the specified provider. */\n get(\n options?: DeviceUpdateListNamesParameters\n ): Promise<DeviceUpdateListNames200Response | DeviceUpdateListNamesdefaultResponse>;\n}\n\nexport interface DeviceUpdateListVersions {\n /** Get a list of all update versions that match the specified provider and name. */\n get(\n options?: DeviceUpdateListVersionsParameters\n ): Promise<DeviceUpdateListVersions200Response | DeviceUpdateListVersionsdefaultResponse>;\n}\n\nexport interface DeviceUpdateListFiles {\n /** Get a list of all update file identifiers for the specified version. */\n get(\n options?: DeviceUpdateListFilesParameters\n ): Promise<DeviceUpdateListFiles200Response | DeviceUpdateListFilesdefaultResponse>;\n}\n\nexport interface DeviceUpdateGetFile {\n /** Get a specific update file from the version. */\n get(\n options?: DeviceUpdateGetFileParameters\n ): Promise<\n | DeviceUpdateGetFile200Response\n | DeviceUpdateGetFile304Response\n | DeviceUpdateGetFiledefaultResponse\n >;\n}\n\nexport interface DeviceUpdateListOperations {\n /** 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. */\n get(\n options?: DeviceUpdateListOperationsParameters\n ): Promise<DeviceUpdateListOperations200Response | DeviceUpdateListOperationsdefaultResponse>;\n}\n\nexport interface DeviceUpdateGetOperation {\n /** Retrieve operation status. */\n get(\n options?: DeviceUpdateGetOperationParameters\n ): Promise<\n | DeviceUpdateGetOperation200Response\n | DeviceUpdateGetOperation304Response\n | DeviceUpdateGetOperationdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListDeviceClasses {\n /** Gets a list of all device classes (unique combinations of device manufacturer and model) for all devices connected to Device Update for IoT Hub. */\n get(\n options?: DeviceManagementListDeviceClassesParameters\n ): Promise<\n DeviceManagementListDeviceClasses200Response | DeviceManagementListDeviceClassesdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetDeviceClass {\n /** Gets the properties of a device class. */\n get(\n options?: DeviceManagementGetDeviceClassParameters\n ): Promise<\n DeviceManagementGetDeviceClass200Response | DeviceManagementGetDeviceClassdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListInstallableUpdatesForDeviceClass {\n /** Gets a list of installable updates for a device class. */\n get(\n options?: DeviceManagementListInstallableUpdatesForDeviceClassParameters\n ): Promise<\n | DeviceManagementListInstallableUpdatesForDeviceClass200Response\n | DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListDevices {\n /** Gets a list of devices connected to Device Update for IoT Hub. */\n get(\n options?: DeviceManagementListDevicesParameters\n ): Promise<DeviceManagementListDevices200Response | DeviceManagementListDevicesdefaultResponse>;\n /** Import existing devices from IoT Hub. */\n post(\n options: DeviceManagementImportDevicesParameters\n ): Promise<\n DeviceManagementImportDevices202Response | DeviceManagementImportDevicesdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetDevice {\n /** Gets the device properties and latest deployment status for a device connected to Device Update for IoT Hub. */\n get(\n options?: DeviceManagementGetDeviceParameters\n ): Promise<DeviceManagementGetDevice200Response | DeviceManagementGetDevicedefaultResponse>;\n}\n\nexport interface DeviceManagementGetDeviceModule {\n /** Gets the device module properties and latest deployment status for a device module connected to Device Update for IoT Hub. */\n get(\n options?: DeviceManagementGetDeviceModuleParameters\n ): Promise<\n DeviceManagementGetDeviceModule200Response | DeviceManagementGetDeviceModuledefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetUpdateCompliance {\n /** Gets the breakdown of how many devices are on their latest update, have new updates available, or are in progress receiving new updates. */\n get(\n options?: DeviceManagementGetUpdateComplianceParameters\n ): Promise<\n | DeviceManagementGetUpdateCompliance200Response\n | DeviceManagementGetUpdateCompliancedefaultResponse\n >;\n}\n\nexport interface DeviceManagementListDeviceTags {\n /** Gets a list of available group device tags for all devices connected to Device Update for IoT Hub. */\n get(\n options?: DeviceManagementListDeviceTagsParameters\n ): Promise<\n DeviceManagementListDeviceTags200Response | DeviceManagementListDeviceTagsdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetDeviceTag {\n /** Gets a count of how many devices have a device tag. */\n get(\n options?: DeviceManagementGetDeviceTagParameters\n ): Promise<DeviceManagementGetDeviceTag200Response | DeviceManagementGetDeviceTagdefaultResponse>;\n}\n\nexport interface DeviceManagementListGroups {\n /** Gets a list of all device groups. */\n get(\n options?: DeviceManagementListGroupsParameters\n ): Promise<DeviceManagementListGroups200Response | DeviceManagementListGroupsdefaultResponse>;\n}\n\nexport interface DeviceManagementGetGroup {\n /** Gets the properties of a group. */\n get(\n options?: DeviceManagementGetGroupParameters\n ): Promise<DeviceManagementGetGroup200Response | DeviceManagementGetGroupdefaultResponse>;\n /** Create or update a device group. */\n put(\n options: DeviceManagementCreateOrUpdateGroupParameters\n ): Promise<\n | DeviceManagementCreateOrUpdateGroup200Response\n | DeviceManagementCreateOrUpdateGroupdefaultResponse\n >;\n /** Deletes a device group. */\n delete(\n options?: DeviceManagementDeleteGroupParameters\n ): Promise<DeviceManagementDeleteGroup204Response | DeviceManagementDeleteGroupdefaultResponse>;\n}\n\nexport interface DeviceManagementGetGroupUpdateCompliance {\n /** Get 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. */\n get(\n options?: DeviceManagementGetGroupUpdateComplianceParameters\n ): Promise<\n | DeviceManagementGetGroupUpdateCompliance200Response\n | DeviceManagementGetGroupUpdateCompliancedefaultResponse\n >;\n}\n\nexport interface DeviceManagementListBestUpdatesForGroup {\n /** Get the best available updates for a group and a count of how many devices need each update. */\n get(\n options?: DeviceManagementListBestUpdatesForGroupParameters\n ): Promise<\n | DeviceManagementListBestUpdatesForGroup200Response\n | DeviceManagementListBestUpdatesForGroupdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListDeploymentsForGroup {\n /** Gets a list of deployments for a group. */\n get(\n options?: DeviceManagementListDeploymentsForGroupParameters\n ): Promise<\n | DeviceManagementListDeploymentsForGroup200Response\n | DeviceManagementListDeploymentsForGroupdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetDeployment {\n /** Gets the properties of a deployment. */\n get(\n options?: DeviceManagementGetDeploymentParameters\n ): Promise<\n DeviceManagementGetDeployment200Response | DeviceManagementGetDeploymentdefaultResponse\n >;\n /** Creates or updates a deployment. */\n put(\n options: DeviceManagementCreateOrUpdateDeploymentParameters\n ): Promise<\n | DeviceManagementCreateOrUpdateDeployment200Response\n | DeviceManagementCreateOrUpdateDeploymentdefaultResponse\n >;\n /** Deletes a deployment. */\n delete(\n options?: DeviceManagementDeleteDeploymentParameters\n ): Promise<\n DeviceManagementDeleteDeployment204Response | DeviceManagementDeleteDeploymentdefaultResponse\n >;\n /** Stops a deployment. */\n post(\n options: DeviceManagementStopDeploymentParameters | DeviceManagementRetryDeploymentParameters\n ):\n | Promise<\n DeviceManagementStopDeployment200Response | DeviceManagementStopDeploymentdefaultResponse\n >\n | Promise<\n DeviceManagementRetryDeployment200Response | DeviceManagementRetryDeploymentdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetDeploymentStatus {\n /** Gets the status of a deployment including a breakdown of how many devices in the deployment are in progress, completed, or failed. */\n get(\n options?: DeviceManagementGetDeploymentStatusParameters\n ): Promise<\n | DeviceManagementGetDeploymentStatus200Response\n | DeviceManagementGetDeploymentStatusdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListDeploymentDevices {\n /** Gets a list of devices in a deployment along with their state. Useful for getting a list of failed devices. */\n get(\n options?: DeviceManagementListDeploymentDevicesParameters\n ): Promise<\n | DeviceManagementListDeploymentDevices200Response\n | DeviceManagementListDeploymentDevicesdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetOperation {\n /** Retrieve operation status. */\n get(\n options?: DeviceManagementGetOperationParameters\n ): Promise<\n | DeviceManagementGetOperation200Response\n | DeviceManagementGetOperation304Response\n | DeviceManagementGetOperationdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListOperations {\n /** Get a list of all device import operations. Completed operations are kept for 7 days before auto-deleted. */\n get(\n options?: DeviceManagementListOperationsParameters\n ): Promise<\n DeviceManagementListOperations200Response | DeviceManagementListOperationsdefaultResponse\n >;\n}\n\nexport interface DeviceManagementCollectLogs {\n /** Start the device diagnostics log collection operation on specified devices. */\n put(\n options: DeviceManagementCollectLogsParameters\n ): Promise<DeviceManagementCollectLogs201Response | DeviceManagementCollectLogsdefaultResponse>;\n /** Get the device diagnostics log collection operation */\n get(\n options?: DeviceManagementGetLogCollectionOperationParameters\n ): Promise<\n | DeviceManagementGetLogCollectionOperation200Response\n | DeviceManagementGetLogCollectionOperationdefaultResponse\n >;\n}\n\nexport interface DeviceManagementListLogCollectionOperations {\n /** Get all device diagnostics log collection operations */\n get(\n options?: DeviceManagementListLogCollectionOperationsParameters\n ): Promise<\n | DeviceManagementListLogCollectionOperations200Response\n | DeviceManagementListLogCollectionOperationsdefaultResponse\n >;\n}\n\nexport interface DeviceManagementGetLogCollectionOperationDetailedStatus {\n /** Get device diagnostics log collection operation with detailed status */\n get(\n options?: DeviceManagementGetLogCollectionOperationDetailedStatusParameters\n ): Promise<\n | DeviceManagementGetLogCollectionOperationDetailedStatus200Response\n | DeviceManagementGetLogCollectionOperationDetailedStatusdefaultResponse\n >;\n}\n\nexport interface Routes {\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates' has methods for the following verbs: post, get */\n (path: \"/deviceupdate/{instanceId}/updates\", instanceId: string): DeviceUpdateImportUpdate;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/providers/\\{provider\\}/names/\\{name\\}/versions/\\{version\\}' has methods for the following verbs: get, delete */\n (\n path: \"/deviceupdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}\",\n instanceId: string,\n provider: string,\n name: string,\n version: string\n ): DeviceUpdateGetUpdate;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/providers' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/providers\",\n instanceId: string\n ): DeviceUpdateListProviders;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/providers/\\{provider\\}/names' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/providers/{provider}/names\",\n instanceId: string,\n provider: string\n ): DeviceUpdateListNames;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/providers/\\{provider\\}/names/\\{name\\}/versions' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/providers/{provider}/names/{name}/versions\",\n instanceId: string,\n provider: string,\n name: string\n ): DeviceUpdateListVersions;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/providers/\\{provider\\}/names/\\{name\\}/versions/\\{version\\}/files' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}/files\",\n instanceId: string,\n provider: string,\n name: string,\n version: string\n ): DeviceUpdateListFiles;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/providers/\\{provider\\}/names/\\{name\\}/versions/\\{version\\}/files/\\{fileId\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/providers/{provider}/names/{name}/versions/{version}/files/{fileId}\",\n instanceId: string,\n provider: string,\n name: string,\n version: string,\n fileId: string\n ): DeviceUpdateGetFile;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/operations' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/operations\",\n instanceId: string\n ): DeviceUpdateListOperations;\n /** Resource for '/deviceupdate/\\{instanceId\\}/updates/operations/\\{operationId\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/updates/operations/{operationId}\",\n instanceId: string,\n operationId: string\n ): DeviceUpdateGetOperation;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/deviceclasses' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/deviceclasses\",\n instanceId: string\n ): DeviceManagementListDeviceClasses;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/deviceclasses/\\{deviceClassId\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/deviceclasses/{deviceClassId}\",\n instanceId: string,\n deviceClassId: string\n ): DeviceManagementGetDeviceClass;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/deviceclasses/\\{deviceClassId\\}/installableupdates' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/deviceclasses/{deviceClassId}/installableupdates\",\n instanceId: string,\n deviceClassId: string\n ): DeviceManagementListInstallableUpdatesForDeviceClass;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/devices' has methods for the following verbs: get, post */\n (\n path: \"/deviceupdate/{instanceId}/management/devices\",\n instanceId: string\n ): DeviceManagementListDevices;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/devices/\\{deviceId\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/devices/{deviceId}\",\n instanceId: string,\n deviceId: string\n ): DeviceManagementGetDevice;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/devices/\\{deviceId\\}/modules/\\{moduleId\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/devices/{deviceId}/modules/{moduleId}\",\n instanceId: string,\n deviceId: string,\n moduleId: string\n ): DeviceManagementGetDeviceModule;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/updatecompliance' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/updatecompliance\",\n instanceId: string\n ): DeviceManagementGetUpdateCompliance;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/devicetags' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/devicetags\",\n instanceId: string\n ): DeviceManagementListDeviceTags;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/devicetags/\\{tagName\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/devicetags/{tagName}\",\n instanceId: string,\n tagName: string\n ): DeviceManagementGetDeviceTag;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/groups\",\n instanceId: string\n ): DeviceManagementListGroups;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}' has methods for the following verbs: get, put, delete */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}\",\n instanceId: string,\n groupId: string\n ): DeviceManagementGetGroup;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}/updateCompliance' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}/updateCompliance\",\n instanceId: string,\n groupId: string\n ): DeviceManagementGetGroupUpdateCompliance;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}/bestUpdates' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}/bestUpdates\",\n instanceId: string,\n groupId: string\n ): DeviceManagementListBestUpdatesForGroup;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}/deployments' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}/deployments\",\n instanceId: string,\n groupId: string\n ): DeviceManagementListDeploymentsForGroup;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}/deployments/\\{deploymentId\\}' has methods for the following verbs: get, put, delete, post */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}\",\n instanceId: string,\n groupId: string,\n deploymentId: string\n ): DeviceManagementGetDeployment;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}/deployments/\\{deploymentId\\}/status' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}/status\",\n instanceId: string,\n groupId: string,\n deploymentId: string\n ): DeviceManagementGetDeploymentStatus;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/groups/\\{groupId\\}/deployments/\\{deploymentId\\}/devicestates' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/groups/{groupId}/deployments/{deploymentId}/devicestates\",\n instanceId: string,\n groupId: string,\n deploymentId: string\n ): DeviceManagementListDeploymentDevices;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/operations/\\{operationId\\}' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/operations/{operationId}\",\n instanceId: string,\n operationId: string\n ): DeviceManagementGetOperation;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/operations' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/operations\",\n instanceId: string\n ): DeviceManagementListOperations;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/deviceDiagnostics/logCollections/\\{operationId\\}' has methods for the following verbs: put, get */\n (\n path: \"/deviceupdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}\",\n instanceId: string,\n operationId: string\n ): DeviceManagementCollectLogs;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/deviceDiagnostics/logCollections' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/deviceDiagnostics/logCollections\",\n instanceId: string\n ): DeviceManagementListLogCollectionOperations;\n /** Resource for '/deviceupdate/\\{instanceId\\}/management/deviceDiagnostics/logCollections/\\{operationId\\}/detailedStatus' has methods for the following verbs: get */\n (\n path: \"/deviceupdate/{instanceId}/management/deviceDiagnostics/logCollections/{operationId}/detailedStatus\",\n instanceId: string,\n operationId: string\n ): DeviceManagementGetLogCollectionOperationDetailedStatus;\n}\n\nexport type DeviceUpdateRestClient = Client & {\n path: Routes;\n};\n\nexport default function DeviceUpdate(\n endpoint: string,\n credentials: TokenCredential,\n options: ClientOptions = {}\n): DeviceUpdateRestClient {\n const baseUrl = options.baseUrl ?? `https://${endpoint}`;\n options.apiVersion = options.apiVersion ?? \"2021-06-01-preview\";\n options = {\n ...options,\n credentials: {\n scopes: [\"https://api.adu.microsoft.com/.default\"],\n },\n };\n\n return getClient(baseUrl, credentials, options) as DeviceUpdateRestClient;\n}\n"]}
@@ -0,0 +1,12 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import DeviceUpdate from "./deviceUpdate";
4
+ export * from "./deviceUpdate";
5
+ export * from "./parameters";
6
+ export * from "./responses";
7
+ export * from "./models";
8
+ export * from "./outputModels";
9
+ export * from "./paginateHelper";
10
+ export * from "./pollingHelper";
11
+ export default DeviceUpdate;
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAEhC,eAAe,YAAY,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport DeviceUpdate from \"./deviceUpdate\";\n\nexport * from \"./deviceUpdate\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./paginateHelper\";\nexport * from \"./pollingHelper\";\n\nexport default DeviceUpdate;\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export {};
4
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport interface ImportUpdateInputItem {\n /** Import manifest metadata like source URL, file size/hashes, etc. */\n importManifest: ImportManifestMetadata;\n /** Friendly update name. */\n friendlyName?: string;\n /** One or more update file properties like filename and source URL. */\n files?: Array<FileImportMetadata>;\n}\n\nexport interface ImportManifestMetadata {\n /** 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. */\n url: string;\n /** File size in number of bytes. */\n sizeInBytes: number;\n /** A JSON object containing the hash(es) of the file. At least SHA256 hash is required. This object can be thought of as a set of key-value pairs where the key is the hash algorithm, and the value is the hash of the file calculated using that algorithm. */\n hashes: Record<string, string>;\n}\n\nexport interface FileImportMetadata {\n /** Update file name as specified inside import manifest. */\n filename: string;\n /** Azure Blob location from which the update file can be downloaded by Device Update for IoT Hub. This is typically a read-only SAS-protected blob URL with an expiration set to at least 4 hours. */\n url: string;\n}\n\nexport interface UpdateId {\n /** Update provider. */\n provider: string;\n /** Update name. */\n name: string;\n /** Update version. */\n version: string;\n}\n\nexport interface Group {\n /** Group identity. */\n groupId: string;\n /** Group type. */\n groupType:\n | \"DeviceClassIdAndIoTHubTag\"\n | \"InvalidDeviceClassIdAndIoTHubTag\"\n | \"DefaultDeviceClassId\";\n /** IoT Hub tags. */\n tags: Array<string>;\n /** Date and time when the update was created. */\n createdDateTime: string;\n /** The number of devices in the group. */\n deviceCount?: number;\n /** The deployment Id for the group. */\n deploymentId?: string;\n /** The device class Id for the group. */\n deviceClassId?: string;\n}\n\nexport interface Deployment {\n /** The deployment identifier. */\n deploymentId: string;\n /** The deployment start datetime. */\n startDateTime: string;\n /** Update identity. */\n updateId: UpdateId;\n /** The group identity */\n groupId: string;\n /** Boolean flag indicating whether the deployment was canceled. */\n isCanceled?: boolean;\n /** Boolean flag indicating whether the deployment has been retried. */\n isRetried?: boolean;\n}\n\nexport interface LogCollectionOperation {\n /** The diagnostics operation id. */\n operationId?: string;\n /** Array of Device Update agent ids */\n deviceList: Array<DeviceUpdateAgentId>;\n /** Description of the diagnostics operation. */\n description?: string;\n /** The timestamp when the operation was created. */\n createdDateTime?: string;\n /** A timestamp for when the current state was entered. */\n lastActionDateTime?: string;\n /** Operation status. */\n status?: \"Undefined\" | \"NotStarted\" | \"Running\" | \"Succeeded\" | \"Failed\";\n}\n\nexport interface DeviceUpdateAgentId {\n /** Device Id */\n deviceId: string;\n /** Module Id */\n moduleId?: string;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export {};
4
+ //# sourceMappingURL=outputModels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport interface UpdateOutput {\n /** Update identity. */\n updateId: UpdateIdOutput;\n /** Update description specified by creator. */\n description?: string;\n /** Friendly update name specified by importer. */\n friendlyName?: string;\n /** Whether the update can be deployed to a device on its own. */\n isDeployable?: boolean;\n /** Update type. Deprecated in latest import manifest schema. */\n updateType?: string;\n /** String interpreted by Device Update client to determine if the update is installed on the device. Deprecated in latest import manifest schema. */\n installedCriteria?: string;\n /** List of update compatibility information. */\n compatibility: Array<Record<string, string>>;\n /** Update install instructions. */\n instructions?: InstructionsOutput;\n /** List of update identities that reference this update. */\n referencedBy?: Array<UpdateIdOutput>;\n /** Update aggregate scan result (calculated from payload file scan results). */\n scanResult?: string;\n /** Schema version of manifest used to import the update. */\n manifestVersion: string;\n /** Date and time in UTC when the update was imported. */\n importedDateTime: string;\n /** Date and time in UTC when the update was created. */\n createdDateTime: string;\n /** Update ETag. */\n etag?: string;\n}\n\nexport interface UpdateIdOutput {\n /** Update provider. */\n provider: string;\n /** Update name. */\n name: string;\n /** Update version. */\n version: string;\n}\n\nexport interface InstructionsOutput {\n /** Collection of installation steps. */\n steps: Array<StepOutput>;\n}\n\nexport interface StepOutput {\n /** Step type. */\n type?: \"Inline\" | \"Reference\";\n /** Step description. */\n description?: string;\n /** Identity of handler that will execute this step. Required if step type is inline. */\n handler?: string;\n /** Parameters to be passed to handler during execution. */\n handlerProperties?: Record<string, unknown>;\n /** Collection of file names to be passed to handler during execution. Required if step type is inline. */\n files?: Array<string>;\n /** Referenced child update identity. Required if step type is reference. */\n updateId?: UpdateIdOutput;\n}\n\nexport interface ErrorResponseOutput {\n /** The error details. */\n error: ErrorModelOutput;\n}\n\nexport interface ErrorModelOutput {\n /** Server defined error code. */\n code: string;\n /** A human-readable representation of the error. */\n message: string;\n /** The target of the error. */\n target?: string;\n /** An array of errors that led to the reported error. */\n details?: Array<ErrorModelOutput>;\n /** An object containing more specific information than the current object about the error. */\n innererror?: InnerErrorOutput;\n /** Date and time in UTC when the error occurred. */\n occurredDateTime?: string;\n}\n\nexport interface InnerErrorOutput {\n /** A more specific error code than what was provided by the containing error. */\n code: string;\n /** A human-readable representation of the error. */\n message?: string;\n /** The internal error or exception message. */\n errorDetail?: string;\n /** An object containing more specific information than the current object about the error. */\n innerError?: InnerErrorOutput;\n}\n\nexport interface UpdateListOutput {\n /** The collection of pageable items. */\n value: Array<UpdateOutput>;\n /** The link to the next page of items. */\n nextLink?: string;\n}\n\nexport interface StringsListOutput {\n /** The collection of pageable items. */\n value: Array<string>;\n /** The link to the next page of items. */\n nextLink?: string;\n}\n\nexport interface UpdateFileOutput {\n /** File identity, generated by server at import time. */\n fileId: string;\n /** File name. */\n fileName: string;\n /** File size in number of bytes. */\n sizeInBytes: number;\n /** Mapping of hashing algorithm to base64 encoded hash values. */\n hashes: Record<string, string>;\n /** File MIME type. */\n mimeType?: string;\n /** Anti-malware scan result. */\n scanResult?: string;\n /** Anti-malware scan details. */\n scanDetails?: string;\n /** File ETag. */\n etag?: string;\n}\n\nexport interface UpdateOperationsListOutput {\n /** The collection of pageable items. */\n value: Array<UpdateOperationOutput>;\n /** The link to the next page of items. */\n nextLink?: string;\n}\n\nexport interface UpdateOperationOutput {\n /** Operation Id. */\n operationId: string;\n /** Operation status. */\n status: \"Undefined\" | \"NotStarted\" | \"Running\" | \"Succeeded\" | \"Failed\";\n /** The identity of update being imported or deleted. For import, this property will only be populated after import manifest is processed successfully. */\n updateId?: UpdateIdOutput;\n /** Location of the imported update when operation is successful. */\n resourceLocation?: string;\n /** Operation error encountered, if any. */\n error?: ErrorModelOutput;\n /** Operation correlation identity that can used by Microsoft Support for troubleshooting. */\n traceId?: string;\n /** Date and time in UTC when the operation status was last updated. */\n lastActionDateTime: string;\n /** Date and time in UTC when the operation was created. */\n createdDateTime: string;\n /** Operation ETag. */\n etag?: string;\n}\n\nexport interface DeviceClassesListOutput {\n /** The collection of pageable items. */\n value: Array<DeviceClassOutput>;\n /** The link to the next page of items. */\n nextLink?: string;\n}\n\nexport interface DeviceClassOutput {\n /** The device class identifier. */\n deviceClassId: string;\n /** The compat properties of the device class. This object can be thought of as a set of key-value pairs where the key is the name of the compatibility property and the value is the value of the compatibility property. There will always be at least 1 compat property */\n compatProperties: Record<string, string>;\n /** Update identity. */\n bestCompatibleUpdateId: UpdateIdOutput;\n}\n\nexport interface UpdateIdsListOutput {\n /** The collection of pageable items. */\n value: Array<UpdateIdOutput>;\n /** The link to the next page of items. */\n nextLink?: string;\n}\n\nexport interface DevicesListOutput {\n /** The collection of pageable items. */\n value: Array<DeviceOutput>;\n /** The link to the next page of items. */\n nextLink?: string;\n}\n\nexport interface DeviceOutput {\n /** Device identity. */\n deviceId: string;\n /** Device module identity. */\n moduleId?: string;\n /** Device class identity. */\n deviceClassId: string;\n /** Device manufacturer. */\n manufacturer: string;\n /** Device model. */\n model: string;\n /** Device group identity. */\n groupId?: string;\n /** Update identity. */\n lastAttemptedUpdateId?: UpdateIdOutput;\n /** State of the device in its last deployment. */\n deploymentStatus?: \"Succeeded\" | \"InProgress\" | \"Failed\" | \"Canceled\" | \"Incompatible\";\n /** Update identity. */\n installedUpdateId?: UpdateIdOutput;\n /** Boolean flag indicating whether the latest update is installed on the device */\n onLatestUpdate: boolean;\n /** The deployment identifier for the last deployment to the device */\n lastDeploymentId?: string;\n /** Last install result. */\n lastInstallResult?: InstallResultOutput;\n}\n\nexport interface InstallResultOutput {\n /** Install result code. */\n resultCode: number;\n /** Install extended result code */\n extendedResultCode: number;\n /** A string containing further details about the install result */\n resultDetails?: string;\n /** Array of step results */\n stepResults?: Array<StepResultOutput>;\n}\n\nexport interface StepResultOutput {\n /** It is update id for update steps; otherwise it is null. */\n updateId?: UpdateIdOutput;\n /** Step description. It might be null for update steps. */\n description?: string;\n /** Install result code. */\n resultCode: number;\n /** Install extended result code */\n extendedResultCode: number;\n /** A string containing further details about the install result */\n resultDetails?: string;\n}\n\nexport interface UpdateComplianceOutput {\n /** Total number of devices. */\n totalDeviceCount: number;\n /** Number of devices on the latest update. */\n onLatestUpdateDeviceCount: number;\n /** Number of devices with a newer update available. */\n newUpdatesAvailableDeviceCount: number;\n /** Number of devices with update in-progress. */\n updatesInProgressDeviceCount: number;\n}\n\nexport interface DeviceTagsListOutput {\n /** The collection of pageable items. */\n value: Array<DeviceTagOutput>;\n /** The link to the next page of items. */\n nextLink?: string;\n}\n\nexport interface DeviceTagOutput {\n /** Tag name. */\n tagName: string;\n /** Number of devices with this tag. */\n deviceCount: number;\n}\n\nexport interface GroupsListOutput {\n /** The collection of pageable items. */\n value: Array<GroupOutput>;\n /** The link to the next page of items. */\n nextLink?: string;\n}\n\nexport interface GroupOutput {\n /** Group identity. */\n groupId: string;\n /** Group type. */\n groupType:\n | \"DeviceClassIdAndIoTHubTag\"\n | \"InvalidDeviceClassIdAndIoTHubTag\"\n | \"DefaultDeviceClassId\";\n /** IoT Hub tags. */\n tags: Array<string>;\n /** Date and time when the update was created. */\n createdDateTime: string;\n /** The number of devices in the group. */\n deviceCount?: number;\n /** The deployment Id for the group. */\n deploymentId?: string;\n /** The device class Id for the group. */\n deviceClassId?: string;\n}\n\nexport interface UpdatableDevicesListOutput {\n /** The collection of pageable items. */\n value: Array<UpdatableDevicesOutput>;\n /** The link to the next page of items. */\n nextLink?: string;\n}\n\nexport interface UpdatableDevicesOutput {\n /** Update identity. */\n updateId: UpdateIdOutput;\n /** Total number of devices for which the update is applicable. */\n deviceCount: number;\n}\n\nexport interface DeploymentsListOutput {\n /** The collection of pageable items. */\n value: Array<DeploymentOutput>;\n /** The link to the next page of items. */\n nextLink?: string;\n}\n\nexport interface DeploymentOutput {\n /** The deployment identifier. */\n deploymentId: string;\n /** The deployment start datetime. */\n startDateTime: string;\n /** Update identity. */\n updateId: UpdateIdOutput;\n /** The group identity */\n groupId: string;\n /** Boolean flag indicating whether the deployment was canceled. */\n isCanceled?: boolean;\n /** Boolean flag indicating whether the deployment has been retried. */\n isRetried?: boolean;\n}\n\nexport interface DeploymentStatusOutput {\n /** The state of the deployment. */\n deploymentState: \"Active\" | \"Inactive\" | \"Canceled\";\n /** The total number of devices in the deployment. */\n totalDevices?: number;\n /** The number of devices that are currently in deployment. */\n devicesInProgressCount?: number;\n /** The number of devices that have completed deployment with a failure. */\n devicesCompletedFailedCount?: number;\n /** The number of devices which have successfully completed deployment. */\n devicesCompletedSucceededCount?: number;\n /** The number of devices which have had their deployment canceled. */\n devicesCanceledCount?: number;\n}\n\nexport interface DeploymentDeviceStatesListOutput {\n /** The collection of pageable items. */\n value: Array<DeploymentDeviceStateOutput>;\n /** The link to the next page of items. */\n nextLink?: string;\n}\n\nexport interface DeploymentDeviceStateOutput {\n /** Device identity. */\n deviceId: string;\n /** Device module identity. */\n moduleId?: string;\n /** The number of times this deployment has been retried on this device. */\n retryCount: number;\n /** Boolean flag indicating whether this device is in a newer deployment and can no longer retry this deployment. */\n movedOnToNewDeployment: boolean;\n /** Deployment device state. */\n deviceState: \"Succeeded\" | \"InProgress\" | \"Failed\" | \"Canceled\" | \"Incompatible\";\n}\n\nexport interface DeviceOperationOutput {\n /** Operation Id. */\n operationId: string;\n /** Operation status. */\n status: \"Undefined\" | \"NotStarted\" | \"Running\" | \"Succeeded\" | \"Failed\";\n /** Operation error encountered, if any. */\n error?: ErrorModelOutput;\n /** Operation correlation identity that can used by Microsoft Support for troubleshooting. */\n traceId?: string;\n /** Date and time in UTC when the operation status was last updated. */\n lastActionDateTime: string;\n /** Date and time in UTC when the operation was created. */\n createdDateTime: string;\n /** Operation ETag. */\n etag?: string;\n}\n\nexport interface DeviceOperationsListOutput {\n /** The collection of pageable items. */\n value: Array<DeviceOperationOutput>;\n /** The link to the next page of items. */\n nextLink?: string;\n}\n\nexport interface LogCollectionOperationOutput {\n /** The diagnostics operation id. */\n operationId?: string;\n /** Array of Device Update agent ids */\n deviceList: Array<DeviceUpdateAgentIdOutput>;\n /** Description of the diagnostics operation. */\n description?: string;\n /** The timestamp when the operation was created. */\n createdDateTime?: string;\n /** A timestamp for when the current state was entered. */\n lastActionDateTime?: string;\n /** Operation status. */\n status?: \"Undefined\" | \"NotStarted\" | \"Running\" | \"Succeeded\" | \"Failed\";\n}\n\nexport interface DeviceUpdateAgentIdOutput {\n /** Device Id */\n deviceId: string;\n /** Module Id */\n moduleId?: string;\n}\n\nexport interface LogCollectionOperationListOutput {\n /** The collection of pageable items. */\n value: Array<LogCollectionOperationOutput>;\n /** The link to the next page of items. */\n nextLink?: string;\n}\n\nexport interface LogCollectionOperationDetailedStatusOutput {\n /** The device diagnostics operation id. */\n operationId?: string;\n /** The timestamp when the operation was created. */\n createdDateTime?: string;\n /** A timestamp for when the current state was entered. */\n lastActionDateTime?: string;\n /** Operation status. */\n status?: \"Undefined\" | \"NotStarted\" | \"Running\" | \"Succeeded\" | \"Failed\";\n /** Status of the devices in the operation */\n deviceStatus?: Array<LogCollectionOperationDeviceStatusOutput>;\n /** Device diagnostics operation description. */\n description?: string;\n}\n\nexport interface LogCollectionOperationDeviceStatusOutput {\n /** Device id */\n deviceId: string;\n /** Module id. */\n moduleId?: string;\n /** Log upload status */\n status: \"Undefined\" | \"NotStarted\" | \"Running\" | \"Succeeded\" | \"Failed\";\n /** Log upload result code */\n resultCode?: string;\n /** Log upload extended result code */\n extendedResultCode?: string;\n /** Log upload location */\n logLocation?: string;\n}\n"]}