Add AQL Assessment service (#946)

[SQL Assessment API](https://docs.microsoft.com/en-us/sql/sql-assessment-api/sql-assessment-api-overview) provides a mechanism to evaluate the configuration
of SQL Server for best practices. SQL Assessment API gives a list
of recommended actions to improve SQL Server performance or security.

The SQL Assessment service is used by the expected SQL Assessment
feature of Azure Data Studio. 

SqlAssessmentService forwards JSONRPC calls to SQL Assessment engine
and wraps results as a response.

`assessment/getAssessmentItems` returns a set of checks 
applicable to a given target.

`assessment/invoke` returns a set of recommendations
for improving SQL Server instance or database configurations. 

`assessment/generateScript` returns a T-SQL script for storing
an assessment result set to a SQL data table.
This commit is contained in:
Aleksei Guzev
2020-04-24 10:52:55 +03:00
committed by GitHub
parent 89699823bf
commit bcc1f2a486
15 changed files with 1439 additions and 5 deletions

View File

@@ -0,0 +1,56 @@
//
// 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.TaskServices;
using Microsoft.SqlTools.ServiceLayer.Utility;
namespace Microsoft.SqlTools.ServiceLayer.SqlAssessment.Contracts
{
/// <summary>
/// Parameters for executing a query from a provided string
/// </summary>
public class GenerateScriptParams
{
/// <summary>
/// Gets or sets a list of assessment result items
/// to be written to a table
/// </summary>
public List<AssessmentResultItem> Items { get; set; }
public TaskExecutionMode TaskExecutionMode { get; set; }
public string TargetServerName { get; set; }
public string TargetDatabaseName { get; set; }
}
public class GenerateScriptResult
{
/// <summary>
/// Gets or sets a value indicating
/// if assessment operation was successful
/// </summary>
public bool Success { get; set; }
/// <summary>
/// Gets or sets an status message for the operation
/// </summary>
public string ErrorMessage { get; set; }
/// <summary>
/// Gets or sets script text
/// </summary>
public string Script { get; set; }
}
public class GenerateScriptRequest
{
public static readonly
RequestType<GenerateScriptParams, ResultStatus> Type =
RequestType<GenerateScriptParams, ResultStatus>.Create("assessment/generateScript");
}
}