mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Add initial schedule request handlers (#638)
This commit is contained in:
@@ -29,14 +29,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
|
||||
public AgentProxyInfo[] Proxies { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Proxy result
|
||||
/// </summary>
|
||||
public class AgentProxyResult : ResultStatus
|
||||
{
|
||||
public AgentProxyInfo Proxy { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Proxy Accounts request type
|
||||
/// </summary>
|
||||
@@ -50,6 +42,14 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
|
||||
RequestType<AgentProxiesParams, AgentProxiesResult>.Create("agent/proxies");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Proxy result
|
||||
/// </summary>
|
||||
public class AgentProxyResult : ResultStatus
|
||||
{
|
||||
public AgentProxyInfo Proxy { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent create Proxy Account params
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlTools.ServiceLayer.Agent;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
|
||||
{
|
||||
[Flags]
|
||||
public enum FrequencyTypes
|
||||
{
|
||||
Unknown = 0,
|
||||
OneTime = 1,
|
||||
Daily = 4,
|
||||
Weekly = 8,
|
||||
Monthly = 16,
|
||||
MonthlyRelative = 32,
|
||||
AutoStart = 64,
|
||||
OnIdle = 128
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum FrequencySubDayTypes
|
||||
{
|
||||
Unknown = 0,
|
||||
Once = 1,
|
||||
Second = 2,
|
||||
Minute = 4,
|
||||
Hour = 8
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum FrequencyRelativeIntervals
|
||||
{
|
||||
First = 1,
|
||||
Second = 2,
|
||||
Third = 4,
|
||||
Fourth = 8,
|
||||
Last = 16
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// a class for storing various properties of agent schedules
|
||||
/// </summary>
|
||||
public class AgentScheduleInfo
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string JobName { get; set; }
|
||||
public bool IsEnabled { get; set; }
|
||||
public FrequencyTypes FrequencyTypes { get; set; }
|
||||
public FrequencySubDayTypes FrequencySubDayTypes { get; set; }
|
||||
public int FrequencySubDayInterval { get; set; }
|
||||
public FrequencyRelativeIntervals FrequencyRelativeIntervals { get; set; }
|
||||
public int FrequencyRecurrenceFactor { get; set; }
|
||||
public int FrequencyInterval { get; set; }
|
||||
public DateTime DateCreated { get; set; }
|
||||
public TimeSpan ActiveStartTimeOfDay { get; set; }
|
||||
public DateTime ActiveStartDate { get; set; }
|
||||
public TimeSpan ActiveEndTimeOfDay { get; set; }
|
||||
public int JobCount { get; set; }
|
||||
public DateTime ActiveEndDate { get; set; }
|
||||
public Guid ScheduleUid { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// 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 Schedules parameters
|
||||
/// </summary>
|
||||
public class AgentSchedulesParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Schedules result
|
||||
/// </summary>
|
||||
public class AgentSchedulesResult
|
||||
{
|
||||
public bool Success { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public AgentScheduleInfo[] Schedules { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Schedules request type
|
||||
/// </summary>
|
||||
public class AgentSchedulesRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<AgentSchedulesParams, AgentSchedulesResult> Type =
|
||||
RequestType<AgentSchedulesParams, AgentSchedulesResult>.Create("agent/schedules");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent Schedule result
|
||||
/// </summary>
|
||||
public class AgentScheduleResult : ResultStatus
|
||||
{
|
||||
public AgentScheduleInfo Schedule { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent create Schedules params
|
||||
/// </summary>
|
||||
public class CreateAgentScheduleParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public AgentScheduleInfo Schedule { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent create Schedule request type
|
||||
/// </summary>
|
||||
public class CreateAgentScheduleRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<CreateAgentScheduleParams, AgentScheduleResult> Type =
|
||||
RequestType<CreateAgentScheduleParams, AgentScheduleResult>.Create("agent/createschedule");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent update Schedule params
|
||||
/// </summary>
|
||||
public class UpdateAgentScheduleParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public string OriginalScheduleName { get; set; }
|
||||
|
||||
public AgentScheduleInfo Schedule { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent update Schedule request type
|
||||
/// </summary>
|
||||
public class UpdateAgentScheduleRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<UpdateAgentScheduleParams, AgentScheduleResult> Type =
|
||||
RequestType<UpdateAgentScheduleParams, AgentScheduleResult>.Create("agent/updateschedule");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent delete Schedule params
|
||||
/// </summary>
|
||||
public class DeleteAgentScheduleParams : GeneralRequestDetails
|
||||
{
|
||||
public string OwnerUri { get; set; }
|
||||
|
||||
public AgentScheduleInfo Schedule { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Agent delete Schedule request type
|
||||
/// </summary>
|
||||
public class DeleteAgentScheduleRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Request definition
|
||||
/// </summary>
|
||||
public static readonly
|
||||
RequestType<DeleteAgentScheduleParams, ResultStatus> Type =
|
||||
RequestType<DeleteAgentScheduleParams, ResultStatus>.Create("agent/deleteschedule");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user