mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 17:22:59 -05:00
add delete migration method in migration list and details pages (#22243)
* add delete migraiton, fix stale token detection * address pr comments, fix api error response format
This commit is contained in:
@@ -286,7 +286,11 @@ export async function getVMInstanceView(sqlVm: SqlVMServer, account: azdata.Acco
|
||||
const response = await api.makeAzureRestRequest(account, subscription, path, azurecore.HttpRequestMethod.GET, undefined, true, host);
|
||||
|
||||
if (response.errors.length > 0) {
|
||||
throw new Error(response.errors.toString());
|
||||
const message = response.errors
|
||||
.map(err => err.message)
|
||||
.join(', ');
|
||||
throw new Error(message);
|
||||
|
||||
}
|
||||
|
||||
return response.response.data;
|
||||
@@ -299,7 +303,11 @@ export async function getAzureResourceGivenId(account: azdata.Account, subscript
|
||||
const response = await api.makeAzureRestRequest(account, subscription, path, azurecore.HttpRequestMethod.GET, undefined, true, host);
|
||||
|
||||
if (response.errors.length > 0) {
|
||||
throw new Error(response.errors.toString());
|
||||
const message = response.errors
|
||||
.map(err => err.message)
|
||||
.join(', ');
|
||||
throw new Error(message);
|
||||
|
||||
}
|
||||
|
||||
return response.response.data;
|
||||
@@ -620,6 +628,19 @@ export async function stopMigration(account: azdata.Account, subscription: Subsc
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteMigration(account: azdata.Account, subscription: Subscription, migrationId: string): Promise<void> {
|
||||
const api = await getAzureCoreAPI();
|
||||
const path = encodeURI(`${migrationId}?api-version=${DMSV2_API_VERSION}`);
|
||||
const host = api.getProviderMetadataForAccount(account).settings.armResource?.endpoint;
|
||||
const response = await api.makeAzureRestRequest(account, subscription, path, azurecore.HttpRequestMethod.DELETE, undefined, true, host);
|
||||
if (response.errors.length > 0) {
|
||||
const message = response.errors
|
||||
.map(err => err.message)
|
||||
.join(', ');
|
||||
throw new Error(message);
|
||||
}
|
||||
}
|
||||
|
||||
export async function getLocationDisplayName(location: string): Promise<string> {
|
||||
const api = await getAzureCoreAPI();
|
||||
return api.getRegionDisplayName(location);
|
||||
|
||||
Reference in New Issue
Block a user