Changing to resource group level api to fetch dms (#16614)

This commit is contained in:
Aasim Khan
2021-08-06 23:58:57 -07:00
committed by GitHub
parent a4bccb6e6c
commit dc0ccba767
2 changed files with 3 additions and 3 deletions

View File

@@ -152,9 +152,9 @@ export async function getSqlMigrationService(account: azdata.Account, subscripti
return response.response.data; return response.response.data;
} }
export async function getSqlMigrationServices(account: azdata.Account, subscription: Subscription, sessionId: string): Promise<SqlMigrationService[]> { export async function getSqlMigrationServices(account: azdata.Account, subscription: Subscription, resouceGroupName: string, sessionId: string): Promise<SqlMigrationService[]> {
const api = await getAzureCoreAPI(); const api = await getAzureCoreAPI();
const path = `/subscriptions/${subscription.id}/providers/Microsoft.DataMigration/sqlMigrationServices?api-version=2020-09-01-preview`; const path = `/subscriptions/${subscription.id}/resourceGroups/${resouceGroupName}/providers/Microsoft.DataMigration/sqlMigrationServices?api-version=2020-09-01-preview`;
const response = await api.makeAzureRestRequest(account, subscription, path, azurecore.HttpRequestMethod.GET, undefined, true, undefined, getSessionIdHeader(sessionId)); const response = await api.makeAzureRestRequest(account, subscription, path, azurecore.HttpRequestMethod.GET, undefined, true, undefined, getSessionIdHeader(sessionId));
if (response.errors.length > 0) { if (response.errors.length > 0) {
throw new Error(response.errors.toString()); throw new Error(response.errors.toString());

View File

@@ -794,7 +794,7 @@ export class MigrationStateModel implements Model, vscode.Disposable {
public async getSqlMigrationServiceValues(subscription: azureResource.AzureResourceSubscription, managedInstance: SqlManagedInstance, resourceGroupName: string): Promise<azdata.CategoryValue[]> { public async getSqlMigrationServiceValues(subscription: azureResource.AzureResourceSubscription, managedInstance: SqlManagedInstance, resourceGroupName: string): Promise<azdata.CategoryValue[]> {
let sqlMigrationServiceValues: azdata.CategoryValue[] = []; let sqlMigrationServiceValues: azdata.CategoryValue[] = [];
try { try {
this._sqlMigrationServices = (await getSqlMigrationServices(this._azureAccount, subscription, this._sessionId)).filter(sms => sms.location.toLowerCase() === this._targetServerInstance.location.toLowerCase() && sms.properties.resourceGroup.toLowerCase() === resourceGroupName?.toLowerCase()); this._sqlMigrationServices = (await getSqlMigrationServices(this._azureAccount, subscription, resourceGroupName?.toLowerCase(), this._sessionId)).filter(sms => sms.location.toLowerCase() === this._targetServerInstance.location.toLowerCase());
this._sqlMigrationServices.forEach((sqlMigrationService) => { this._sqlMigrationServices.forEach((sqlMigrationService) => {
sqlMigrationServiceValues.push({ sqlMigrationServiceValues.push({
name: sqlMigrationService.id, name: sqlMigrationService.id,