From 7eb93d3c6f17f54ecf7b99b8507a7c4d5c725342 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 23 Mar 2023 04:15:34 +0000 Subject: [PATCH] CodeGen from PR 23239 in Azure/azure-rest-api-specs Merge 785cf32815bc1fd1a3f4d01495c41d568628bd82 into 5f869da70574588b5af7c46a20de802cb8edc093 --- common/config/rush/pnpm-lock.yaml | 12 +-- sdk/iothub/arm-iothub/CHANGELOG.md | 19 ++--- sdk/iothub/arm-iothub/LICENSE | 2 +- sdk/iothub/arm-iothub/_meta.json | 8 +- sdk/iothub/arm-iothub/package.json | 19 ++--- .../arm-iothub/review/arm-iothub.api.md | 34 ++++++-- sdk/iothub/arm-iothub/src/iotHubClient.ts | 2 +- sdk/iothub/arm-iothub/src/lroImpl.ts | 54 +++++++------ sdk/iothub/arm-iothub/src/models/index.ts | 30 ++++++++ sdk/iothub/arm-iothub/src/models/mappers.ts | 27 +++++++ .../arm-iothub/src/models/parameters.ts | 2 +- .../arm-iothub/src/operations/iotHub.ts | 26 ++++--- .../src/operations/iotHubResource.ts | 77 +++++++++++-------- .../operations/privateEndpointConnections.ts | 54 +++++++------ .../src/operationsInterfaces/iotHub.ts | 4 +- .../operationsInterfaces/iotHubResource.ts | 14 ++-- .../privateEndpointConnections.ts | 10 +-- sdk/iothub/arm-iothub/test/sampleTest.ts | 43 +++++++++++ sdk/iothub/arm-iothub/tsconfig.json | 10 +-- 19 files changed, 292 insertions(+), 155 deletions(-) create mode 100644 sdk/iothub/arm-iothub/test/sampleTest.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index e139da3a1f77..6306c3def2ff 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -731,6 +731,7 @@ packages: /@azure/ai-form-recognizer/3.1.0-beta.3: resolution: {integrity: sha512-+4QtFKNyxAmdqpcYjuAtmWKm/MuOe9kZsbpS9jA9h0YHzngNj5gc67AA4egV9BXOq9x+1phjYTNC/rxiOUr1uQ==} engines: {node: '>=8.0.0'} + deprecated: Please migrate to a supported (non-beta) version of this package dependencies: '@azure/core-auth': 1.4.0 '@azure/core-http': 1.2.6 @@ -3908,7 +3909,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 5.1.0-dev.20230321 + typescript: 5.1.0-dev.20230322 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8764,8 +8765,8 @@ packages: hasBin: true dev: false - /typescript/5.1.0-dev.20230321: - resolution: {integrity: sha512-GFq3xvjbJImoKgCDJEiB7Bsa1wQdu/9tlb8Qj475ydSraETbCLzy+Ao3cqQ+KWBM6Mqo+0b1rrpe2Gj0DZz2+w==} + /typescript/5.1.0-dev.20230322: + resolution: {integrity: sha512-sRsSUZOCpLClaHzhRo1ZsoEnQe6+1FMEQzBzgtxC8f9rklwY5H4TcyKoa9wRpYvvJ34Farr8nEU/Uz+hnruyLw==} engines: {node: '>=12.20'} hasBin: true dev: false @@ -12520,7 +12521,7 @@ packages: dev: false file:projects/arm-iothub.tgz: - resolution: {integrity: sha512-lA57nqDA5i4UuZQtvwI/K8J7XPXuen3IrwMPsQZ5bRTScUz1ozDjhtkGVpzK+ESIQrvJ0tkXyDV0idHCkum6Qg==, tarball: file:projects/arm-iothub.tgz} + resolution: {integrity: sha512-ZY/tUVoqjfq2urDIzEEqY1d9Frz1HtrGWpCHpNI0f3knS3g6rSDZ6aCviyIP2Q0HvQjuJP5LC7bbmlEvMVOBkw==, tarball: file:projects/arm-iothub.tgz} name: '@rush-temp/arm-iothub' version: 0.0.0 dependencies: @@ -12534,7 +12535,8 @@ packages: '@types/node': 14.18.38 chai: 4.3.7 cross-env: 7.0.3 - mkdirp: 1.0.4 + dotenv: 16.0.3 + mkdirp: 2.1.5 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 diff --git a/sdk/iothub/arm-iothub/CHANGELOG.md b/sdk/iothub/arm-iothub/CHANGELOG.md index 9c6cb4e494b4..81ca4d90037b 100644 --- a/sdk/iothub/arm-iothub/CHANGELOG.md +++ b/sdk/iothub/arm-iothub/CHANGELOG.md @@ -1,20 +1,11 @@ # Release History - -## 6.3.0-beta.2 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 6.3.0-beta.1 (2022-12-06) + +## 6.3.0-beta.2 (2023-03-23) **Features** - Added Interface EncryptionPropertiesDescription + - Added Interface IotHubManualFailoverHeaders - Added Interface IotHubPropertiesDeviceStreams - Added Interface IotHubResourceCreateOrUpdateHeaders - Added Interface IotHubResourceDeleteHeaders @@ -24,13 +15,17 @@ - Added Interface PrivateEndpointConnectionsUpdateHeaders - Added Interface RootCertificateProperties - Added Interface RoutingCosmosDBSqlApiProperties + - Added Type Alias IpVersion - Interface IotHubProperties has a new optional parameter deviceStreams - Interface IotHubProperties has a new optional parameter encryption + - Interface IotHubProperties has a new optional parameter ipVersion - Interface IotHubProperties has a new optional parameter rootCertificate - Interface RoutingEndpoints has a new optional parameter cosmosDBSqlCollections - Add parameters of IotHubResourceUpdateHeaders to TypeAlias IotHubResourceUpdateResponse + - Added Enum KnownIpVersion - Enum KnownRoutingSource has a new value DigitalTwinChangeEvents - Enum KnownRoutingSource has a new value MqttBrokerMessages + - Added function getContinuationToken ## 6.2.0 (2022-08-18) diff --git a/sdk/iothub/arm-iothub/LICENSE b/sdk/iothub/arm-iothub/LICENSE index 5d1d36e0af80..3a1d9b6f24f7 100644 --- a/sdk/iothub/arm-iothub/LICENSE +++ b/sdk/iothub/arm-iothub/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2022 Microsoft +Copyright (c) 2023 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/iothub/arm-iothub/_meta.json b/sdk/iothub/arm-iothub/_meta.json index a5d51ebf197e..48e280d77a5c 100644 --- a/sdk/iothub/arm-iothub/_meta.json +++ b/sdk/iothub/arm-iothub/_meta.json @@ -1,8 +1,8 @@ { - "commit": "54b41d3d0aa9fc3085a5822638136bf0d84f5e57", + "commit": "6dbd6aa40bf91e551aad07b491827d08c6e6cf7e", "readme": "specification/iothub/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\iothub\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.4 --generate-sample=true", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/iothub/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.10", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.5.2", - "use": "@autorest/typescript@6.0.0-rc.4" + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.2", + "use": "@autorest/typescript@6.0.0-rc.10" } \ No newline at end of file diff --git a/sdk/iothub/arm-iothub/package.json b/sdk/iothub/arm-iothub/package.json index 0a7a611b4f57..d9bdc8f685a2 100644 --- a/sdk/iothub/arm-iothub/package.json +++ b/sdk/iothub/arm-iothub/package.json @@ -8,10 +8,10 @@ "node": ">=14.0.0" }, "dependencies": { - "@azure/core-lro": "^2.2.0", + "@azure/core-lro": "^2.5.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.6.1", + "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -33,12 +33,13 @@ "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", "@rollup/plugin-node-resolve": "^13.1.3", - "mkdirp": "^1.0.4", + "mkdirp": "^2.1.2", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", + "dotenv": "^16.0.0", "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", @@ -49,7 +50,6 @@ "@types/node": "^14.0.0", "@azure/dev-tool": "^1.0.0" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" @@ -111,12 +111,5 @@ ] }, "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-iothub?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/iothub/arm-iothub" +} \ No newline at end of file diff --git a/sdk/iothub/arm-iothub/review/arm-iothub.api.md b/sdk/iothub/arm-iothub/review/arm-iothub.api.md index e8b0943a4be6..29147d26aee1 100644 --- a/sdk/iothub/arm-iothub/review/arm-iothub.api.md +++ b/sdk/iothub/arm-iothub/review/arm-iothub.api.md @@ -6,9 +6,9 @@ import * as coreAuth from '@azure/core-auth'; import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { PollerLike } from '@azure/core-lro'; -import { PollOperationState } from '@azure/core-lro'; +import { SimplePollerLike } from '@azure/core-lro'; // @public export type AccessRights = "RegistryRead" | "RegistryWrite" | "ServiceConnect" | "DeviceConnect" | "RegistryRead, RegistryWrite" | "RegistryRead, ServiceConnect" | "RegistryRead, DeviceConnect" | "RegistryWrite, ServiceConnect" | "RegistryWrite, DeviceConnect" | "ServiceConnect, DeviceConnect" | "RegistryRead, RegistryWrite, ServiceConnect" | "RegistryRead, RegistryWrite, DeviceConnect" | "RegistryRead, ServiceConnect, DeviceConnect" | "RegistryWrite, ServiceConnect, DeviceConnect" | "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect"; @@ -295,7 +295,7 @@ export interface ImportDevicesRequest { // @public export interface IotHub { - beginManualFailover(iotHubName: string, resourceGroupName: string, failoverInput: FailoverInput, options?: IotHubManualFailoverOptionalParams): Promise, void>>; + beginManualFailover(iotHubName: string, resourceGroupName: string, failoverInput: FailoverInput, options?: IotHubManualFailoverOptionalParams): Promise, void>>; beginManualFailoverAndWait(iotHubName: string, resourceGroupName: string, failoverInput: FailoverInput, options?: IotHubManualFailoverOptionalParams): Promise; } @@ -360,6 +360,13 @@ export interface IotHubLocationDescription { role?: IotHubReplicaRoleType; } +// @public +export interface IotHubManualFailoverHeaders { + azureAsyncOperation?: string; + // (undocumented) + location?: string; +} + // @public export interface IotHubManualFailoverOptionalParams extends coreClient.OperationOptions { resumeFrom?: string; @@ -395,6 +402,7 @@ export interface IotHubProperties { features?: Capabilities; readonly hostName?: string; ipFilterRules?: IpFilterRule[]; + ipVersion?: IpVersion; readonly locations?: IotHubLocationDescription[]; messagingEndpoints?: { [propertyName: string]: MessagingEndpointProperties; @@ -436,11 +444,11 @@ export type IotHubReplicaRoleType = string; // @public export interface IotHubResource { - beginCreateOrUpdate(resourceGroupName: string, resourceName: string, iotHubDescription: IotHubDescription, options?: IotHubResourceCreateOrUpdateOptionalParams): Promise, IotHubResourceCreateOrUpdateResponse>>; + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, iotHubDescription: IotHubDescription, options?: IotHubResourceCreateOrUpdateOptionalParams): Promise, IotHubResourceCreateOrUpdateResponse>>; beginCreateOrUpdateAndWait(resourceGroupName: string, resourceName: string, iotHubDescription: IotHubDescription, options?: IotHubResourceCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, resourceName: string, options?: IotHubResourceDeleteOptionalParams): Promise, IotHubResourceDeleteResponse>>; + beginDelete(resourceGroupName: string, resourceName: string, options?: IotHubResourceDeleteOptionalParams): Promise, IotHubResourceDeleteResponse>>; beginDeleteAndWait(resourceGroupName: string, resourceName: string, options?: IotHubResourceDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, resourceName: string, iotHubTags: TagsResource, options?: IotHubResourceUpdateOptionalParams): Promise, IotHubResourceUpdateResponse>>; + beginUpdate(resourceGroupName: string, resourceName: string, iotHubTags: TagsResource, options?: IotHubResourceUpdateOptionalParams): Promise, IotHubResourceUpdateResponse>>; beginUpdateAndWait(resourceGroupName: string, resourceName: string, iotHubTags: TagsResource, options?: IotHubResourceUpdateOptionalParams): Promise; checkNameAvailability(operationInputs: OperationInputs, options?: IotHubResourceCheckNameAvailabilityOptionalParams): Promise; createEventHubConsumerGroup(resourceGroupName: string, resourceName: string, eventHubEndpointName: string, name: string, consumerGroupBody: EventHubConsumerGroupBodyDescription, options?: IotHubResourceCreateEventHubConsumerGroupOptionalParams): Promise; @@ -739,6 +747,9 @@ export interface IpFilterRule { ipMask: string; } +// @public +export type IpVersion = string; + // @public export interface JobResponse { readonly endTimeUtc?: Date; @@ -821,6 +832,13 @@ export enum KnownIotHubSku { S3 = "S3" } +// @public +export enum KnownIpVersion { + Ipv4 = "ipv4", + Ipv4Ipv6 = "ipv4ipv6", + Ipv6 = "ipv6" +} + // @public export enum KnownJobType { Backup = "backup", @@ -991,9 +1009,9 @@ export interface PrivateEndpointConnectionProperties { // @public export interface PrivateEndpointConnections { - beginDelete(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise, PrivateEndpointConnectionsDeleteResponse>>; + beginDelete(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise, PrivateEndpointConnectionsDeleteResponse>>; beginDeleteAndWait(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise; - beginUpdate(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams): Promise, PrivateEndpointConnectionsUpdateResponse>>; + beginUpdate(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams): Promise, PrivateEndpointConnectionsUpdateResponse>>; beginUpdateAndWait(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams): Promise; get(resourceGroupName: string, resourceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; list(resourceGroupName: string, resourceName: string, options?: PrivateEndpointConnectionsListOptionalParams): Promise; diff --git a/sdk/iothub/arm-iothub/src/iotHubClient.ts b/sdk/iothub/arm-iothub/src/iotHubClient.ts index 6b9a885635bc..39aed273d410 100644 --- a/sdk/iothub/arm-iothub/src/iotHubClient.ts +++ b/sdk/iothub/arm-iothub/src/iotHubClient.ts @@ -119,7 +119,7 @@ export class IotHubClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2022-04-30-preview"; + this.apiVersion = options.apiVersion || "2022-11-15-preview"; this.operations = new OperationsImpl(this); this.iotHubResource = new IotHubResourceImpl(this); this.resourceProviderCommon = new ResourceProviderCommonImpl(this); diff --git a/sdk/iothub/arm-iothub/src/lroImpl.ts b/sdk/iothub/arm-iothub/src/lroImpl.ts index 518d5f053b4e..dd803cd5e28c 100644 --- a/sdk/iothub/arm-iothub/src/lroImpl.ts +++ b/sdk/iothub/arm-iothub/src/lroImpl.ts @@ -6,29 +6,37 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AbortSignalLike } from "@azure/abort-controller"; import { LongRunningOperation, LroResponse } from "@azure/core-lro"; -export class LroImpl implements LongRunningOperation { - constructor( - private sendOperationFn: (args: any, spec: any) => Promise>, - private args: Record, - private spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record, - public requestPath: string = spec.path!, - public requestMethod: string = spec.httpMethod - ) {} - public async sendInitialRequest(): Promise> { - return this.sendOperationFn(this.args, this.spec); - } - public async sendPollRequest(path: string): Promise> { - const { requestBody, ...restSpec } = this.spec; - return this.sendOperationFn(this.args, { - ...restSpec, - path, - httpMethod: "GET" - }); - } +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike } + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal + }); + } + }; } diff --git a/sdk/iothub/arm-iothub/src/models/index.ts b/sdk/iothub/arm-iothub/src/models/index.ts index 81cdc47282ab..5c59657a2c22 100644 --- a/sdk/iothub/arm-iothub/src/models/index.ts +++ b/sdk/iothub/arm-iothub/src/models/index.ts @@ -149,6 +149,8 @@ export interface IotHubProperties { enableDataResidency?: boolean; /** This property store root certificate related information */ rootCertificate?: RootCertificateProperties; + /** This property specifies the IP Version the hub is currently utilizing. */ + ipVersion?: IpVersion; } /** The properties of an IoT hub shared access policy. */ @@ -1291,6 +1293,13 @@ export interface IotHubResourceDeleteHeaders { azureAsyncOperation?: string; } +/** Defines headers for IotHub_manualFailover operation. */ +export interface IotHubManualFailoverHeaders { + /** URL to query for status of the operation. */ + azureAsyncOperation?: string; + location?: string; +} + /** Defines headers for PrivateEndpointConnections_update operation. */ export interface PrivateEndpointConnectionsUpdateHeaders { /** URL to query for status of the operation. */ @@ -1489,6 +1498,27 @@ export enum KnownIotHubReplicaRoleType { */ export type IotHubReplicaRoleType = string; +/** Known values of {@link IpVersion} that the service accepts. */ +export enum KnownIpVersion { + /** Ipv4 */ + Ipv4 = "ipv4", + /** Ipv6 */ + Ipv6 = "ipv6", + /** Ipv4Ipv6 */ + Ipv4Ipv6 = "ipv4ipv6" +} + +/** + * Defines values for IpVersion. \ + * {@link KnownIpVersion} can be used interchangeably with IpVersion, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ipv4** \ + * **ipv6** \ + * **ipv4ipv6** + */ +export type IpVersion = string; + /** Known values of {@link IotHubSku} that the service accepts. */ export enum KnownIotHubSku { /** F1 */ diff --git a/sdk/iothub/arm-iothub/src/models/mappers.ts b/sdk/iothub/arm-iothub/src/models/mappers.ts index 8ccd6435ec82..fc4b3e46909f 100644 --- a/sdk/iothub/arm-iothub/src/models/mappers.ts +++ b/sdk/iothub/arm-iothub/src/models/mappers.ts @@ -351,6 +351,12 @@ export const IotHubProperties: coreClient.CompositeMapper = { name: "Composite", className: "RootCertificateProperties" } + }, + ipVersion: { + serializedName: "ipVersion", + type: { + name: "String" + } } } } @@ -3312,6 +3318,27 @@ export const IotHubResourceDeleteHeaders: coreClient.CompositeMapper = { } }; +export const IotHubManualFailoverHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "IotHubManualFailoverHeaders", + modelProperties: { + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + export const PrivateEndpointConnectionsUpdateHeaders: coreClient.CompositeMapper = { type: { name: "Composite", diff --git a/sdk/iothub/arm-iothub/src/models/parameters.ts b/sdk/iothub/arm-iothub/src/models/parameters.ts index ad379429b5b7..efd0f67a1123 100644 --- a/sdk/iothub/arm-iothub/src/models/parameters.ts +++ b/sdk/iothub/arm-iothub/src/models/parameters.ts @@ -53,7 +53,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2022-04-30-preview", + defaultValue: "2022-11-15-preview", isConstant: true, serializedName: "api-version", type: { diff --git a/sdk/iothub/arm-iothub/src/operations/iotHub.ts b/sdk/iothub/arm-iothub/src/operations/iotHub.ts index bbe912957782..d70448c7d543 100644 --- a/sdk/iothub/arm-iothub/src/operations/iotHub.ts +++ b/sdk/iothub/arm-iothub/src/operations/iotHub.ts @@ -11,8 +11,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { IotHubClient } from "../iotHubClient"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { FailoverInput, IotHubManualFailoverOptionalParams } from "../models"; /** Class containing IotHub operations. */ @@ -42,14 +46,14 @@ export class IotHubImpl implements IotHub { resourceGroupName: string, failoverInput: FailoverInput, options?: IotHubManualFailoverOptionalParams - ): Promise, void>> { + ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -82,13 +86,13 @@ export class IotHubImpl implements IotHub { }; }; - const lro = new LroImpl( - sendOperation, - { iotHubName, resourceGroupName, failoverInput, options }, - manualFailoverOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { iotHubName, resourceGroupName, failoverInput, options }, + spec: manualFailoverOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); diff --git a/sdk/iothub/arm-iothub/src/operations/iotHubResource.ts b/sdk/iothub/arm-iothub/src/operations/iotHubResource.ts index 4ccc2e65fc4c..9ddb0c203304 100644 --- a/sdk/iothub/arm-iothub/src/operations/iotHubResource.ts +++ b/sdk/iothub/arm-iothub/src/operations/iotHubResource.ts @@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { IotHubClient } from "../iotHubClient"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { IotHubDescription, IotHubResourceListBySubscriptionNextOptionalParams, @@ -769,8 +773,8 @@ export class IotHubResourceImpl implements IotHubResource { iotHubDescription: IotHubDescription, options?: IotHubResourceCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, IotHubResourceCreateOrUpdateResponse > > { @@ -780,7 +784,7 @@ export class IotHubResourceImpl implements IotHubResource { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -813,13 +817,16 @@ export class IotHubResourceImpl implements IotHubResource { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, resourceName, iotHubDescription, options }, - createOrUpdateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, resourceName, iotHubDescription, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + IotHubResourceCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -863,8 +870,8 @@ export class IotHubResourceImpl implements IotHubResource { iotHubTags: TagsResource, options?: IotHubResourceUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, IotHubResourceUpdateResponse > > { @@ -874,7 +881,7 @@ export class IotHubResourceImpl implements IotHubResource { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -907,13 +914,16 @@ export class IotHubResourceImpl implements IotHubResource { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, resourceName, iotHubTags, options }, - updateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, resourceName, iotHubTags, options }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + IotHubResourceUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -953,8 +963,8 @@ export class IotHubResourceImpl implements IotHubResource { resourceName: string, options?: IotHubResourceDeleteOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, IotHubResourceDeleteResponse > > { @@ -964,7 +974,7 @@ export class IotHubResourceImpl implements IotHubResource { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -997,13 +1007,16 @@ export class IotHubResourceImpl implements IotHubResource { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, resourceName, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, resourceName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller< + IotHubResourceDeleteResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); diff --git a/sdk/iothub/arm-iothub/src/operations/privateEndpointConnections.ts b/sdk/iothub/arm-iothub/src/operations/privateEndpointConnections.ts index 8fe0da860dbc..8feb8d2a5433 100644 --- a/sdk/iothub/arm-iothub/src/operations/privateEndpointConnections.ts +++ b/sdk/iothub/arm-iothub/src/operations/privateEndpointConnections.ts @@ -11,8 +11,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { IotHubClient } from "../iotHubClient"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { PrivateEndpointConnectionsListOptionalParams, PrivateEndpointConnectionsListResponse, @@ -94,8 +98,8 @@ export class PrivateEndpointConnectionsImpl privateEndpointConnection: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, PrivateEndpointConnectionsUpdateResponse > > { @@ -105,7 +109,7 @@ export class PrivateEndpointConnectionsImpl ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -138,19 +142,22 @@ export class PrivateEndpointConnectionsImpl }; }; - const lro = new LroImpl( - sendOperation, - { + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, options }, - updateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + PrivateEndpointConnectionsUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -195,8 +202,8 @@ export class PrivateEndpointConnectionsImpl privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, PrivateEndpointConnectionsDeleteResponse > > { @@ -206,7 +213,7 @@ export class PrivateEndpointConnectionsImpl ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -239,18 +246,21 @@ export class PrivateEndpointConnectionsImpl }; }; - const lro = new LroImpl( - sendOperation, - { + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, resourceName, privateEndpointConnectionName, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller< + PrivateEndpointConnectionsDeleteResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); diff --git a/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHub.ts b/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHub.ts index 8181784133c5..7bfa138df366 100644 --- a/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHub.ts +++ b/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHub.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { FailoverInput, IotHubManualFailoverOptionalParams } from "../models"; /** Interface representing a IotHub. */ @@ -26,7 +26,7 @@ export interface IotHub { resourceGroupName: string, failoverInput: FailoverInput, options?: IotHubManualFailoverOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see * https://aka.ms/manualfailover diff --git a/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHubResource.ts b/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHubResource.ts index 5fb2acabb49f..095ec574fe08 100644 --- a/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHubResource.ts +++ b/sdk/iothub/arm-iothub/src/operationsInterfaces/iotHubResource.ts @@ -7,7 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { IotHubDescription, IotHubResourceListBySubscriptionOptionalParams, @@ -178,8 +178,8 @@ export interface IotHubResource { iotHubDescription: IotHubDescription, options?: IotHubResourceCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, IotHubResourceCreateOrUpdateResponse > >; @@ -211,8 +211,8 @@ export interface IotHubResource { iotHubTags: TagsResource, options?: IotHubResourceUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, IotHubResourceUpdateResponse > >; @@ -240,8 +240,8 @@ export interface IotHubResource { resourceName: string, options?: IotHubResourceDeleteOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, IotHubResourceDeleteResponse > >; diff --git a/sdk/iothub/arm-iothub/src/operationsInterfaces/privateEndpointConnections.ts b/sdk/iothub/arm-iothub/src/operationsInterfaces/privateEndpointConnections.ts index 016cd27cb620..1bc02ccf99f6 100644 --- a/sdk/iothub/arm-iothub/src/operationsInterfaces/privateEndpointConnections.ts +++ b/sdk/iothub/arm-iothub/src/operationsInterfaces/privateEndpointConnections.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { PrivateEndpointConnectionsListOptionalParams, PrivateEndpointConnectionsListResponse, @@ -60,8 +60,8 @@ export interface PrivateEndpointConnections { privateEndpointConnection: PrivateEndpointConnection, options?: PrivateEndpointConnectionsUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, PrivateEndpointConnectionsUpdateResponse > >; @@ -93,8 +93,8 @@ export interface PrivateEndpointConnections { privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, PrivateEndpointConnectionsDeleteResponse > >; diff --git a/sdk/iothub/arm-iothub/test/sampleTest.ts b/sdk/iothub/arm-iothub/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/iothub/arm-iothub/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/iothub/arm-iothub/tsconfig.json b/sdk/iothub/arm-iothub/tsconfig.json index 651a71da11eb..3e6ae96443f3 100644 --- a/sdk/iothub/arm-iothub/tsconfig.json +++ b/sdk/iothub/arm-iothub/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-iothub": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"