mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
Adding more regions to migration target page (#15606)
* adding more regions to target page * Making location fetching dynamic * vbump migration to 0.1.2
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"name": "sql-migration",
|
||||
"displayName": "%displayName%",
|
||||
"description": "%description%",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"publisher": "Microsoft",
|
||||
"preview": true,
|
||||
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt",
|
||||
|
||||
@@ -28,18 +28,17 @@ export async function getSubscriptions(account: azdata.Account): Promise<Subscri
|
||||
export async function getLocations(account: azdata.Account, subscription: Subscription): Promise<azureResource.AzureLocation[]> {
|
||||
const api = await getAzureCoreAPI();
|
||||
const response = await api.getLocations(account, subscription, true);
|
||||
const dataMigrationResourceProvider = (await api.makeAzureRestRequest(account, subscription, `/subscriptions/${subscription.id}/providers/Microsoft.DataMigration?api-version=2021-04-01`, azurecore.HttpRequestMethod.GET)).response.data;
|
||||
const sqlMigratonResource = dataMigrationResourceProvider.resourceTypes.find((r: any) => r.resourceType === 'SqlMigrationServices');
|
||||
const sqlMigrationResourceLocations = sqlMigratonResource.locations;
|
||||
|
||||
if (response.errors.length > 0) {
|
||||
throw new Error(response.errors.toString());
|
||||
}
|
||||
sortResourceArrayByName(response.locations);
|
||||
const supportedLocations = [
|
||||
'eastus2',
|
||||
'eastus2euap',
|
||||
'eastus',
|
||||
'canadacentral'
|
||||
];
|
||||
|
||||
const filteredLocations = response.locations.filter(loc => {
|
||||
return supportedLocations.includes(loc.name);
|
||||
return sqlMigrationResourceLocations.includes(loc.displayName);
|
||||
});
|
||||
return filteredLocations;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user