From a1b21ddcae76dd880171110dbac277372a964e04 Mon Sep 17 00:00:00 2001 From: Maor Leger Date: Mon, 4 Nov 2024 21:51:58 +0000 Subject: [PATCH] use latest specs --- .../src/generated/api/operations.ts | 72 +++++++++---------- .../src/generated/keyVaultClient.ts | 4 +- .../src/generated/models/models.ts | 2 +- .../src/generated/models/options.ts | 10 ++- .../src/generated/restorePollerHelpers.ts | 10 +++ 5 files changed, 53 insertions(+), 45 deletions(-) diff --git a/sdk/keyvault/keyvault-admin/src/generated/api/operations.ts b/sdk/keyvault/keyvault-admin/src/generated/api/operations.ts index 5e4bec4917f0..dd4f6de3cbdc 100644 --- a/sdk/keyvault/keyvault-admin/src/generated/api/operations.ts +++ b/sdk/keyvault/keyvault-admin/src/generated/api/operations.ts @@ -166,52 +166,35 @@ export function _preFullBackupSend( export async function _preFullBackupDeserialize( result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["202"]; +): Promise { + const expectedStatuses = ["202", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } - return { - status: result.body["status"] as OperationStatus, - statusDetails: result.body["statusDetails"], - error: !result.body.error - ? undefined - : { - code: result.body.error?.["code"], - message: result.body.error?.["message"], - innerError: !result.body.error?.innererror - ? undefined - : result.body.error?.innererror, - }, - startTime: - result.body["startTime"] !== undefined - ? new Date(result.body["startTime"]) - : undefined, - endTime: - result.body["endTime"] !== undefined - ? new Date(result.body["endTime"]) - : undefined, - jobId: result.body["jobId"], - azureStorageBlobContainerUri: result.body["azureStorageBlobContainerUri"], - }; + return; } /** * Pre-backup operation for checking whether the customer can perform a full * backup operation. */ -export async function preFullBackup( +export function preFullBackup( context: Client, preBackupOperationParameters?: PreBackupOperationParameters, options: PreFullBackupOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _preFullBackupSend( +): PollerLike, void> { + return getLongRunningPoller( context, - preBackupOperationParameters, - options, - ); - return _preFullBackupDeserialize(result); + _preFullBackupDeserialize, + ["202", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _preFullBackupSend(context, preBackupOperationParameters, options), + }, + ) as PollerLike, void>; } export function _restoreStatusSend( @@ -289,7 +272,7 @@ export function _preFullRestoreOperationSend( export async function _preFullRestoreOperationDeserialize( result: PathUncheckedResponse, ): Promise { - const expectedStatuses = ["202"]; + const expectedStatuses = ["202", "200"]; if (!expectedStatuses.includes(result.status)) { throw createRestError(result); } @@ -322,17 +305,26 @@ export async function _preFullRestoreOperationDeserialize( * Pre-restore operation for checking whether the customer can perform a full * restore operation. */ -export async function preFullRestoreOperation( +export function preFullRestoreOperation( context: Client, preRestoreOperationParameters: PreRestoreOperationParameters, options: PreFullRestoreOperationOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _preFullRestoreOperationSend( +): PollerLike, RestoreOperation> { + return getLongRunningPoller( context, - preRestoreOperationParameters, - options, - ); - return _preFullRestoreOperationDeserialize(result); + _preFullRestoreOperationDeserialize, + ["202", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _preFullRestoreOperationSend( + context, + preRestoreOperationParameters, + options, + ), + }, + ) as PollerLike, RestoreOperation>; } export function _fullRestoreOperationSend( diff --git a/sdk/keyvault/keyvault-admin/src/generated/keyVaultClient.ts b/sdk/keyvault/keyvault-admin/src/generated/keyVaultClient.ts index 29a34c2d065a..81b7edc963f0 100644 --- a/sdk/keyvault/keyvault-admin/src/generated/keyVaultClient.ts +++ b/sdk/keyvault/keyvault-admin/src/generated/keyVaultClient.ts @@ -108,7 +108,7 @@ export class KeyVaultClient { preFullBackup( preBackupOperationParameters?: PreBackupOperationParameters, options: PreFullBackupOptionalParams = { requestOptions: {} }, - ): Promise { + ): PollerLike, void> { return preFullBackup(this._client, preBackupOperationParameters, options); } @@ -127,7 +127,7 @@ export class KeyVaultClient { preFullRestoreOperation( preRestoreOperationParameters: PreRestoreOperationParameters, options: PreFullRestoreOperationOptionalParams = { requestOptions: {} }, - ): Promise { + ): PollerLike, RestoreOperation> { return preFullRestoreOperation( this._client, preRestoreOperationParameters, diff --git a/sdk/keyvault/keyvault-admin/src/generated/models/models.ts b/sdk/keyvault/keyvault-admin/src/generated/models/models.ts index 56a4b742139e..439f86dc303e 100644 --- a/sdk/keyvault/keyvault-admin/src/generated/models/models.ts +++ b/sdk/keyvault/keyvault-admin/src/generated/models/models.ts @@ -408,7 +408,7 @@ export interface _RoleDefinitionListResult { } /** The available API versions. */ -export type Versions = "7.6-preview.1"; +export type Versions = "7.5" | "7.6-preview.1"; /** The key vault error exception. */ export interface KeyVaultError { diff --git a/sdk/keyvault/keyvault-admin/src/generated/models/options.ts b/sdk/keyvault/keyvault-admin/src/generated/models/options.ts index 83f24542e6c5..546a64b10d76 100644 --- a/sdk/keyvault/keyvault-admin/src/generated/models/options.ts +++ b/sdk/keyvault/keyvault-admin/src/generated/models/options.ts @@ -13,14 +13,20 @@ export interface FullBackupOptionalParams extends OperationOptions { } /** Optional parameters. */ -export interface PreFullBackupOptionalParams extends OperationOptions {} +export interface PreFullBackupOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} /** Optional parameters. */ export interface RestoreStatusOptionalParams extends OperationOptions {} /** Optional parameters. */ export interface PreFullRestoreOperationOptionalParams - extends OperationOptions {} + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} /** Optional parameters. */ export interface FullRestoreOperationOptionalParams extends OperationOptions { diff --git a/sdk/keyvault/keyvault-admin/src/generated/restorePollerHelpers.ts b/sdk/keyvault/keyvault-admin/src/generated/restorePollerHelpers.ts index 3a6ca4bb7249..de3e1cf42bb5 100644 --- a/sdk/keyvault/keyvault-admin/src/generated/restorePollerHelpers.ts +++ b/sdk/keyvault/keyvault-admin/src/generated/restorePollerHelpers.ts @@ -4,6 +4,8 @@ import { KeyVaultClient } from "./keyVaultClient.js"; import { _fullBackupDeserialize, + _preFullBackupDeserialize, + _preFullRestoreOperationDeserialize, _fullRestoreOperationDeserialize, _selectiveKeyRestoreOperationDeserialize, } from "./api/operations.js"; @@ -89,6 +91,14 @@ const deserializeMap: Record = { deserializer: _fullBackupDeserialize, expectedStatuses: ["202", "200"], }, + "POST /prebackup": { + deserializer: _preFullBackupDeserialize, + expectedStatuses: ["202", "200"], + }, + "PUT /prerestore": { + deserializer: _preFullRestoreOperationDeserialize, + expectedStatuses: ["202", "200"], + }, "PUT /restore": { deserializer: _fullRestoreOperationDeserialize, expectedStatuses: ["202", "200"],