Initial SQL Agent merge for March release (#595)

* Initial SQL Agent WIP

* Fix test build break

* wip

* wip2

* additonal SQL Agent history parsing code

* Fix namespace sorting

* Hook up agent\jobs method

* Fix broken integration test build

* Added handler for job history request (#586)

* fixed agent service tests

* added job history handler

* code review refactoring

* Turn off another failing test

* Disable failing test

* Feature/agent1 adbist (#592)

* fixed agent service tests

* added job history handler

* code review refactoring

* refactored code

* small refactor

* code review changes

* Remove unused code

* Remove unused test file

* Feature/agent1 adbist (#593)

* fixed agent service tests

* added job history handler

* code review refactoring

* refactored code

* small refactor

* code review changes

* changed constant casing

* added handler for job actions

* Reenable disabled test

* cleaned up code
This commit is contained in:
Karl Burtram
2018-03-23 13:25:37 -07:00
committed by GitHub
parent 3937ebef38
commit 376cc21f12
17 changed files with 3402 additions and 5 deletions

View File

@@ -0,0 +1,46 @@
//
// 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");
}
}

View File

@@ -0,0 +1,38 @@
//
// 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.Data;
using System.Collections.Generic;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlTools.ServiceLayer.Agent;
namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
{
/// <summary>
/// a class for storing various properties of agent jobs,
/// used by the Job Activity Monitor
/// </summary>
public class AgentJobHistoryInfo
{
public int InstanceId { get; set; }
public int SqlMessageId { get; set; }
public string Message { get; set; }
public int StepId { get; set; }
public string StepName { get; set; }
public int SqlSeverity { get; set; }
public Guid JobId { get; set; }
public string JobName { get; set; }
public int RunStatus { get; set; }
public DateTime RunDate { get; set; }
public int RunDuration { get; set; }
public string OperatorEmailed { get; set; }
public string OperatorNetsent { get; set; }
public string OperatorPaged { get; set; }
public int RetriesAttempted { get; set; }
public string Server { get; set; }
}
}

View File

@@ -0,0 +1,46 @@
//
// 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");
}
}

View File

@@ -0,0 +1,34 @@
//
// 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.ServiceLayer.Agent;
namespace Microsoft.SqlTools.ServiceLayer.Agent.Contracts
{
/// <summary>
/// a class for storing various properties of agent jobs,
/// used by the Job Activity Monitor
/// </summary>
public class AgentJobInfo
{
public string Name { get; set; }
public int CurrentExecutionStatus { get; set; }
public int LastRunOutcome { get; set; }
public string CurrentExecutionStep { get; set; }
public bool Enabled { get; set; }
public bool HasTarget { get; set; }
public bool HasSchedule { get; set; }
public bool HasStep { get; set; }
public bool Runnable { get; set; }
public string Category { get; set; }
public int CategoryId { get; set; }
public int CategoryType { get; set; }
public string LastRun { get; set; }
public string NextRun { get; set; }
public string JobId { get; set; }
}
}

View File

@@ -0,0 +1,47 @@
//
// 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");
}
}