mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-07 17:25:04 -05:00
Akma/login migrations (#1728)
In this PR, we make the appropriate backend service changes in order to enable the login migrations feature in the SQL migration extension. Changes include: updating the Microsoft.SqlServer.Migration.Login NuGet version to the latest version adding a new request handler for StartLoginMigrations calls, which makes the appropriate calls to the login NuGet adding ExtensionMethod helper to properly combine exception maps login migration nuget calls Co-authored-by: Akshay Mata <akma@microsoft.com>
This commit is contained in:
@@ -0,0 +1,135 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlServer.DataCollection.Common.Contracts.OperationsInfrastructure;
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Migration.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the steps in login migration.
|
||||
/// </summary>
|
||||
public enum LoginMigrationStep
|
||||
{
|
||||
/// <summary>
|
||||
/// Run pre-migration validations
|
||||
/// </summary>
|
||||
StartValidations,
|
||||
|
||||
/// <summary>
|
||||
/// Step to hash passwords and migrate logins
|
||||
/// </summary>
|
||||
MigrateLogins,
|
||||
|
||||
/// <summary>
|
||||
/// Step to establish users and logins from source to target
|
||||
/// </summary>
|
||||
EstablishUserMapping,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Step to migrate server roles
|
||||
/// </summary>
|
||||
MigrateServerRoles,
|
||||
|
||||
/// <summary>
|
||||
/// Step to establish roles
|
||||
/// </summary>
|
||||
EstablishServerRoleMapping,
|
||||
|
||||
/// <summary>
|
||||
/// Step to map all the grant/deny permissions for logins
|
||||
/// </summary>
|
||||
SetLoginPermissions,
|
||||
|
||||
/// <summary>
|
||||
/// Step to map all server roles grant/deny permissions
|
||||
/// </summary>
|
||||
SetServerRolePermissions
|
||||
}
|
||||
|
||||
public class StartLoginMigrationParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Connection string to connect to source
|
||||
/// </summary>
|
||||
public string SourceConnectionString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Connection string to connect to target
|
||||
/// </summary>
|
||||
public string TargetConnectionString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of logins to migrate
|
||||
/// </summary>
|
||||
public List<string> LoginList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Azure active directory domain name (required for Windows Auth)
|
||||
/// </summary>
|
||||
public string AADDomainName{ get; set; }
|
||||
}
|
||||
|
||||
public class LoginMigrationResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Start time of the assessment
|
||||
/// </summary>
|
||||
public IDictionary<string, IEnumerable<ReportableException>> ExceptionMap { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The login migration step that just completed
|
||||
/// </summary>
|
||||
public LoginMigrationStep CompletedStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// How long this step took
|
||||
/// </summary>
|
||||
public string ElapsedTime{ get; set; }
|
||||
}
|
||||
|
||||
public class StartLoginMigrationRequest
|
||||
{
|
||||
public static readonly
|
||||
RequestType<StartLoginMigrationParams, LoginMigrationResult> Type =
|
||||
RequestType<StartLoginMigrationParams, LoginMigrationResult>.Create("migration/startloginmigration");
|
||||
}
|
||||
|
||||
public class ValidateLoginMigrationRequest
|
||||
{
|
||||
public static readonly
|
||||
RequestType<StartLoginMigrationParams, LoginMigrationResult> Type =
|
||||
RequestType<StartLoginMigrationParams, LoginMigrationResult>.Create("migration/validateloginmigration");
|
||||
}
|
||||
|
||||
public class MigrateLoginsRequest
|
||||
{
|
||||
public static readonly
|
||||
RequestType<StartLoginMigrationParams, LoginMigrationResult> Type =
|
||||
RequestType<StartLoginMigrationParams, LoginMigrationResult>.Create("migration/migratelogins");
|
||||
}
|
||||
|
||||
public class EstablishUserMappingRequest
|
||||
{
|
||||
public static readonly
|
||||
RequestType<StartLoginMigrationParams, LoginMigrationResult> Type =
|
||||
RequestType<StartLoginMigrationParams, LoginMigrationResult>.Create("migration/establishusermapping");
|
||||
}
|
||||
public class MigrateServerRolesAndSetPermissionsRequest
|
||||
{
|
||||
public static readonly
|
||||
RequestType<StartLoginMigrationParams, LoginMigrationResult> Type =
|
||||
RequestType<StartLoginMigrationParams, LoginMigrationResult>.Create("migration/migrateserverrolesandsetpermissions");
|
||||
}
|
||||
|
||||
public class LoginMigrationNotification
|
||||
{
|
||||
public static readonly
|
||||
EventType<LoginMigrationResult> Type =
|
||||
EventType<LoginMigrationResult>.Create("migration/loginmigrationnotification");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user