diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 587b911bcea6..ecca00dc8bb2 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -13797,7 +13797,7 @@ packages: dev: false file:projects/arm-rediscache.tgz: - resolution: {integrity: sha512-cVPVS4kYq6n83VLO8Cl95K5TkE63nlvYvZeEoUMOp5wGVvwgR+UA8xSlSg1/eMqQ1jeaTuiyHoFa5n+slIYnTw==, tarball: file:projects/arm-rediscache.tgz} + resolution: {integrity: sha512-EO2zPTIB4RsmBQlVdJ22sHB7w2x2WqDGiCWSvoO9ded2UtbSm8sEzFDxGkG9RtX8ymVaww1dDhU9m3c0/AQF0w==, tarball: file:projects/arm-rediscache.tgz} name: '@rush-temp/arm-rediscache' version: 0.0.0 dependencies: @@ -13812,14 +13812,14 @@ packages: '@types/node': 14.18.43 chai: 4.3.7 cross-env: 7.0.3 - dotenv: 8.6.0 - mkdirp: 1.0.4 + dotenv: 16.0.3 + mkdirp: 2.1.6 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 rollup-plugin-sourcemaps: 0.6.3_mn2f3gd3jpedkkr23obcmzv5eq tslib: 2.5.0 - typescript: 5.0.4 + typescript: 4.8.4 uglify-js: 3.17.4 transitivePeerDependencies: - supports-color diff --git a/sdk/redis/arm-rediscache/CHANGELOG.md b/sdk/redis/arm-rediscache/CHANGELOG.md index fe797a1c5cd4..f7dbe4e403e6 100644 --- a/sdk/redis/arm-rediscache/CHANGELOG.md +++ b/sdk/redis/arm-rediscache/CHANGELOG.md @@ -1,15 +1,13 @@ # Release History + +## 7.2.0 (2023-05-09) + +**Features** -## 7.1.2 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Interface ExportRDBParameters has a new optional parameter storageSubscriptionId + - Interface ImportRDBParameters has a new optional parameter storageSubscriptionId + - Interface RedisCommonPropertiesRedisConfiguration has a new optional parameter storageSubscriptionId + ## 7.1.1 (2023-01-31) **Features** diff --git a/sdk/redis/arm-rediscache/_meta.json b/sdk/redis/arm-rediscache/_meta.json index 1da906c15325..dd157feca5ea 100644 --- a/sdk/redis/arm-rediscache/_meta.json +++ b/sdk/redis/arm-rediscache/_meta.json @@ -1,8 +1,8 @@ { - "commit": "794b03f1b40b6f7646528fbe06bcfce7b58223a9", + "commit": "4a7af0df86022e5e6cc6e8f40ca1981c4557a4bc", "readme": "specification/redis/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=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\redis\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.7 --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/redis/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.6.0", - "use": "@autorest/typescript@6.0.0-rc.7" + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.0", + "use": "@autorest/typescript@6.0.0-rc.10" } \ No newline at end of file diff --git a/sdk/redis/arm-rediscache/package.json b/sdk/redis/arm-rediscache/package.json index 03c012737803..96065270769f 100644 --- a/sdk/redis/arm-rediscache/package.json +++ b/sdk/redis/arm-rediscache/package.json @@ -3,15 +3,15 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for RedisManagementClient.", - "version": "7.1.2", + "version": "7.2.0", "engines": { "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,13 +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": "~5.0.0", + "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", - "dotenv": "^8.2.0", + "dotenv": "^16.0.0", "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", @@ -48,8 +48,7 @@ "chai": "^4.2.0", "cross-env": "^7.0.2", "@types/node": "^14.0.0", - "@azure/dev-tool": "^1.0.0", - "@azure/arm-network": "^26.0.0" + "@azure/dev-tool": "^1.0.0" }, "repository": { "type": "git", @@ -112,13 +111,5 @@ ] }, "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/redis/arm-rediscache", - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-rediscache?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/redis/arm-rediscache" +} \ No newline at end of file diff --git a/sdk/redis/arm-rediscache/review/arm-rediscache.api.md b/sdk/redis/arm-rediscache/review/arm-rediscache.api.md index a5c90985d6fa..ea3b263dd294 100644 --- a/sdk/redis/arm-rediscache/review/arm-rediscache.api.md +++ b/sdk/redis/arm-rediscache/review/arm-rediscache.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 interface AsyncOperationStatus { @@ -69,6 +69,7 @@ export interface ExportRDBParameters { format?: string; preferredDataArchiveAuthMethod?: string; prefix: string; + storageSubscriptionId?: string; } // @public @@ -119,6 +120,7 @@ export interface ImportRDBParameters { files: string[]; format?: string; preferredDataArchiveAuthMethod?: string; + storageSubscriptionId?: string; } // @public @@ -202,9 +204,9 @@ export enum KnownTlsVersion { // @public export interface LinkedServer { - beginCreate(resourceGroupName: string, name: string, linkedServerName: string, parameters: RedisLinkedServerCreateParameters, options?: LinkedServerCreateOptionalParams): Promise, LinkedServerCreateResponse>>; + beginCreate(resourceGroupName: string, name: string, linkedServerName: string, parameters: RedisLinkedServerCreateParameters, options?: LinkedServerCreateOptionalParams): Promise, LinkedServerCreateResponse>>; beginCreateAndWait(resourceGroupName: string, name: string, linkedServerName: string, parameters: RedisLinkedServerCreateParameters, options?: LinkedServerCreateOptionalParams): Promise; - beginDelete(resourceGroupName: string, name: string, linkedServerName: string, options?: LinkedServerDeleteOptionalParams): Promise, void>>; + beginDelete(resourceGroupName: string, name: string, linkedServerName: string, options?: LinkedServerDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, name: string, linkedServerName: string, options?: LinkedServerDeleteOptionalParams): Promise; get(resourceGroupName: string, name: string, linkedServerName: string, options?: LinkedServerGetOptionalParams): Promise; list(resourceGroupName: string, name: string, options?: LinkedServerListOptionalParams): PagedAsyncIterableIterator; @@ -385,7 +387,7 @@ export type PrivateEndpointConnectionProvisioningState = string; // @public export interface PrivateEndpointConnections { - beginPut(resourceGroupName: string, cacheName: string, privateEndpointConnectionName: string, properties: PrivateEndpointConnection, options?: PrivateEndpointConnectionsPutOptionalParams): Promise, PrivateEndpointConnectionsPutResponse>>; + beginPut(resourceGroupName: string, cacheName: string, privateEndpointConnectionName: string, properties: PrivateEndpointConnection, options?: PrivateEndpointConnectionsPutOptionalParams): Promise, PrivateEndpointConnectionsPutResponse>>; beginPutAndWait(resourceGroupName: string, cacheName: string, privateEndpointConnectionName: string, properties: PrivateEndpointConnection, options?: PrivateEndpointConnectionsPutOptionalParams): Promise; delete(resourceGroupName: string, cacheName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise; get(resourceGroupName: string, cacheName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; @@ -468,15 +470,15 @@ export type RebootType = string; // @public export interface Redis { - beginCreate(resourceGroupName: string, name: string, parameters: RedisCreateParameters, options?: RedisCreateOptionalParams): Promise, RedisCreateResponse>>; + beginCreate(resourceGroupName: string, name: string, parameters: RedisCreateParameters, options?: RedisCreateOptionalParams): Promise, RedisCreateResponse>>; beginCreateAndWait(resourceGroupName: string, name: string, parameters: RedisCreateParameters, options?: RedisCreateOptionalParams): Promise; - beginDelete(resourceGroupName: string, name: string, options?: RedisDeleteOptionalParams): Promise, void>>; + beginDelete(resourceGroupName: string, name: string, options?: RedisDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, name: string, options?: RedisDeleteOptionalParams): Promise; - beginExportData(resourceGroupName: string, name: string, parameters: ExportRDBParameters, options?: RedisExportDataOptionalParams): Promise, void>>; + beginExportData(resourceGroupName: string, name: string, parameters: ExportRDBParameters, options?: RedisExportDataOptionalParams): Promise, void>>; beginExportDataAndWait(resourceGroupName: string, name: string, parameters: ExportRDBParameters, options?: RedisExportDataOptionalParams): Promise; - beginImportData(resourceGroupName: string, name: string, parameters: ImportRDBParameters, options?: RedisImportDataOptionalParams): Promise, void>>; + beginImportData(resourceGroupName: string, name: string, parameters: ImportRDBParameters, options?: RedisImportDataOptionalParams): Promise, void>>; beginImportDataAndWait(resourceGroupName: string, name: string, parameters: ImportRDBParameters, options?: RedisImportDataOptionalParams): Promise; - beginUpdate(resourceGroupName: string, name: string, parameters: RedisUpdateParameters, options?: RedisUpdateOptionalParams): Promise, RedisUpdateResponse>>; + beginUpdate(resourceGroupName: string, name: string, parameters: RedisUpdateParameters, options?: RedisUpdateOptionalParams): Promise, RedisUpdateResponse>>; beginUpdateAndWait(resourceGroupName: string, name: string, parameters: RedisUpdateParameters, options?: RedisUpdateOptionalParams): Promise; checkNameAvailability(parameters: CheckNameAvailabilityParameters, options?: RedisCheckNameAvailabilityOptionalParams): Promise; forceReboot(resourceGroupName: string, name: string, parameters: RedisRebootParameters, options?: RedisForceRebootOptionalParams): Promise; @@ -531,6 +533,7 @@ export interface RedisCommonPropertiesRedisConfiguration { rdbBackupFrequency?: string; rdbBackupMaxSnapshotCount?: string; rdbStorageConnectionString?: string; + storageSubscriptionId?: string; readonly zonalConfiguration?: string; } diff --git a/sdk/redis/arm-rediscache/src/lroImpl.ts b/sdk/redis/arm-rediscache/src/lroImpl.ts index 518d5f053b4e..dd803cd5e28c 100644 --- a/sdk/redis/arm-rediscache/src/lroImpl.ts +++ b/sdk/redis/arm-rediscache/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/redis/arm-rediscache/src/models/index.ts b/sdk/redis/arm-rediscache/src/models/index.ts index b807d03817ff..c8846c831e74 100644 --- a/sdk/redis/arm-rediscache/src/models/index.ts +++ b/sdk/redis/arm-rediscache/src/models/index.ts @@ -239,6 +239,8 @@ export interface RedisCommonPropertiesRedisConfiguration { readonly zonalConfiguration?: string; /** Specifies whether the authentication is disabled. Setting this property is highly discouraged from security point of view. */ authnotrequired?: string; + /** SubscriptionId of the storage account for persistence (aof/rdb) using ManagedIdentity. */ + storageSubscriptionId?: string; } /** Managed service identity (system assigned and/or user assigned identities) */ @@ -440,6 +442,8 @@ export interface ImportRDBParameters { files: string[]; /** Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS */ preferredDataArchiveAuthMethod?: string; + /** Subscription id of the storage container containing files to import using Managed Identity. */ + storageSubscriptionId?: string; } /** Parameters for Redis export operation. */ @@ -452,6 +456,8 @@ export interface ExportRDBParameters { container: string; /** Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS */ preferredDataArchiveAuthMethod?: string; + /** Subscription id of the storage container for data to be exported using ManagedIdentity. */ + storageSubscriptionId?: string; } /** The response of list firewall rules Redis operation. */ diff --git a/sdk/redis/arm-rediscache/src/models/mappers.ts b/sdk/redis/arm-rediscache/src/models/mappers.ts index b04c78078cc7..c37ce4bb0459 100644 --- a/sdk/redis/arm-rediscache/src/models/mappers.ts +++ b/sdk/redis/arm-rediscache/src/models/mappers.ts @@ -596,6 +596,12 @@ export const RedisCommonPropertiesRedisConfiguration: coreClient.CompositeMapper type: { name: "String" } + }, + storageSubscriptionId: { + serializedName: "storage-subscription-id", + type: { + name: "String" + } } } } @@ -1035,6 +1041,12 @@ export const ImportRDBParameters: coreClient.CompositeMapper = { type: { name: "String" } + }, + storageSubscriptionId: { + serializedName: "storage-subscription-id", + type: { + name: "String" + } } } } @@ -1070,6 +1082,12 @@ export const ExportRDBParameters: coreClient.CompositeMapper = { type: { name: "String" } + }, + storageSubscriptionId: { + serializedName: "storage-subscription-id", + type: { + name: "String" + } } } } diff --git a/sdk/redis/arm-rediscache/src/models/parameters.ts b/sdk/redis/arm-rediscache/src/models/parameters.ts index 752b54f2cd84..5d100ca1cff9 100644 --- a/sdk/redis/arm-rediscache/src/models/parameters.ts +++ b/sdk/redis/arm-rediscache/src/models/parameters.ts @@ -52,7 +52,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2022-06-01", + defaultValue: "2023-04-01", isConstant: true, serializedName: "api-version", type: { diff --git a/sdk/redis/arm-rediscache/src/operations/linkedServer.ts b/sdk/redis/arm-rediscache/src/operations/linkedServer.ts index 4f89bff64e63..22c5af58ef1a 100644 --- a/sdk/redis/arm-rediscache/src/operations/linkedServer.ts +++ b/sdk/redis/arm-rediscache/src/operations/linkedServer.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 { RedisManagementClient } from "../redisManagementClient"; -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 { RedisLinkedServerWithProperties, LinkedServerListNextOptionalParams, @@ -128,8 +132,8 @@ export class LinkedServerImpl implements LinkedServer { parameters: RedisLinkedServerCreateParameters, options?: LinkedServerCreateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, LinkedServerCreateResponse > > { @@ -139,7 +143,7 @@ export class LinkedServerImpl implements LinkedServer { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -172,13 +176,16 @@ export class LinkedServerImpl implements LinkedServer { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, name, linkedServerName, parameters, options }, - createOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, name, linkedServerName, parameters, options }, + spec: createOperationSpec + }); + const poller = await createHttpPoller< + LinkedServerCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -222,14 +229,14 @@ export class LinkedServerImpl implements LinkedServer { name: string, linkedServerName: string, options?: LinkedServerDeleteOptionalParams - ): 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 ) => { @@ -262,13 +269,13 @@ export class LinkedServerImpl implements LinkedServer { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, name, linkedServerName, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, name, linkedServerName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); diff --git a/sdk/redis/arm-rediscache/src/operations/privateEndpointConnections.ts b/sdk/redis/arm-rediscache/src/operations/privateEndpointConnections.ts index cf5cbb5827b2..86099481f434 100644 --- a/sdk/redis/arm-rediscache/src/operations/privateEndpointConnections.ts +++ b/sdk/redis/arm-rediscache/src/operations/privateEndpointConnections.ts @@ -12,8 +12,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { RedisManagementClient } from "../redisManagementClient"; -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 { PrivateEndpointConnection, PrivateEndpointConnectionsListOptionalParams, @@ -150,8 +154,8 @@ export class PrivateEndpointConnectionsImpl properties: PrivateEndpointConnection, options?: PrivateEndpointConnectionsPutOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, PrivateEndpointConnectionsPutResponse > > { @@ -161,7 +165,7 @@ export class PrivateEndpointConnectionsImpl ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -194,19 +198,22 @@ export class PrivateEndpointConnectionsImpl }; }; - const lro = new LroImpl( - sendOperation, - { + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, cacheName, privateEndpointConnectionName, properties, options }, - putOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + spec: putOperationSpec + }); + const poller = await createHttpPoller< + PrivateEndpointConnectionsPutResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); diff --git a/sdk/redis/arm-rediscache/src/operations/redis.ts b/sdk/redis/arm-rediscache/src/operations/redis.ts index ed9e14beb842..5b0005eac5d9 100644 --- a/sdk/redis/arm-rediscache/src/operations/redis.ts +++ b/sdk/redis/arm-rediscache/src/operations/redis.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 { RedisManagementClient } from "../redisManagementClient"; -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 { UpgradeNotification, RedisListUpgradeNotificationsNextOptionalParams, @@ -331,7 +335,7 @@ export class RedisImpl implements Redis { parameters: RedisCreateParameters, options?: RedisCreateOptionalParams ): Promise< - PollerLike, RedisCreateResponse> + SimplePollerLike, RedisCreateResponse> > { const directSendOperation = async ( args: coreClient.OperationArguments, @@ -339,7 +343,7 @@ export class RedisImpl implements Redis { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -372,13 +376,16 @@ export class RedisImpl implements Redis { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, name, parameters, options }, - createOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, name, parameters, options }, + spec: createOperationSpec + }); + const poller = await createHttpPoller< + RedisCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -420,7 +427,7 @@ export class RedisImpl implements Redis { parameters: RedisUpdateParameters, options?: RedisUpdateOptionalParams ): Promise< - PollerLike, RedisUpdateResponse> + SimplePollerLike, RedisUpdateResponse> > { const directSendOperation = async ( args: coreClient.OperationArguments, @@ -428,7 +435,7 @@ export class RedisImpl implements Redis { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -461,13 +468,16 @@ export class RedisImpl implements Redis { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, name, parameters, options }, - updateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, name, parameters, options }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + RedisUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -506,14 +516,14 @@ export class RedisImpl implements Redis { resourceGroupName: string, name: string, options?: RedisDeleteOptionalParams - ): 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 ) => { @@ -546,13 +556,13 @@ export class RedisImpl implements Redis { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, name, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, name, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -689,14 +699,14 @@ export class RedisImpl implements Redis { name: string, parameters: ImportRDBParameters, options?: RedisImportDataOptionalParams - ): 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 ) => { @@ -729,13 +739,13 @@ export class RedisImpl implements Redis { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, name, parameters, options }, - importDataOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, name, parameters, options }, + spec: importDataOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -776,14 +786,14 @@ export class RedisImpl implements Redis { name: string, parameters: ExportRDBParameters, options?: RedisExportDataOptionalParams - ): 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 ) => { @@ -816,13 +826,13 @@ export class RedisImpl implements Redis { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, name, parameters, options }, - exportDataOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, name, parameters, options }, + spec: exportDataOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); diff --git a/sdk/redis/arm-rediscache/src/operationsInterfaces/linkedServer.ts b/sdk/redis/arm-rediscache/src/operationsInterfaces/linkedServer.ts index 178e46712083..86667e5fcffe 100644 --- a/sdk/redis/arm-rediscache/src/operationsInterfaces/linkedServer.ts +++ b/sdk/redis/arm-rediscache/src/operationsInterfaces/linkedServer.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 { RedisLinkedServerWithProperties, LinkedServerListOptionalParams, @@ -48,8 +48,8 @@ export interface LinkedServer { parameters: RedisLinkedServerCreateParameters, options?: LinkedServerCreateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, LinkedServerCreateResponse > >; @@ -80,7 +80,7 @@ export interface LinkedServer { name: string, linkedServerName: string, options?: LinkedServerDeleteOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Deletes the linked server from a redis cache (requires Premium SKU). * @param resourceGroupName The name of the resource group. diff --git a/sdk/redis/arm-rediscache/src/operationsInterfaces/privateEndpointConnections.ts b/sdk/redis/arm-rediscache/src/operationsInterfaces/privateEndpointConnections.ts index 17937ea28e24..0f505d8e0841 100644 --- a/sdk/redis/arm-rediscache/src/operationsInterfaces/privateEndpointConnections.ts +++ b/sdk/redis/arm-rediscache/src/operationsInterfaces/privateEndpointConnections.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 { PrivateEndpointConnection, PrivateEndpointConnectionsListOptionalParams, @@ -62,8 +62,8 @@ export interface PrivateEndpointConnections { properties: PrivateEndpointConnection, options?: PrivateEndpointConnectionsPutOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, PrivateEndpointConnectionsPutResponse > >; diff --git a/sdk/redis/arm-rediscache/src/operationsInterfaces/redis.ts b/sdk/redis/arm-rediscache/src/operationsInterfaces/redis.ts index 90c7fba54303..e8285132f509 100644 --- a/sdk/redis/arm-rediscache/src/operationsInterfaces/redis.ts +++ b/sdk/redis/arm-rediscache/src/operationsInterfaces/redis.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 { UpgradeNotification, RedisListUpgradeNotificationsOptionalParams, @@ -94,7 +94,7 @@ export interface Redis { parameters: RedisCreateParameters, options?: RedisCreateOptionalParams ): Promise< - PollerLike, RedisCreateResponse> + SimplePollerLike, RedisCreateResponse> >; /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. @@ -122,7 +122,7 @@ export interface Redis { parameters: RedisUpdateParameters, options?: RedisUpdateOptionalParams ): Promise< - PollerLike, RedisUpdateResponse> + SimplePollerLike, RedisUpdateResponse> >; /** * Update an existing Redis cache. @@ -147,7 +147,7 @@ export interface Redis { resourceGroupName: string, name: string, options?: RedisDeleteOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Deletes a Redis cache. * @param resourceGroupName The name of the resource group. @@ -222,7 +222,7 @@ export interface Redis { name: string, parameters: ImportRDBParameters, options?: RedisImportDataOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Import data into Redis cache. * @param resourceGroupName The name of the resource group. @@ -248,7 +248,7 @@ export interface Redis { name: string, parameters: ExportRDBParameters, options?: RedisExportDataOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Export data from the redis cache to blobs in a container. * @param resourceGroupName The name of the resource group. diff --git a/sdk/redis/arm-rediscache/src/redisManagementClient.ts b/sdk/redis/arm-rediscache/src/redisManagementClient.ts index c65e46d52f15..29d84842eb42 100644 --- a/sdk/redis/arm-rediscache/src/redisManagementClient.ts +++ b/sdk/redis/arm-rediscache/src/redisManagementClient.ts @@ -69,7 +69,7 @@ export class RedisManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-rediscache/7.1.2`; + const packageDetails = `azsdk-js-arm-rediscache/7.2.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -122,7 +122,7 @@ export class RedisManagementClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2022-06-01"; + this.apiVersion = options.apiVersion || "2023-04-01"; this.operations = new OperationsImpl(this); this.redis = new RedisImpl(this); this.firewallRules = new FirewallRulesImpl(this); diff --git a/sdk/redis/arm-rediscache/test/sampleTest.ts b/sdk/redis/arm-rediscache/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/redis/arm-rediscache/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/redis/arm-rediscache/tsconfig.json b/sdk/redis/arm-rediscache/tsconfig.json index a52528a33769..3e6ae96443f3 100644 --- a/sdk/redis/arm-rediscache/tsconfig.json +++ b/sdk/redis/arm-rediscache/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-rediscache": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"