示例#1
0
        public async Task <ProductionApiProvisioningWarnings> Execute(CloudOdsInstance cloudOdsInstance)
        {
            var result = new ProductionApiProvisioningWarnings
            {
                ResolutionUrl = "https://portal.azure.com"
            };

            var warnings = new List <string>();

            using (var conn = _rawSqlConnectionService.GetDatabaseConnectionFromConfigFile(_cloudOdsDatabaseNameProvider.GetDatabaseName(CloudOdsDatabases.ProductionOds)))
            {
                var sqlPerformanceLevel = _azureDatabaseManagementService.GetDatabasePerformanceLevel(conn, CloudOdsDatabaseNames.ProductionOds);

                //we have to be careful here not to output a warning in case the user is not running against an Azure Sql instance, hence the validity check
                if (sqlPerformanceLevel.IsValid() && sqlPerformanceLevel < _expectedDatabasePerformanceLevel)
                {
                    warnings.Add($"Azure Sql performance tier '{_expectedDatabasePerformanceLevel.ServiceObjective}' or above is recommended");
                }
            }

            var cloudOdsApiOperationContext = new CloudOdsApiOperationContext(cloudOdsInstance, CloudOdsEnvironment.Production);
            var serverPerformanceLevel      = await _getAzureCloudOdsWebsitePerformanceLevelQuery.Execute(cloudOdsApiOperationContext);

            if (serverPerformanceLevel != null && serverPerformanceLevel < _expectedWebsitePerformanceLevel)
            {
                warnings.Add($"Azure Website performance tier '{_expectedWebsitePerformanceLevel.ServiceObjective}' or above is recommended");
            }

            result.Warnings = warnings;
            return(result);
        }
        public Task <ProductionApiProvisioningWarnings> Execute(CloudOdsInstance cloudOdsInstance)
        {
            var result = new ProductionApiProvisioningWarnings
            {
                Warnings = new List <string>()
            };

            return(Task.FromResult(result));
        }