mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-04 01:25:43 -05:00
Tde migration integration (#1806)
Adding certificate migration for encrypted databases. Uses notifications to send events back to the client every time each database certificate is migrated.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Migration.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters for the certificate migration progress event
|
||||
/// </summary>
|
||||
public class CertificateMigrationProgressParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Database name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Message related to the success status. true should describe a positive outcome. false should have an error.
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Result of migration
|
||||
/// </summary>
|
||||
public bool Success { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create a certificate migration request. This should be register at the client.
|
||||
/// </summary>
|
||||
public class CertificateMigrationProgressEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Name and parameters for the event definition.
|
||||
/// </summary>
|
||||
public static readonly
|
||||
EventType<CertificateMigrationProgressParams> Type =
|
||||
EventType<CertificateMigrationProgressParams>.Create("migration/tdemigrationprogress");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Migration.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters for the certificate migration operation
|
||||
/// </summary>
|
||||
public class CertificateMigrationParams
|
||||
{
|
||||
/// <summary>
|
||||
/// List of databses to migrate the certificates
|
||||
/// </summary>
|
||||
public List<string> EncryptedDatabases { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Source connection string to the server
|
||||
/// </summary>
|
||||
public string SourceSqlConnectionString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Target subscription id
|
||||
/// </summary>
|
||||
public string TargetSubscriptionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Target resource group name
|
||||
/// </summary>
|
||||
public string TargetResourceGroupName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Target manages instance name
|
||||
/// </summary>
|
||||
public string TargetManagedInstanceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Place where certificates will be exported
|
||||
/// </summary>
|
||||
public string NetworkSharePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Domain for the user credentials able to read from the shared path
|
||||
/// </summary>
|
||||
public string NetworkShareDomain { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Username for the credentials able to read from the shared path
|
||||
/// </summary>
|
||||
public string NetworkShareUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Password for the credentials able to read from the shared path
|
||||
/// </summary>
|
||||
public string NetworkSharePassword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Access token for the ARM client
|
||||
/// </summary>
|
||||
public string AccessToken { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Result for the certificate migration operation
|
||||
/// </summary>
|
||||
public class CertificateMigrationResult
|
||||
{
|
||||
/// <summary>
|
||||
/// List of the status of each certificate migration result attempted.
|
||||
/// </summary>
|
||||
public List<CertificateMigrationEntryResult> MigrationStatuses { get; set; } = new List<CertificateMigrationEntryResult>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Result for an individual database certificate migration
|
||||
/// </summary>
|
||||
public class CertificateMigrationEntryResult
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the database this result represent
|
||||
/// </summary>
|
||||
public string DbName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The result of the migration.
|
||||
/// </summary>
|
||||
public bool Success { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Description of the success status or the error message encountered when the migration was not successful
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Certificate migration request definition
|
||||
/// </summary>
|
||||
public class CertificateMigrationRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Name, parameter and return type for the certicate migration operation
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<CertificateMigrationParams, CertificateMigrationResult> Type =
|
||||
RequestType<CertificateMigrationParams, CertificateMigrationResult>.Create("migration/tdemigration");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user