mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -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:
@@ -1,46 +0,0 @@
|
||||
//
|
||||
// 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;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// SQL Agent Job activity parameters
|
||||
/// </summary>
|
||||
public class AgentJobActionParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public string JobName { get; set; }
|
||||
|
||||
public string Action { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Job activity result
|
||||
/// </summary>
|
||||
public class AgentJobActionResult
|
||||
{
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Jobs request type
|
||||
/// </summary>
|
||||
public class AgentJobActionRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<AgentJobActionParams, AgentJobActionResult> Type =
|
||||
RequestType<AgentJobActionParams, AgentJobActionResult>.Create("agent/jobaction");
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
//
|
||||
// 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;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
|
||||
{
|
||||
|
||||
public class AgentJobHistoryParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public string JobId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Job activity result
|
||||
/// </summary>
|
||||
public class AgentJobHistoryResult
|
||||
{
|
||||
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public AgentJobHistoryInfo[] Jobs { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Jobs request type
|
||||
/// </summary>
|
||||
public class AgentJobHistoryRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<AgentJobHistoryParams, AgentJobHistoryResult> Type =
|
||||
RequestType<AgentJobHistoryParams, AgentJobHistoryResult>.Create("agent/jobhistory");
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
|
||||
public class AgentJobInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Owner { get; set; }
|
||||
public string Description { get; set; }
|
||||
public int CurrentExecutionStatus { get; set; }
|
||||
public int LastRunOutcome { get; set; }
|
||||
public string CurrentExecutionStep { get; set; }
|
||||
@@ -30,5 +32,4 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
|
||||
public string NextRun { get; set; }
|
||||
public string JobId { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
//
|
||||
// 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;
|
||||
using Microsoft.SqlTools.ServiceLayer.TaskServices;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// SQL Agent Job activity parameters
|
||||
/// </summary>
|
||||
public class AgentJobsParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public string JobId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Job activity result
|
||||
/// </summary>
|
||||
public class AgentJobsResult
|
||||
{
|
||||
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public AgentJobInfo[] Jobs { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Jobs request type
|
||||
/// </summary>
|
||||
public class AgentJobsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<AgentJobsParams, AgentJobsResult> Type =
|
||||
RequestType<AgentJobsParams, AgentJobsResult>.Create("agent/jobs");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent create Job params
|
||||
/// </summary>
|
||||
public class CreateAgentJobParams : TaskRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public AgentJobInfo Job { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent create Job result
|
||||
/// </summary>
|
||||
public class CreateAgentJobResult
|
||||
{
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent create Alert request type
|
||||
/// </summary>
|
||||
public class CreateAgentJobRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<CreateAgentJobParams, CreateAgentJobResult> Type =
|
||||
RequestType<CreateAgentJobParams, CreateAgentJobResult>.Create("agent/createjob");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent update Job params
|
||||
/// </summary>
|
||||
public class UpdateAgentJobParams : TaskRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public AgentJobInfo Job { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent update Job result
|
||||
/// </summary>
|
||||
public class UpdateAgentJobResult
|
||||
{
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent update Job request type
|
||||
/// </summary>
|
||||
public class UpdateAgentJobRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<UpdateAgentJobParams, UpdateAgentJobResult> Type =
|
||||
RequestType<UpdateAgentJobParams, UpdateAgentJobResult>.Create("agent/updatejob");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent delete Alert params
|
||||
/// </summary>
|
||||
public class DeleteAgentJobParams : TaskRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public AgentJobInfo Job { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent delete Job result
|
||||
/// </summary>
|
||||
public class DeleteAgentJobResult
|
||||
{
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent delete Job request type
|
||||
/// </summary>
|
||||
public class DeleteAgentJobRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<DeleteAgentJobParams, DeleteAgentJobResult> Type =
|
||||
RequestType<DeleteAgentJobParams, DeleteAgentJobResult>.Create("agent/deletejob");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Job history parameter
|
||||
/// </summary>
|
||||
public class AgentJobHistoryParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public string JobId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Job history result
|
||||
/// </summary>
|
||||
public class AgentJobHistoryResult
|
||||
{
|
||||
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public AgentJobHistoryInfo[] Jobs { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Jobs request type
|
||||
/// </summary>
|
||||
public class AgentJobHistoryRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<AgentJobHistoryParams, AgentJobHistoryResult> Type =
|
||||
RequestType<AgentJobHistoryParams, AgentJobHistoryResult>.Create("agent/jobhistory");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Job activity parameters
|
||||
/// </summary>
|
||||
public class AgentJobActionParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public string JobName { get; set; }
|
||||
|
||||
public string Action { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Job activity result
|
||||
/// </summary>
|
||||
public class AgentJobActionResult
|
||||
{
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Jobs request type
|
||||
/// </summary>
|
||||
public class AgentJobActionRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<AgentJobActionParams, AgentJobActionResult> Type =
|
||||
RequestType<AgentJobActionParams, AgentJobActionResult>.Create("agent/jobaction");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
//
|
||||
// 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;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
|
||||
{
|
||||
public class AgentJobStepInfo
|
||||
{
|
||||
public string JobId { get; set; }
|
||||
|
||||
public string Script { get; set; }
|
||||
|
||||
public string ScriptName { get; set; }
|
||||
|
||||
public string StepName { get; set; }
|
||||
|
||||
public string SubSystem { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Current step id
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// action to take if the step fails
|
||||
/// </summary>
|
||||
public string FailureAction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Action to take if the step succeeds
|
||||
/// </summary>
|
||||
public string SuccessAction { get; set; }
|
||||
|
||||
// note we will have either the id or step
|
||||
// for the steps to go to on failure
|
||||
/// <summary>
|
||||
/// step that will be executed on failure
|
||||
/// </summary>
|
||||
public int FailStepId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// step that will be executed on success
|
||||
/// </summary>
|
||||
public int SuccessStepId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Command to execute
|
||||
/// </summary>
|
||||
public string Command { get; set; }
|
||||
/// <summary>
|
||||
/// Success code for successful execution of the command
|
||||
/// </summary>
|
||||
public int CommandExecutionSuccessCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Database this step will execute against
|
||||
/// </summary>
|
||||
public string DatabaseName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// database user name this step will execute against
|
||||
/// </summary>
|
||||
public string DatabaseUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Server to execute this step against
|
||||
/// </summary>
|
||||
public string Server { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// output file name
|
||||
/// </summary>
|
||||
public string OutputFileName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// indicates whether to append the output to a file
|
||||
/// </summary>
|
||||
public bool AppendToLogFile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// indicates whether to append the output to the step history
|
||||
/// </summary>
|
||||
public bool AppendToStepHist { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// indicates whether to log to table
|
||||
/// </summary>
|
||||
public bool WriteLogToTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// append the output to the table
|
||||
/// </summary>
|
||||
public bool AppendLogToTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// number of rety attempts
|
||||
/// </summary>
|
||||
public int RetryAttempts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// retrey interval
|
||||
/// </summary>
|
||||
public int RetryInterval { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// proxy name
|
||||
/// </summary>
|
||||
public string ProxyName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
//
|
||||
// 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;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// SQL Agent Job Steps parameters
|
||||
/// </summary>
|
||||
public class AgentJobStepsParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Job Steps result
|
||||
/// </summary>
|
||||
public class AgentJobStepsResult
|
||||
{
|
||||
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public AgentJobStepInfo[] Steps { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Steps request type
|
||||
/// </summary>
|
||||
public class AgentJobStepsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<AgentJobStepsParams, AgentJobStepsResult> Type =
|
||||
RequestType<AgentJobStepsParams, AgentJobStepsResult>.Create("agent/jobsteps");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent create Step params
|
||||
/// </summary>
|
||||
public class CreateAgentJobStepParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public AgentJobStepInfo Step { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent create Step result
|
||||
/// </summary>
|
||||
public class CreateAgentJobStepResult
|
||||
{
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent create Step request type
|
||||
/// </summary>
|
||||
public class CreateAgentJobStepRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<CreateAgentJobStepParams, CreateAgentJobStepResult> Type =
|
||||
RequestType<CreateAgentJobStepParams, CreateAgentJobStepResult>.Create("agent/createjobstep");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent delete Step params
|
||||
/// </summary>
|
||||
public class DeleteAgentJobStepParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public AgentJobStepInfo Step { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent delete Step result
|
||||
/// </summary>
|
||||
public class DeleteAgentJobStepResult
|
||||
{
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent delete Step request type
|
||||
/// </summary>
|
||||
public class DeleteAgentJobStepRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<DeleteAgentJobStepParams, DeleteAgentJobStepResult> Type =
|
||||
RequestType<DeleteAgentJobStepParams, DeleteAgentJobStepResult>.Create("agent/deletejobstep");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent update Step params
|
||||
/// </summary>
|
||||
public class UpdateAgentJobStepParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public AgentJobStepInfo Step { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent update Step result
|
||||
/// </summary>
|
||||
public class UpdateAgentJobStepResult
|
||||
{
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent update Step request type
|
||||
/// </summary>
|
||||
public class UpdateAgentJobStepRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<UpdateAgentJobStepParams, UpdateAgentJobStepResult> Type =
|
||||
RequestType<UpdateAgentJobStepParams, UpdateAgentJobStepResult>.Create("agent/updatejobstep");
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
//
|
||||
// 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;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// SQL Agent Job activity parameters
|
||||
/// </summary>
|
||||
public class AgentJobsParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public string JobId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Job activity result
|
||||
/// </summary>
|
||||
public class AgentJobsResult
|
||||
{
|
||||
|
||||
public bool Succeeded { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public AgentJobInfo[] Jobs { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Jobs request type
|
||||
/// </summary>
|
||||
public class AgentJobsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<AgentJobsParams, AgentJobsResult> Type =
|
||||
RequestType<AgentJobsParams, AgentJobsResult>.Create("agent/jobs");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user