mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-11 02:32:40 -05:00
Agent configuration support classes (WIP) (#632)
* Additional SQL Agent config classes (WIP) * Fix build breaks * Clean up job step code * Add VS Code build files * Move changes to other machine * More of the action execution classes * More execution processing refactors * More refactoring * Disable tests for WIP merge * Fix break on Release config * Stage changes to other machine.
This commit is contained in:
@@ -42,4 +42,70 @@ namespace Microsoft.SqlTools.ServiceLayer.Security.Contracts
|
||||
RequestType<CreateCredentialParams, CreateCredentialResult> Type =
|
||||
RequestType<CreateCredentialParams, CreateCredentialResult>.Create("security/createcredential");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete Credential params
|
||||
/// </summary>
|
||||
public class DeleteCredentialParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public CredentialInfo Credential { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete Credential result
|
||||
/// </summary>
|
||||
public class DeleteCredentialResult
|
||||
{
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete Credential request type
|
||||
/// </summary>
|
||||
public class DeleteCredentialRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<DeleteCredentialParams, DeleteCredentialResult> Type =
|
||||
RequestType<DeleteCredentialParams, DeleteCredentialResult>.Create("security/deletecredential");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Credential params
|
||||
/// </summary>
|
||||
public class UpdateCredentialParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public CredentialInfo Credential { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Credential result
|
||||
/// </summary>
|
||||
public class UpdateCredentialResult
|
||||
{
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Credential request type
|
||||
/// </summary>
|
||||
public class UpdateCredentialRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<UpdateCredentialParams, UpdateCredentialResult> Type =
|
||||
RequestType<UpdateCredentialParams, UpdateCredentialResult>.Create("security/updatecredential");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,21 +21,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
||||
internal class Credential : ManagementActionBase
|
||||
{
|
||||
|
||||
// #region Trace support
|
||||
// private const string componentName = "Credential";
|
||||
|
||||
// public string ComponentName
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return componentName;
|
||||
// }
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
#region Constants
|
||||
private const int MAX_SQL_SYS_NAME_LENGTH = 128; // max sql sys name length
|
||||
private const string PASSWORD_MASK_STRING = "**********";
|
||||
#endregion
|
||||
|
||||
#region Variables
|
||||
@@ -70,19 +57,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Overrides SqlManagementUserControl
|
||||
/// <summary>
|
||||
/// called on background thread by the framework to execute the action
|
||||
/// </summary>
|
||||
/// <param name="node"></param>
|
||||
public void OnRunNow(object sender)
|
||||
public override void OnRunNow(object sender)
|
||||
{
|
||||
this.credentialData.SendDataToServer();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// update logic layer based on content of user interface
|
||||
/// </summary>
|
||||
|
||||
@@ -75,7 +75,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
||||
public void InitializeService(ServiceHost serviceHost)
|
||||
{
|
||||
this.ServiceHost = serviceHost;
|
||||
|
||||
// Credential request handlers
|
||||
this.ServiceHost.SetRequestHandler(CreateCredentialRequest.Type, HandleCreateCredentialRequest);
|
||||
this.ServiceHost.SetRequestHandler(UpdateCredentialRequest.Type, HandleUpdateCredentialRequest);
|
||||
this.ServiceHost.SetRequestHandler(DeleteCredentialRequest.Type, HandleDeleteCredentialRequest);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -102,6 +106,24 @@ namespace Microsoft.SqlTools.ServiceLayer.Security
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle request to update a credential
|
||||
/// </summary>
|
||||
internal async Task HandleUpdateCredentialRequest(UpdateCredentialParams parameters, RequestContext<UpdateCredentialResult> requestContext)
|
||||
{
|
||||
var result = new UpdateCredentialResult();
|
||||
await requestContext.SendResult(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle request to delete a credential
|
||||
/// </summary>
|
||||
internal async Task HandleDeleteCredentialRequest(DeleteCredentialParams parameters, RequestContext<DeleteCredentialResult> requestContext)
|
||||
{
|
||||
var result = new DeleteCredentialResult();
|
||||
await requestContext.SendResult(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the service
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user