@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.
@@ -0,0 +1,70 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { getPagedAsyncIterator } from "@azure/core-paging";
4
+ import { createRestError } from "@azure-rest/core-client";
5
+ /**
6
+ * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
7
+ * @param client - Client to use for sending the next page requests
8
+ * @param initialResponse - Initial response containing the nextLink and current page of elements
9
+ * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
10
+ * @returns - PagedAsyncIterableIterator to iterate the elements
11
+ */
12
+ export function paginate(client, initialResponse, options = {}) {
13
+ let firstRun = true;
14
+ const itemName = "value";
15
+ const nextLinkName = "nextLink";
16
+ const { customGetPage } = options;
17
+ const pagedResult = {
18
+ firstPageLink: "",
19
+ getPage: typeof customGetPage === "function"
20
+ ? customGetPage
21
+ : async (pageLink) => {
22
+ const result = firstRun ? initialResponse : await client.pathUnchecked(pageLink).get();
23
+ firstRun = false;
24
+ checkPagingRequest(result);
25
+ const nextLink = getNextLink(result.body, nextLinkName);
26
+ const values = getElements(result.body, itemName);
27
+ return {
28
+ page: values,
29
+ nextPageLink: nextLink,
30
+ };
31
+ },
32
+ };
33
+ return getPagedAsyncIterator(pagedResult);
34
+ }
35
+ /**
36
+ * Gets for the value of nextLink in the body
37
+ */
38
+ function getNextLink(body, nextLinkName) {
39
+ if (!nextLinkName) {
40
+ return undefined;
41
+ }
42
+ const nextLink = body[nextLinkName];
43
+ if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
44
+ throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
45
+ }
46
+ return nextLink;
47
+ }
48
+ /**
49
+ * Gets the elements of the current request in the body.
50
+ */
51
+ function getElements(body, itemName) {
52
+ const value = body[itemName];
53
+ // value has to be an array according to the x-ms-pageable extension.
54
+ // The fact that this must be an array is used above to calculate the
55
+ // type of elements in the page in PaginateReturn
56
+ if (!Array.isArray(value)) {
57
+ throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
58
+ }
59
+ return value !== null && value !== void 0 ? value : [];
60
+ }
61
+ /**
62
+ * Checks if a request failed
63
+ */
64
+ function checkPagingRequest(response) {
65
+ const Http2xxStatusCodes = ["200", "201", "202", "203", "204", "205", "206", "207", "208", "226"];
66
+ if (!Http2xxStatusCodes.includes(response.status)) {
67
+ throw createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
68
+ }
69
+ }
70
+ //# sourceMappingURL=paginateHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAA2C,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAiC,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAyCzF;;;;;;GAMG;AACH,MAAM,UAAU,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;YACjC,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,KAAK,EAAE,QAAgB,EAAE,EAAE;gBACzB,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,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;YACJ,CAAC;KACR,CAAC;IAEF,OAAO,qBAAqB,CAAC,WAAW,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,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;;GAEG;AACH,SAAS,WAAW,CAAc,IAAa,EAAE,QAAgB;IAC/D,MAAM,KAAK,GAAI,IAAgC,CAAC,QAAQ,CAAQ,CAAC;IAEjE,qEAAqE;IACrE,qEAAqE;IACrE,iDAAiD;IACjD,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;;GAEG;AACH,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,MAAM,eAAe,CACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;KACH;AACH,CAAC","sourcesContent":["// 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"]}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export {};
4
+ //# sourceMappingURL=parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport { RequestParameters } from \"@azure-rest/core-client\";\nimport { Deployment, Group, ImportUpdateInputItem, LogCollectionOperation } from \"./models\";\n\nexport interface DeviceUpdateImportUpdateBodyParam {\n /** The update to be imported. */\n body: Array<ImportUpdateInputItem>;\n}\n\nexport interface DeviceUpdateImportUpdateQueryParamProperties {\n /** Import update action. */\n action: \"import\";\n}\n\nexport interface DeviceUpdateImportUpdateQueryParam {\n queryParameters: DeviceUpdateImportUpdateQueryParamProperties;\n}\n\nexport interface DeviceUpdateImportUpdateMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceUpdateImportUpdateParameters = DeviceUpdateImportUpdateQueryParam &\n DeviceUpdateImportUpdateMediaTypesParam &\n DeviceUpdateImportUpdateBodyParam &\n RequestParameters;\n\nexport interface DeviceUpdateListUpdatesQueryParamProperties {\n /** Request updates matching a free-text search expression. */\n $search?: string;\n /** Filter updates by its properties. */\n $filter?: string;\n}\n\nexport interface DeviceUpdateListUpdatesQueryParam {\n queryParameters?: DeviceUpdateListUpdatesQueryParamProperties;\n}\n\nexport type DeviceUpdateListUpdatesParameters = DeviceUpdateListUpdatesQueryParam &\n RequestParameters;\n\nexport interface DeviceUpdateGetUpdateHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceUpdateGetUpdateHeaderParam {\n headers: RawHttpHeadersInput & DeviceUpdateGetUpdateHeaders;\n}\n\nexport type DeviceUpdateGetUpdateParameters = DeviceUpdateGetUpdateHeaderParam & RequestParameters;\nexport type DeviceUpdateDeleteUpdateParameters = RequestParameters;\nexport type DeviceUpdateListProvidersParameters = RequestParameters;\nexport type DeviceUpdateListNamesParameters = RequestParameters;\n\nexport interface DeviceUpdateListVersionsQueryParamProperties {\n /** Filter updates by its properties. */\n $filter?: string;\n}\n\nexport interface DeviceUpdateListVersionsQueryParam {\n queryParameters?: DeviceUpdateListVersionsQueryParamProperties;\n}\n\nexport type DeviceUpdateListVersionsParameters = DeviceUpdateListVersionsQueryParam &\n RequestParameters;\nexport type DeviceUpdateListFilesParameters = RequestParameters;\n\nexport interface DeviceUpdateGetFileHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceUpdateGetFileHeaderParam {\n headers: RawHttpHeadersInput & DeviceUpdateGetFileHeaders;\n}\n\nexport type DeviceUpdateGetFileParameters = DeviceUpdateGetFileHeaderParam & RequestParameters;\n\nexport interface DeviceUpdateListOperationsQueryParamProperties {\n /** Restricts the set of operations returned. Only one specific filter is supported: \"status eq 'NotStarted' or status eq 'Running'\" */\n $filter?: string;\n /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */\n $top?: number;\n}\n\nexport interface DeviceUpdateListOperationsQueryParam {\n queryParameters?: DeviceUpdateListOperationsQueryParamProperties;\n}\n\nexport type DeviceUpdateListOperationsParameters = DeviceUpdateListOperationsQueryParam &\n RequestParameters;\n\nexport interface DeviceUpdateGetOperationHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceUpdateGetOperationHeaderParam {\n headers: RawHttpHeadersInput & DeviceUpdateGetOperationHeaders;\n}\n\nexport type DeviceUpdateGetOperationParameters = DeviceUpdateGetOperationHeaderParam &\n RequestParameters;\nexport type DeviceManagementListDeviceClassesParameters = RequestParameters;\nexport type DeviceManagementGetDeviceClassParameters = RequestParameters;\nexport type DeviceManagementListInstallableUpdatesForDeviceClassParameters = RequestParameters;\n\nexport interface DeviceManagementListDevicesQueryParamProperties {\n /** Restricts the set of devices returned. You can filter on device GroupId or DeviceClassId. */\n $filter?: string;\n}\n\nexport interface DeviceManagementListDevicesQueryParam {\n queryParameters?: DeviceManagementListDevicesQueryParamProperties;\n}\n\nexport type DeviceManagementListDevicesParameters = DeviceManagementListDevicesQueryParam &\n RequestParameters;\n\nexport interface DeviceManagementImportDevicesBodyParam {\n /** The types of devices to import. */\n body: \"Devices\" | \"Modules\" | \"All\";\n}\n\nexport interface DeviceManagementImportDevicesQueryParamProperties {\n /** Devices action. */\n action: \"import\";\n}\n\nexport interface DeviceManagementImportDevicesQueryParam {\n queryParameters: DeviceManagementImportDevicesQueryParamProperties;\n}\n\nexport interface DeviceManagementImportDevicesMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceManagementImportDevicesParameters = DeviceManagementImportDevicesQueryParam &\n DeviceManagementImportDevicesMediaTypesParam &\n DeviceManagementImportDevicesBodyParam &\n RequestParameters;\nexport type DeviceManagementGetDeviceParameters = RequestParameters;\nexport type DeviceManagementGetDeviceModuleParameters = RequestParameters;\nexport type DeviceManagementGetUpdateComplianceParameters = RequestParameters;\nexport type DeviceManagementListDeviceTagsParameters = RequestParameters;\nexport type DeviceManagementGetDeviceTagParameters = RequestParameters;\nexport type DeviceManagementListGroupsParameters = RequestParameters;\nexport type DeviceManagementGetGroupParameters = RequestParameters;\n\nexport interface DeviceManagementCreateOrUpdateGroupBodyParam {\n /** The group properties. */\n body: Group;\n}\n\nexport interface DeviceManagementCreateOrUpdateGroupMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceManagementCreateOrUpdateGroupParameters = DeviceManagementCreateOrUpdateGroupMediaTypesParam &\n DeviceManagementCreateOrUpdateGroupBodyParam &\n RequestParameters;\nexport type DeviceManagementDeleteGroupParameters = RequestParameters;\nexport type DeviceManagementGetGroupUpdateComplianceParameters = RequestParameters;\n\nexport interface DeviceManagementListBestUpdatesForGroupQueryParamProperties {\n /** Restricts the set of bestUpdates returned. You can filter on update Provider, Name and Version property. */\n $filter?: string;\n}\n\nexport interface DeviceManagementListBestUpdatesForGroupQueryParam {\n queryParameters?: DeviceManagementListBestUpdatesForGroupQueryParamProperties;\n}\n\nexport type DeviceManagementListBestUpdatesForGroupParameters = DeviceManagementListBestUpdatesForGroupQueryParam &\n RequestParameters;\n\nexport interface DeviceManagementListDeploymentsForGroupQueryParamProperties {\n /** Restricts the set of deployments returned. You can filter on update Provider, Name and Version property. */\n $filter?: string;\n}\n\nexport interface DeviceManagementListDeploymentsForGroupQueryParam {\n queryParameters?: DeviceManagementListDeploymentsForGroupQueryParamProperties;\n}\n\nexport type DeviceManagementListDeploymentsForGroupParameters = DeviceManagementListDeploymentsForGroupQueryParam &\n RequestParameters;\nexport type DeviceManagementGetDeploymentParameters = RequestParameters;\n\nexport interface DeviceManagementCreateOrUpdateDeploymentBodyParam {\n /** The deployment properties. */\n body: Deployment;\n}\n\nexport interface DeviceManagementCreateOrUpdateDeploymentMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceManagementCreateOrUpdateDeploymentParameters = DeviceManagementCreateOrUpdateDeploymentMediaTypesParam &\n DeviceManagementCreateOrUpdateDeploymentBodyParam &\n RequestParameters;\nexport type DeviceManagementDeleteDeploymentParameters = RequestParameters;\nexport type DeviceManagementGetDeploymentStatusParameters = RequestParameters;\n\nexport interface DeviceManagementListDeploymentDevicesQueryParamProperties {\n /** Restricts the set of deployment device states returned. You can filter on deviceId and moduleId and/or deviceState. */\n $filter?: string;\n}\n\nexport interface DeviceManagementListDeploymentDevicesQueryParam {\n queryParameters?: DeviceManagementListDeploymentDevicesQueryParamProperties;\n}\n\nexport type DeviceManagementListDeploymentDevicesParameters = DeviceManagementListDeploymentDevicesQueryParam &\n RequestParameters;\n\nexport interface DeviceManagementGetOperationHeaders {\n /** Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value. */\n \"If-None-Match\"?: string;\n}\n\nexport interface DeviceManagementGetOperationHeaderParam {\n headers: RawHttpHeadersInput & DeviceManagementGetOperationHeaders;\n}\n\nexport type DeviceManagementGetOperationParameters = DeviceManagementGetOperationHeaderParam &\n RequestParameters;\n\nexport interface DeviceManagementListOperationsQueryParamProperties {\n /** Restricts the set of operations returned. Only one specific filter is supported: \"status eq 'NotStarted' or status eq 'Running'\" */\n $filter?: string;\n /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */\n $top?: number;\n}\n\nexport interface DeviceManagementListOperationsQueryParam {\n queryParameters?: DeviceManagementListOperationsQueryParamProperties;\n}\n\nexport type DeviceManagementListOperationsParameters = DeviceManagementListOperationsQueryParam &\n RequestParameters;\n\nexport interface DeviceManagementCollectLogsBodyParam {\n /** The deployment properties. */\n body: LogCollectionOperation;\n}\n\nexport interface DeviceManagementCollectLogsMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type DeviceManagementCollectLogsParameters = DeviceManagementCollectLogsMediaTypesParam &\n DeviceManagementCollectLogsBodyParam &\n RequestParameters;\nexport type DeviceManagementGetLogCollectionOperationParameters = RequestParameters;\nexport type DeviceManagementListLogCollectionOperationsParameters = RequestParameters;\nexport type DeviceManagementGetLogCollectionOperationDetailedStatusParameters = RequestParameters;\n\nexport interface DeviceManagementStopDeploymentQueryParamProperties {\n /** Cancel deployment action. */\n action: \"cancel\";\n}\n\nexport interface DeviceManagementStopDeploymentQueryParam {\n queryParameters: DeviceManagementStopDeploymentQueryParamProperties;\n}\n\nexport type DeviceManagementStopDeploymentParameters = DeviceManagementStopDeploymentQueryParam &\n RequestParameters;\n\nexport interface DeviceManagementRetryDeploymentQueryParamProperties {\n /** Retry deployment action. */\n action: \"retry\";\n}\n\nexport interface DeviceManagementRetryDeploymentQueryParam {\n queryParameters: DeviceManagementRetryDeploymentQueryParamProperties;\n}\n\nexport type DeviceManagementRetryDeploymentParameters = DeviceManagementRetryDeploymentQueryParam &\n RequestParameters;\n"]}
@@ -0,0 +1,46 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { LroEngine, } from "@azure/core-lro";
4
+ /**
5
+ * Helper function that builds a Poller object to help polling a long running operation.
6
+ * @param client - Client to use for sending the request to get additional pages.
7
+ * @param initialResponse - The initial response.
8
+ * @param options - Options to set a resume state or custom polling interval.
9
+ * @returns - A poller object to poll for operation state updates and eventually get the final response.
10
+ */
11
+ export function getLongRunningPoller(client, initialResponse, options = {}) {
12
+ const poller = {
13
+ requestMethod: initialResponse.request.method,
14
+ requestPath: initialResponse.request.url,
15
+ sendInitialRequest: async () => {
16
+ // In the case of Rest Clients we are building the LRO poller object from a response that's the reason
17
+ // we are not triggering the initial request here, just extracting the information from the
18
+ // response we were provided.
19
+ return getLroResponse(initialResponse);
20
+ },
21
+ sendPollRequest: async (path) => {
22
+ // This is the callback that is going to be called to poll the service
23
+ // to get the latest status. We use the client provided and the polling path
24
+ // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
25
+ // depending on the lro pattern that the service implements. If non is provided we default to the initial path.
26
+ const response = await client.pathUnchecked(path !== null && path !== void 0 ? path : initialResponse.request.url).get();
27
+ return getLroResponse(response);
28
+ },
29
+ };
30
+ return new LroEngine(poller, options);
31
+ }
32
+ /**
33
+ * Converts a Rest Client response to a response that the LRO engine knows about
34
+ * @param response - a rest client http response
35
+ * @returns - An LRO response that the LRO engine can work with
36
+ */
37
+ function getLroResponse(response) {
38
+ if (Number.isNaN(response.status)) {
39
+ throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);
40
+ }
41
+ return {
42
+ flatResponse: response,
43
+ rawResponse: Object.assign(Object.assign({}, response), { statusCode: Number.parseInt(response.status), body: response.body }),
44
+ };
45
+ }
46
+ //# sourceMappingURL=pollingHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pollingHelper.js","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAEL,SAAS,GAKV,MAAM,iBAAiB,CAAC;AAEzB;;;;;;GAMG;AACH,MAAM,UAAU,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,KAAK,IAAI,EAAE;YAC7B,sGAAsG;YACtG,2FAA2F;YAC3F,6BAA6B;YAC7B,OAAO,cAAc,CAAC,eAAe,CAAC,CAAC;QACzC,CAAC;QACD,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YAC9B,sEAAsE;YACtE,4EAA4E;YAC5E,0JAA0J;YAC1J,+GAA+G;YAC/G,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;QAC7C,CAAC;KACF,CAAC;IAEF,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH,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","sourcesContent":["// 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"]}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export {};
4
+ //# sourceMappingURL=responses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/responses.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { HttpResponse } from \"@azure-rest/core-client\";\nimport {\n DeploymentDeviceStatesListOutput,\n DeploymentOutput,\n DeploymentStatusOutput,\n DeploymentsListOutput,\n DeviceClassOutput,\n DeviceClassesListOutput,\n DeviceOperationOutput,\n DeviceOperationsListOutput,\n DeviceOutput,\n DeviceTagOutput,\n DeviceTagsListOutput,\n DevicesListOutput,\n ErrorResponseOutput,\n GroupOutput,\n GroupsListOutput,\n LogCollectionOperationDetailedStatusOutput,\n LogCollectionOperationListOutput,\n LogCollectionOperationOutput,\n StringsListOutput,\n UpdatableDevicesListOutput,\n UpdateComplianceOutput,\n UpdateFileOutput,\n UpdateIdsListOutput,\n UpdateListOutput,\n UpdateOperationOutput,\n UpdateOperationsListOutput,\n UpdateOutput,\n} from \"./outputModels\";\n\nexport interface DeviceUpdateImportUpdate202Headers {\n /** Url to retrieve the import operation status. */\n \"operation-location\"?: string;\n}\n\n/** Import new update version. */\nexport interface DeviceUpdateImportUpdate202Response extends HttpResponse {\n status: \"202\";\n body: UpdateOutput;\n headers: RawHttpHeaders & DeviceUpdateImportUpdate202Headers;\n}\n\n/** Import new update version. */\nexport interface DeviceUpdateImportUpdatedefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Get a list of all updates that have been imported to Device Update for IoT Hub. */\nexport interface DeviceUpdateListUpdates200Response extends HttpResponse {\n status: \"200\";\n body: UpdateListOutput;\n}\n\n/** Get a list of all updates that have been imported to Device Update for IoT Hub. */\nexport interface DeviceUpdateListUpdatesdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Get a specific update version. */\nexport interface DeviceUpdateGetUpdate200Response extends HttpResponse {\n status: \"200\";\n body: UpdateOutput;\n}\n\n/** Get a specific update version. */\nexport interface DeviceUpdateGetUpdate304Response extends HttpResponse {\n status: \"304\";\n body: Record<string, unknown>;\n}\n\n/** Get a specific update version. */\nexport interface DeviceUpdateGetUpdatedefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\nexport interface DeviceUpdateDeleteUpdate202Headers {\n /** Url to retrieve the operation status */\n \"operation-location\"?: string;\n}\n\n/** Delete a specific update version. */\nexport interface DeviceUpdateDeleteUpdate202Response extends HttpResponse {\n status: \"202\";\n body: Record<string, unknown>;\n headers: RawHttpHeaders & DeviceUpdateDeleteUpdate202Headers;\n}\n\n/** Delete a specific update version. */\nexport interface DeviceUpdateDeleteUpdatedefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Get a list of all update providers that have been imported to Device Update for IoT Hub. */\nexport interface DeviceUpdateListProviders200Response extends HttpResponse {\n status: \"200\";\n body: StringsListOutput;\n}\n\n/** Get a list of all update providers that have been imported to Device Update for IoT Hub. */\nexport interface DeviceUpdateListProvidersdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Get a list of all update names that match the specified provider. */\nexport interface DeviceUpdateListNames200Response extends HttpResponse {\n status: \"200\";\n body: StringsListOutput;\n}\n\n/** Get a list of all update names that match the specified provider. */\nexport interface DeviceUpdateListNamesdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Get a list of all update versions that match the specified provider and name. */\nexport interface DeviceUpdateListVersions200Response extends HttpResponse {\n status: \"200\";\n body: StringsListOutput;\n}\n\n/** Get a list of all update versions that match the specified provider and name. */\nexport interface DeviceUpdateListVersionsdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Get a list of all update file identifiers for the specified version. */\nexport interface DeviceUpdateListFiles200Response extends HttpResponse {\n status: \"200\";\n body: StringsListOutput;\n}\n\n/** Get a list of all update file identifiers for the specified version. */\nexport interface DeviceUpdateListFilesdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Get a specific update file from the version. */\nexport interface DeviceUpdateGetFile200Response extends HttpResponse {\n status: \"200\";\n body: UpdateFileOutput;\n}\n\n/** Get a specific update file from the version. */\nexport interface DeviceUpdateGetFile304Response extends HttpResponse {\n status: \"304\";\n body: Record<string, unknown>;\n}\n\n/** Get a specific update file from the version. */\nexport interface DeviceUpdateGetFiledefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\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. */\nexport interface DeviceUpdateListOperations200Response extends HttpResponse {\n status: \"200\";\n body: UpdateOperationsListOutput;\n}\n\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. */\nexport interface DeviceUpdateListOperationsdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\nexport interface DeviceUpdateGetOperation200Headers {\n /** Number of seconds to wait before checking the operation status again. */\n \"retry-after\"?: string;\n}\n\n/** Retrieve operation status. */\nexport interface DeviceUpdateGetOperation200Response extends HttpResponse {\n status: \"200\";\n body: UpdateOperationOutput;\n headers: RawHttpHeaders & DeviceUpdateGetOperation200Headers;\n}\n\n/** Retrieve operation status. */\nexport interface DeviceUpdateGetOperation304Response extends HttpResponse {\n status: \"304\";\n body: Record<string, unknown>;\n}\n\n/** Retrieve operation status. */\nexport interface DeviceUpdateGetOperationdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\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. */\nexport interface DeviceManagementListDeviceClasses200Response extends HttpResponse {\n status: \"200\";\n body: DeviceClassesListOutput;\n}\n\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. */\nexport interface DeviceManagementListDeviceClassesdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets the properties of a device class. */\nexport interface DeviceManagementGetDeviceClass200Response extends HttpResponse {\n status: \"200\";\n body: DeviceClassOutput;\n}\n\n/** Gets the properties of a device class. */\nexport interface DeviceManagementGetDeviceClassdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets a list of installable updates for a device class. */\nexport interface DeviceManagementListInstallableUpdatesForDeviceClass200Response\n extends HttpResponse {\n status: \"200\";\n body: UpdateIdsListOutput;\n}\n\n/** Gets a list of installable updates for a device class. */\nexport interface DeviceManagementListInstallableUpdatesForDeviceClassdefaultResponse\n extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets a list of devices connected to Device Update for IoT Hub. */\nexport interface DeviceManagementListDevices200Response extends HttpResponse {\n status: \"200\";\n body: DevicesListOutput;\n}\n\n/** Gets a list of devices connected to Device Update for IoT Hub. */\nexport interface DeviceManagementListDevicesdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\nexport interface DeviceManagementImportDevices202Headers {\n /** Url to retrieve the device import operation status. */\n \"operation-location\"?: string;\n}\n\n/** Import existing devices from IoT Hub. */\nexport interface DeviceManagementImportDevices202Response extends HttpResponse {\n status: \"202\";\n body: Record<string, unknown>;\n headers: RawHttpHeaders & DeviceManagementImportDevices202Headers;\n}\n\n/** Import existing devices from IoT Hub. */\nexport interface DeviceManagementImportDevicesdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets the device properties and latest deployment status for a device connected to Device Update for IoT Hub. */\nexport interface DeviceManagementGetDevice200Response extends HttpResponse {\n status: \"200\";\n body: DeviceOutput;\n}\n\n/** Gets the device properties and latest deployment status for a device connected to Device Update for IoT Hub. */\nexport interface DeviceManagementGetDevicedefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets the device module properties and latest deployment status for a device module connected to Device Update for IoT Hub. */\nexport interface DeviceManagementGetDeviceModule200Response extends HttpResponse {\n status: \"200\";\n body: DeviceOutput;\n}\n\n/** Gets the device module properties and latest deployment status for a device module connected to Device Update for IoT Hub. */\nexport interface DeviceManagementGetDeviceModuledefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets the breakdown of how many devices are on their latest update, have new updates available, or are in progress receiving new updates. */\nexport interface DeviceManagementGetUpdateCompliance200Response extends HttpResponse {\n status: \"200\";\n body: UpdateComplianceOutput;\n}\n\n/** Gets the breakdown of how many devices are on their latest update, have new updates available, or are in progress receiving new updates. */\nexport interface DeviceManagementGetUpdateCompliancedefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets a list of available group device tags for all devices connected to Device Update for IoT Hub. */\nexport interface DeviceManagementListDeviceTags200Response extends HttpResponse {\n status: \"200\";\n body: DeviceTagsListOutput;\n}\n\n/** Gets a list of available group device tags for all devices connected to Device Update for IoT Hub. */\nexport interface DeviceManagementListDeviceTagsdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets a count of how many devices have a device tag. */\nexport interface DeviceManagementGetDeviceTag200Response extends HttpResponse {\n status: \"200\";\n body: DeviceTagOutput;\n}\n\n/** Gets a count of how many devices have a device tag. */\nexport interface DeviceManagementGetDeviceTagdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets a list of all device groups. */\nexport interface DeviceManagementListGroups200Response extends HttpResponse {\n status: \"200\";\n body: GroupsListOutput;\n}\n\n/** Gets a list of all device groups. */\nexport interface DeviceManagementListGroupsdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets the properties of a group. */\nexport interface DeviceManagementGetGroup200Response extends HttpResponse {\n status: \"200\";\n body: GroupOutput;\n}\n\n/** Gets the properties of a group. */\nexport interface DeviceManagementGetGroupdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Create or update a device group. */\nexport interface DeviceManagementCreateOrUpdateGroup200Response extends HttpResponse {\n status: \"200\";\n body: GroupOutput;\n}\n\n/** Create or update a device group. */\nexport interface DeviceManagementCreateOrUpdateGroupdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Deletes a device group. */\nexport interface DeviceManagementDeleteGroup204Response extends HttpResponse {\n status: \"204\";\n body: Record<string, unknown>;\n}\n\n/** Deletes a device group. */\nexport interface DeviceManagementDeleteGroupdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\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. */\nexport interface DeviceManagementGetGroupUpdateCompliance200Response extends HttpResponse {\n status: \"200\";\n body: UpdateComplianceOutput;\n}\n\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. */\nexport interface DeviceManagementGetGroupUpdateCompliancedefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Get the best available updates for a group and a count of how many devices need each update. */\nexport interface DeviceManagementListBestUpdatesForGroup200Response extends HttpResponse {\n status: \"200\";\n body: UpdatableDevicesListOutput;\n}\n\n/** Get the best available updates for a group and a count of how many devices need each update. */\nexport interface DeviceManagementListBestUpdatesForGroupdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets a list of deployments for a group. */\nexport interface DeviceManagementListDeploymentsForGroup200Response extends HttpResponse {\n status: \"200\";\n body: DeploymentsListOutput;\n}\n\n/** Gets a list of deployments for a group. */\nexport interface DeviceManagementListDeploymentsForGroupdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets the properties of a deployment. */\nexport interface DeviceManagementGetDeployment200Response extends HttpResponse {\n status: \"200\";\n body: DeploymentOutput;\n}\n\n/** Gets the properties of a deployment. */\nexport interface DeviceManagementGetDeploymentdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Creates or updates a deployment. */\nexport interface DeviceManagementCreateOrUpdateDeployment200Response extends HttpResponse {\n status: \"200\";\n body: DeploymentOutput;\n}\n\n/** Creates or updates a deployment. */\nexport interface DeviceManagementCreateOrUpdateDeploymentdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Deletes a deployment. */\nexport interface DeviceManagementDeleteDeployment204Response extends HttpResponse {\n status: \"204\";\n body: Record<string, unknown>;\n}\n\n/** Deletes a deployment. */\nexport interface DeviceManagementDeleteDeploymentdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets the status of a deployment including a breakdown of how many devices in the deployment are in progress, completed, or failed. */\nexport interface DeviceManagementGetDeploymentStatus200Response extends HttpResponse {\n status: \"200\";\n body: DeploymentStatusOutput;\n}\n\n/** Gets the status of a deployment including a breakdown of how many devices in the deployment are in progress, completed, or failed. */\nexport interface DeviceManagementGetDeploymentStatusdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Gets a list of devices in a deployment along with their state. Useful for getting a list of failed devices. */\nexport interface DeviceManagementListDeploymentDevices200Response extends HttpResponse {\n status: \"200\";\n body: DeploymentDeviceStatesListOutput;\n}\n\n/** Gets a list of devices in a deployment along with their state. Useful for getting a list of failed devices. */\nexport interface DeviceManagementListDeploymentDevicesdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\nexport interface DeviceManagementGetOperation200Headers {\n /** Number of seconds to wait before checking the operation status again. */\n \"retry-after\"?: string;\n}\n\n/** Retrieve operation status. */\nexport interface DeviceManagementGetOperation200Response extends HttpResponse {\n status: \"200\";\n body: DeviceOperationOutput;\n headers: RawHttpHeaders & DeviceManagementGetOperation200Headers;\n}\n\n/** Retrieve operation status. */\nexport interface DeviceManagementGetOperation304Response extends HttpResponse {\n status: \"304\";\n body: Record<string, unknown>;\n}\n\n/** Retrieve operation status. */\nexport interface DeviceManagementGetOperationdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Get a list of all device import operations. Completed operations are kept for 7 days before auto-deleted. */\nexport interface DeviceManagementListOperations200Response extends HttpResponse {\n status: \"200\";\n body: DeviceOperationsListOutput;\n}\n\n/** Get a list of all device import operations. Completed operations are kept for 7 days before auto-deleted. */\nexport interface DeviceManagementListOperationsdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Start the device diagnostics log collection operation on specified devices. */\nexport interface DeviceManagementCollectLogs201Response extends HttpResponse {\n status: \"201\";\n body: LogCollectionOperationOutput;\n}\n\n/** Start the device diagnostics log collection operation on specified devices. */\nexport interface DeviceManagementCollectLogsdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Get the device diagnostics log collection operation */\nexport interface DeviceManagementGetLogCollectionOperation200Response extends HttpResponse {\n status: \"200\";\n body: LogCollectionOperationOutput;\n}\n\n/** Get the device diagnostics log collection operation */\nexport interface DeviceManagementGetLogCollectionOperationdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Get all device diagnostics log collection operations */\nexport interface DeviceManagementListLogCollectionOperations200Response extends HttpResponse {\n status: \"200\";\n body: LogCollectionOperationListOutput;\n}\n\n/** Get all device diagnostics log collection operations */\nexport interface DeviceManagementListLogCollectionOperationsdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Get device diagnostics log collection operation with detailed status */\nexport interface DeviceManagementGetLogCollectionOperationDetailedStatus200Response\n extends HttpResponse {\n status: \"200\";\n body: LogCollectionOperationDetailedStatusOutput;\n}\n\n/** Get device diagnostics log collection operation with detailed status */\nexport interface DeviceManagementGetLogCollectionOperationDetailedStatusdefaultResponse\n extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Stops a deployment. */\nexport interface DeviceManagementStopDeployment200Response extends HttpResponse {\n status: \"200\";\n body: DeploymentOutput;\n}\n\n/** Stops a deployment. */\nexport interface DeviceManagementStopDeploymentdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n\n/** Retries a deployment with failed devices. */\nexport interface DeviceManagementRetryDeployment200Response extends HttpResponse {\n status: \"200\";\n body: DeploymentOutput;\n}\n\n/** Retries a deployment with failed devices. */\nexport interface DeviceManagementRetryDeploymentdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ErrorResponseOutput;\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,134 @@
1
+ {
2
+ "name": "@azure-rest/iot-device-update",
3
+ "sdk-type": "client",
4
+ "author": "Microsoft Corporation",
5
+ "description": "Device Update for IoT Hub is an Azure service that enables customers to publish update for their IoT devices to the cloud, and then deploy that update to their devices (approve updates to groups of devices managed and provisioned in IoT Hub). It leverages the proven security and reliability of the Windows Update platform, optimized for IoT devices. It works globally and knows when and how to update devices, enabling customers to focus on their business goals and let Device Update for IoT Hub handle the updates.",
6
+ "version": "1.0.0-beta.1",
7
+ "keywords": [
8
+ "node",
9
+ "azure",
10
+ "cloud",
11
+ "typescript",
12
+ "browser",
13
+ "isomorphic"
14
+ ],
15
+ "license": "MIT",
16
+ "main": "./dist/index.js",
17
+ "module": "./dist-esm/src/index.js",
18
+ "types": "./types/iot-device-update-rest.d.ts",
19
+ "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceupdate/iot-device-update/README.md",
20
+ "repository": "github:Azure/azure-sdk-for-js",
21
+ "bugs": {
22
+ "url": "https://github.com/Azure/azure-sdk-for-js/issues"
23
+ },
24
+ "files": [
25
+ "dist/",
26
+ "dist-esm/src/",
27
+ "types/iot-device-update-rest.d.ts",
28
+ "README.md",
29
+ "LICENSE"
30
+ ],
31
+ "engines": {
32
+ "node": ">=12.0.0"
33
+ },
34
+ "//metadata": {
35
+ "constantPaths": [
36
+ {
37
+ "path": "swagger/README.md",
38
+ "prefix": "package-version"
39
+ }
40
+ ]
41
+ },
42
+ "//sampleConfiguration": {
43
+ "productName": "Azure IoT Hub Device Update rest",
44
+ "productSlugs": [
45
+ "azure"
46
+ ],
47
+ "requiredResources": {
48
+ "Azure Iot Device Update instance": "https://docs.microsoft.com/azure/iot-hub-device-update/understand-device-update"
49
+ },
50
+ "disableDocsMs": true,
51
+ "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure-rest/iot-device-update"
52
+ },
53
+ "browser": {
54
+ "./dist-esm/test/public/utils/env.js": "./dist-esm/test/public/utils/env.browser.js"
55
+ },
56
+ "scripts": {
57
+ "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
58
+ "build:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1",
59
+ "build:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1",
60
+ "build:samples": "echo Obsolete.",
61
+ "build:test": "tsc -p . && rollup -c 2>&1",
62
+ "build": "npm run clean && tsc -p . && rollup -c 2>&1 && mkdirp ./review && api-extractor run --local",
63
+ "build:debug": "tsc -p . && rollup -c 2>&1 && api-extractor run --local",
64
+ "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
65
+ "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log",
66
+ "execute:samples": "dev-tool samples run samples-dev",
67
+ "extract-api": "rimraf review && mkdirp ./review && api-extractor run --local",
68
+ "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
69
+ "generate:client": "autorest --typescript swagger/README.md && npm run format",
70
+ "integration-test:browser": "dev-tool run test:browser",
71
+ "integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'",
72
+ "integration-test": "npm run integration-test:node && npm run integration-test:browser",
73
+ "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
74
+ "lint": "eslint package.json api-extractor.json src test --ext .ts",
75
+ "pack": "npm pack 2>&1",
76
+ "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
77
+ "test:node": "npm run clean && npm run build:test && npm run unit-test:node",
78
+ "test": "npm run clean && npm run build:test && npm run unit-test",
79
+ "unit-test:browser": "dev-tool run test:browser",
80
+ "unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'",
81
+ "unit-test": "npm run unit-test:node && npm run unit-test:browser",
82
+ "docs": "typedoc --excludePrivate --excludeExternals --out ./dist/docs ./src"
83
+ },
84
+ "sideEffects": false,
85
+ "autoPublish": false,
86
+ "dependencies": {
87
+ "@azure/core-auth": "^1.3.0",
88
+ "@azure-rest/core-client": "1.0.0-beta.7",
89
+ "@azure/core-rest-pipeline": "^1.1.0",
90
+ "@azure/logger": "^1.0.0",
91
+ "tslib": "^2.2.0",
92
+ "@azure/core-paging": "^1.1.1",
93
+ "@azure/core-lro": "^2.2.0"
94
+ },
95
+ "devDependencies": {
96
+ "@azure/dev-tool": "^1.0.0",
97
+ "@azure/eslint-plugin-azure-sdk": "^3.0.0",
98
+ "@azure/identity": "^2.0.1",
99
+ "@azure-tools/test-recorder": "^2.0.0",
100
+ "@azure-tools/test-credential": "1.0.0",
101
+ "@microsoft/api-extractor": "^7.18.11",
102
+ "@types/chai": "^4.1.6",
103
+ "@types/mocha": "^7.0.2",
104
+ "@types/node": "^12.0.0",
105
+ "chai": "^4.2.0",
106
+ "cross-env": "^7.0.2",
107
+ "dotenv": "^8.2.0",
108
+ "eslint": "^7.15.0",
109
+ "karma-chrome-launcher": "^3.0.0",
110
+ "karma-coverage": "^2.0.0",
111
+ "karma-edge-launcher": "^0.4.2",
112
+ "karma-env-preprocessor": "^0.1.1",
113
+ "karma-firefox-launcher": "^1.1.0",
114
+ "karma-ie-launcher": "^1.0.0",
115
+ "karma-json-preprocessor": "^0.3.3",
116
+ "karma-json-to-file-reporter": "^1.0.1",
117
+ "karma-junit-reporter": "^2.0.1",
118
+ "karma-mocha-reporter": "^2.2.5",
119
+ "karma-mocha": "^2.0.1",
120
+ "karma-source-map-support": "~1.4.0",
121
+ "karma-sourcemap-loader": "^0.3.8",
122
+ "karma": "^6.2.0",
123
+ "mkdirp": "^1.0.4",
124
+ "mocha-junit-reporter": "^1.18.0",
125
+ "mocha": "^7.1.1",
126
+ "nyc": "^14.0.0",
127
+ "prettier": "2.2.1",
128
+ "rimraf": "^3.0.0",
129
+ "rollup": "^1.16.3",
130
+ "source-map-support": "^0.5.9",
131
+ "typedoc": "0.15.2",
132
+ "typescript": "~4.2.0"
133
+ }
134
+ }