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:
Aasim Khan
2021-06-02 15:00:11 -07:00
committed by GitHub
parent 0f9f17fb1b
commit dd8207dd3f
2 changed files with 7 additions and 8 deletions

View File

@@ -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",

View File

@@ -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;
}