// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // using Microsoft.SqlServer.Migration.SkuRecommendation.Contracts.Models; using Microsoft.SqlServer.Migration.SkuRecommendation.Models.Sql; using Microsoft.SqlTools.Hosting.Protocol.Contracts; using System.Collections.Generic; namespace Microsoft.SqlTools.Migration.Contracts { public class GetSkuRecommendationsParams { /// /// Folder from which collected performance data will be read from /// public string DataFolder { get; set; } /// /// Interval at which collected performance data was originally queried at, in seconds /// public int PerfQueryIntervalInSec { get; set; } /// /// List of target platforms to consider when generating recommendations /// public List TargetPlatforms { get; set; } /// /// Name of the SQL instance to generate recommendations for /// public string TargetSqlInstance { get; set; } /// /// Target percentile to use when performing perf data aggregation /// public int TargetPercentile { get; set; } /// /// Scaling ("comfort") factor when evalulating performance requirements /// public int ScalingFactor { get; set; } /// /// Start time of collected data points to consider /// /// TO-DO: do we really need this? it's pretty safe to assume that most users would want us to evaluate all the collected data and not just part of it /// public string StartTime { get; set; } /// /// End time of collected data points to consider /// /// TO-DO: do we really need this? it's pretty safe to assume that most users would want us to evaluate all the collected data and not just part of it /// public string EndTime { get; set; } /// /// Whether or not to consider preview SKUs when generating SKU recommendations /// public bool IncludePreviewSkus { get; set; } /// /// List of databases to consider when generating recommendations /// public List DatabaseAllowList { get; set; } } public class GetSkuRecommendationsResult { /// /// List of SQL DB recommendation results, if applicable /// public List SqlDbRecommendationResults { get; set; } /// /// How long the SQL DB recommendations took to generate, in milliseconds. Equal to -1 if SQL DB recommendations are not applicable. /// public long SqlDbRecommendationDurationInMs { get; set; } /// /// List of SQL MI recommendation results, if applicable /// public List SqlMiRecommendationResults { get; set; } /// /// How long the SQL MI recommendations took to generate, in milliseconds. Equal to -1 if SQL MI recommendations are not applicable. /// public long SqlMiRecommendationDurationInMs { get; set; } /// /// List of SQL VM recommendation results, if applicable /// public List SqlVmRecommendationResults { get; set; } /// /// How long the SQL VM recommendations took to generate, in milliseconds. Equal to -1 if SQL VM recommendations are not applicable. /// public long SqlVmRecommendationDurationInMs { get; set; } /// /// List of SQL DB recommendation results generated by the elastic model, if applicable /// public List ElasticSqlDbRecommendationResults { get; set; } /// /// How long the SQL DB recommendations took to generate using the elastic model, in milliseconds. Equal to -1 if SQL DB elastic recommendations are not applicable. /// public long ElasticSqlDbRecommendationDurationInMs { get; set; } /// /// List of SQL MI recommendation results generated by the elastic model, if applicable /// public List ElasticSqlMiRecommendationResults { get; set; } /// /// How long the SQL MI recommendations took to generate using the elastic model, in milliseconds. Equal to -1 if SQL MI elastic recommendations are not applicable. /// public long ElasticSqlMiRecommendationDurationInMs { get; set; } /// /// List of SQL VM recommendation results generated by the elastic model, if applicable /// public List ElasticSqlVmRecommendationResults { get; set; } /// /// How long the SQL VM recommendations took to generate using the elastic model, in milliseconds. Equal to -1 if SQL VM elastic recommendations are not applicable. /// public long ElasticSqlVmRecommendationDurationInMs { get; set; } /// /// SQL instance requirements, representing an aggregated view of the performance requirements of the source instance /// public SqlInstanceRequirements InstanceRequirements { get; set; } /// /// File paths where the recommendation reports were saved /// public List SkuRecommendationReportPaths { get; set; } /// /// File paths where the recommendation reports generated by the elastic model were saved /// public List ElasticSkuRecommendationReportPaths { get; set; } } // Helper class containing recommendation results, durations, and report paths, which is recommendation model-agnostic internal class RecommendationResultSet { internal List sqlDbResults; internal List sqlMiResults; internal List sqlVmResults; internal long sqlDbDurationInMs; internal long sqlMiDurationInMs; internal long sqlVmDurationInMs; internal string sqlDbReportPath; internal string sqlMiReportPath; internal string sqlVmReportPath; // Create a new empty RecommendationResultSet internal RecommendationResultSet() { this.sqlDbResults = new List(); this.sqlMiResults = new List(); this.sqlVmResults = new List(); this.sqlDbDurationInMs = -1; this.sqlMiDurationInMs = -1; this.sqlVmDurationInMs = -1; this.sqlDbReportPath = ""; this.sqlMiReportPath = ""; this.sqlVmReportPath = ""; } } public class GetSkuRecommendationsRequest { public static readonly RequestType Type = RequestType.Create("migration/getskurecommendations"); } }