mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
* Added endpoint for fetching all notebook jobs * Refractored NotebookJobInfo to AgentNotebookInfo to make it more consistent with the rest of the codebase * Added Notebook History endpoint in contracts. * Added Create, Update, Delete notebook endpoints. Also added separate fetch template, materialized notebook endpoints. This will make the Notebook Request and Notebook History responses lighter. * AgentNotebookInfo is now derived from AgentJobInfo * added fetch noteook history endpoint * Added fetching materialized notebook endpoint * Added code for cleaning up the directory * Added create notebook api * Added Update and delete notebook job * Fixed notebook history API * Added last run info to the script and template folder * Added execute database feature for notebook Jobs * SQL commands are now using sqlparameters to prevent any injection attacks * Changed rundate and runtime to string to preserve leading zeros * integration test for agentnotebooks api * Made some changes mentioned in PR * Refactored the code, removed enpoint logic from the notebook handler and wrote test cases * changes select statements, fixed a bug in the test job cleanup and fixed other stuff mentioned in the PR. * added notebook_error column in notebook history select statement * Added get template notebook endpoint * Added renaming and pinning notebook runs * made tables names caps to handle servers with case sensitive queries * made some changes to the enpoint points paths * Added delete materialized notebooks endpoints * Fixed a bug in delete, rename and pin apis where requests from multiple clients with materializedID = 0 could have resulted in multiple rows getting created on notebooks.nb_materialized table. * fixed a merge conflict * Made some changes mentioned in the PR
75 lines
2.4 KiB
C#
75 lines
2.4 KiB
C#
//
|
|
// 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 string SqlMessageId { get; set; }
|
|
public string Message { get; set; }
|
|
public string StepId { get; set; }
|
|
public string StepName { get; set; }
|
|
public string SqlSeverity { get; set; }
|
|
public Guid JobId { get; set; }
|
|
public string JobName { get; set; }
|
|
public int RunStatus { get; set; }
|
|
public DateTime RunDate { get; set; }
|
|
public string RunDuration { get; set; }
|
|
public string OperatorEmailed { get; set; }
|
|
public string OperatorNetsent { get; set; }
|
|
public string OperatorPaged { get; set; }
|
|
public string RetriesAttempted { get; set; }
|
|
public string Server { get; set; }
|
|
public AgentJobStep[] Steps { get; set; }
|
|
public AgentScheduleInfo[] Schedules { get; set; }
|
|
public AgentAlertInfo[] Alerts { get; set; }
|
|
}
|
|
|
|
public enum CompletionResult
|
|
{
|
|
Failed = 0,
|
|
Succeeded = 1,
|
|
Retry = 2,
|
|
Cancelled = 3,
|
|
InProgress = 4,
|
|
Unknown = 5
|
|
}
|
|
|
|
public class AgentJobStep
|
|
{
|
|
public string jobId;
|
|
public string stepId;
|
|
public string stepName;
|
|
public string message;
|
|
public string runDate;
|
|
public CompletionResult runStatus;
|
|
public AgentJobStepInfo stepDetails;
|
|
}
|
|
|
|
/// <summary>
|
|
/// a class for storing various properties of a agent notebook history
|
|
/// </summary>
|
|
public class AgentNotebookHistoryInfo : AgentJobHistoryInfo
|
|
{
|
|
public int MaterializedNotebookId { get; set; }
|
|
public bool MaterializedNotebookPin { get; set; }
|
|
public string MaterializedNotebookName { get; set; }
|
|
public int MaterializedNotebookErrorFlag { get; set; }
|
|
public string MaterializedNotebookErrorInfo { get; set; }
|
|
public bool MaterializedNotebookDeleted { get; set; }
|
|
}
|
|
}
|