mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -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",
|
"name": "sql-migration",
|
||||||
"displayName": "%displayName%",
|
"displayName": "%displayName%",
|
||||||
"description": "%description%",
|
"description": "%description%",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"publisher": "Microsoft",
|
"publisher": "Microsoft",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt",
|
"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[]> {
|
export async function getLocations(account: azdata.Account, subscription: Subscription): Promise<azureResource.AzureLocation[]> {
|
||||||
const api = await getAzureCoreAPI();
|
const api = await getAzureCoreAPI();
|
||||||
const response = await api.getLocations(account, subscription, true);
|
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) {
|
if (response.errors.length > 0) {
|
||||||
throw new Error(response.errors.toString());
|
throw new Error(response.errors.toString());
|
||||||
}
|
}
|
||||||
sortResourceArrayByName(response.locations);
|
sortResourceArrayByName(response.locations);
|
||||||
const supportedLocations = [
|
|
||||||
'eastus2',
|
|
||||||
'eastus2euap',
|
|
||||||
'eastus',
|
|
||||||
'canadacentral'
|
|
||||||
];
|
|
||||||
const filteredLocations = response.locations.filter(loc => {
|
const filteredLocations = response.locations.filter(loc => {
|
||||||
return supportedLocations.includes(loc.name);
|
return sqlMigrationResourceLocations.includes(loc.displayName);
|
||||||
});
|
});
|
||||||
return filteredLocations;
|
return filteredLocations;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user