mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 09:35:43 -05:00
[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.
57 lines
1.7 KiB
C#
57 lines
1.7 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.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");
|
|
}
|
|
}
|