Adding support for sending request headers in azure core rest request API (#16443)

* Adding support for sending additional headers in azure http requests

* Added session ids in all azure rest calls

* Fixed param name

* Adding default parameter value for request headers
This commit is contained in:
Aasim Khan
2021-07-27 12:36:50 -07:00
committed by GitHub
parent 35207a1e04
commit 7a35d4aeeb
11 changed files with 79 additions and 53 deletions

View File

@@ -90,7 +90,7 @@ export class CreateSqlMigrationServiceDialog {
try {
this._selectedResourceGroup = resourceGroup;
this._createdMigrationService = await createSqlMigrationService(this._model._azureAccount, subscription, resourceGroup, location, serviceName!);
this._createdMigrationService = await createSqlMigrationService(this._model._azureAccount, subscription, resourceGroup, location, serviceName!, this._model._sessionId);
if (this._createdMigrationService.error) {
this.setDialogMessage(`${this._createdMigrationService.error.code} : ${this._createdMigrationService.error.message}`);
this._statusLoadingComponent.loading = false;
@@ -505,14 +505,14 @@ export class CreateSqlMigrationServiceDialog {
let migrationServiceStatus!: SqlMigrationService;
for (let i = 0; i < maxRetries; i++) {
try {
migrationServiceStatus = await getSqlMigrationService(this._model._azureAccount, subscription, resourceGroup, location, this._createdMigrationService.name);
migrationServiceStatus = await getSqlMigrationService(this._model._azureAccount, subscription, resourceGroup, location, this._createdMigrationService.name, this._model._sessionId);
break;
} catch (e) {
console.log(e);
}
await new Promise(r => setTimeout(r, 5000));
}
const migrationServiceMonitoringStatus = await getSqlMigrationServiceMonitoringData(this._model._azureAccount, subscription, resourceGroup, location, this._createdMigrationService!.name);
const migrationServiceMonitoringStatus = await getSqlMigrationServiceMonitoringData(this._model._azureAccount, subscription, resourceGroup, location, this._createdMigrationService!.name, this._model._sessionId);
this.irNodes = migrationServiceMonitoringStatus.nodes.map((node) => {
return node.nodeName;
});
@@ -546,7 +546,7 @@ export class CreateSqlMigrationServiceDialog {
const subscription = this._model._targetSubscription;
const resourceGroup = (this.migrationServiceResourceGroupDropdown.value as azdata.CategoryValue).name;
const location = this._model._targetServerInstance.location;
const keys = await getSqlMigrationServiceAuthKeys(this._model._azureAccount, subscription, resourceGroup, location, this._createdMigrationService!.name);
const keys = await getSqlMigrationServiceAuthKeys(this._model._azureAccount, subscription, resourceGroup, location, this._createdMigrationService!.name, this._model._sessionId);
this._copyKey1Button = this._view.modelBuilder.button().withProps({
title: constants.COPY_KEY1,

View File

@@ -27,13 +27,15 @@ export class MigrationCutoverDialogModel {
this.migrationOpStatus = (await getMigrationAsyncOperationDetails(
this._migration.azureAccount,
this._migration.subscription,
this._migration.asyncUrl
this._migration.asyncUrl,
this._migration.sessionId!
));
}
this.migrationStatus = (await getMigrationStatus(
this._migration.azureAccount,
this._migration.subscription,
this._migration.migrationContext
this._migration.migrationContext,
this._migration.sessionId!,
));
sendSqlMigrationActionEvent(
@@ -55,7 +57,8 @@ export class MigrationCutoverDialogModel {
const cutover = await startMigrationCutover(
this._migration.azureAccount,
this._migration.subscription,
this.migrationStatus
this.migrationStatus,
this._migration.sessionId!
);
sendSqlMigrationActionEvent(
TelemetryViews.MigrationCutoverDialog,
@@ -81,7 +84,8 @@ export class MigrationCutoverDialogModel {
await stopMigration(
this._migration.azureAccount,
this._migration.subscription,
this.migrationStatus
this.migrationStatus,
this._migration.sessionId!
);
sendSqlMigrationActionEvent(
TelemetryViews.MigrationCutoverDialog,

View File

@@ -66,7 +66,8 @@ export class SqlMigrationServiceDetailsDialog {
migrationContext.subscription,
migrationContext.controller.properties.resourceGroup,
migrationContext.controller.location,
migrationContext.controller.name
migrationContext.controller.name,
this.migrationContext.sessionId!
));
const serviceNodeName = serviceNode.nodes?.map(node => node.nodeName).join(', ')
|| constants.SQL_MIGRATION_SERVICE_DETAILS_STATUS_UNAVAILABLE;
@@ -209,7 +210,8 @@ export class SqlMigrationServiceDetailsDialog {
migrationContext.controller.properties.resourceGroup,
migrationContext.controller.location.toUpperCase(),
migrationContext.controller.name,
keyName);
keyName,
migrationContext.sessionId!);
if (keys?.authKey1 && keyName === AUTH_KEY1) {
await this._updateTableCell(this._migrationServiceAuthKeyTable, 0, 1, keys.authKey1, constants.SERVICE_KEY1_LABEL);
@@ -233,7 +235,8 @@ export class SqlMigrationServiceDetailsDialog {
migrationContext.subscription,
migrationContext.controller.properties.resourceGroup,
migrationContext.controller.location.toUpperCase(),
migrationContext.controller.name);
migrationContext.controller.name,
migrationContext.sessionId!);
const copyKey1Button = view.modelBuilder
.button()