From c23de31c6a6a9d92be4a129443e6ebc6c8da030a Mon Sep 17 00:00:00 2001 From: aws-sdk-dotnet-automation Date: Tue, 12 Oct 2021 15:55:49 +0000 Subject: [PATCH 1/4] build: version bump to 0.24 --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index 2d9c47969..a9b9390fb 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "0.23", + "version": "0.24", "publicReleaseRefSpec": [ ".*" ], From c52121e31ffbb3b2ed7f3a7536a79b9ccb11ad17 Mon Sep 17 00:00:00 2001 From: Norm Johanson Date: Tue, 12 Oct 2021 20:56:40 -0700 Subject: [PATCH 2/4] feat: Add more metadata to the ServerMode APIs GetRecommendations and GetExistingDeployments so that VS doesn't have to make individual calls for each item returned. --- .../Controllers/DeploymentController.cs | 22 ++++++++++------ .../Models/ExistingDeploymentSummary.cs | 16 ++++++++++++ .../Models/RecommendationSummary.cs | 8 +++++- src/AWS.Deploy.ServerMode.Client/RestAPI.cs | 18 +++++++++++++ .../ServerModeTests.cs | 25 ++++++++++++++++++- 5 files changed, 80 insertions(+), 9 deletions(-) diff --git a/src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs b/src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs index 4905a3cab..316c7f32f 100644 --- a/src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs +++ b/src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs @@ -135,9 +135,11 @@ public async Task GetRecommendations(string sessionId) foreach (var recommendation in state.NewRecommendations) { output.Recommendations.Add(new RecommendationSummary( - recommendation.Recipe.Id, - recommendation.Name, - recommendation.ShortDescription + recipeId: recommendation.Recipe.Id, + name: recommendation.Name, + shortDescription: recommendation.ShortDescription, + description: recommendation.Description, + targetService: recommendation.Recipe.TargetService )); } @@ -270,11 +272,17 @@ public async Task GetExistingDeployments(string sessionId) foreach(var deployment in state.ExistingDeployments) { + var recommendation = state.NewRecommendations.First(x => string.Equals(x.Recipe.Id, deployment.RecipeId)); + output.ExistingDeployments.Add(new ExistingDeploymentSummary( - deployment.Name, - deployment.RecipeId, - deployment.LastUpdatedTime, - deployment.UpdatedByCurrentUser)); + name: deployment.Name, + recipeId: deployment.RecipeId, + recipeName: recommendation.Name, + shortDescription: recommendation.ShortDescription, + description: recommendation.Description, + targetService: recommendation.Recipe.TargetService, + lastUpdatedTime: deployment.LastUpdatedTime, + updatedByCurrentUser: deployment.UpdatedByCurrentUser)); } return Ok(output); diff --git a/src/AWS.Deploy.CLI/ServerMode/Models/ExistingDeploymentSummary.cs b/src/AWS.Deploy.CLI/ServerMode/Models/ExistingDeploymentSummary.cs index cf272e3ef..2a6ab9a9c 100644 --- a/src/AWS.Deploy.CLI/ServerMode/Models/ExistingDeploymentSummary.cs +++ b/src/AWS.Deploy.CLI/ServerMode/Models/ExistingDeploymentSummary.cs @@ -14,6 +14,14 @@ public class ExistingDeploymentSummary public string RecipeId { get; set; } + public string RecipeName { get; set; } + + public string ShortDescription { get; set; } + + public string Description { get; set; } + + public string TargetService { get; set; } + public DateTime? LastUpdatedTime { get; set; } public bool UpdatedByCurrentUser { get; set; } @@ -21,12 +29,20 @@ public class ExistingDeploymentSummary public ExistingDeploymentSummary( string name, string recipeId, + string recipeName, + string shortDescription, + string description, + string targetService, DateTime? lastUpdatedTime, bool updatedByCurrentUser ) { Name = name; RecipeId = recipeId; + RecipeName = recipeName; + ShortDescription = shortDescription; + Description = description; + TargetService = targetService; LastUpdatedTime = lastUpdatedTime; UpdatedByCurrentUser = updatedByCurrentUser; } diff --git a/src/AWS.Deploy.CLI/ServerMode/Models/RecommendationSummary.cs b/src/AWS.Deploy.CLI/ServerMode/Models/RecommendationSummary.cs index bdbc2acc9..d232e7b38 100644 --- a/src/AWS.Deploy.CLI/ServerMode/Models/RecommendationSummary.cs +++ b/src/AWS.Deploy.CLI/ServerMode/Models/RecommendationSummary.cs @@ -11,17 +11,23 @@ public class RecommendationSummary { public string RecipeId { get; set; } public string Name { get; set; } + public string ShortDescription { get; set; } public string Description { get; set; } + public string TargetService { get; set; } public RecommendationSummary( string recipeId, string name, - string description + string shortDescription, + string description, + string targetService ) { RecipeId = recipeId; Name = name; + ShortDescription = shortDescription; Description = description; + TargetService = targetService; } } } diff --git a/src/AWS.Deploy.ServerMode.Client/RestAPI.cs b/src/AWS.Deploy.ServerMode.Client/RestAPI.cs index 22fab6e35..e0edf731c 100644 --- a/src/AWS.Deploy.ServerMode.Client/RestAPI.cs +++ b/src/AWS.Deploy.ServerMode.Client/RestAPI.cs @@ -1415,6 +1415,18 @@ public partial class ExistingDeploymentSummary [Newtonsoft.Json.JsonProperty("recipeId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string RecipeId { get; set; } + [Newtonsoft.Json.JsonProperty("recipeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string RecipeName { get; set; } + + [Newtonsoft.Json.JsonProperty("shortDescription", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ShortDescription { get; set; } + + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Description { get; set; } + + [Newtonsoft.Json.JsonProperty("targetService", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TargetService { get; set; } + [Newtonsoft.Json.JsonProperty("lastUpdatedTime", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset? LastUpdatedTime { get; set; } @@ -1575,9 +1587,15 @@ public partial class RecommendationSummary [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Name { get; set; } + [Newtonsoft.Json.JsonProperty("shortDescription", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string ShortDescription { get; set; } + [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Description { get; set; } + [Newtonsoft.Json.JsonProperty("targetService", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string TargetService { get; set; } + } diff --git a/test/AWS.Deploy.CLI.IntegrationTests/ServerModeTests.cs b/test/AWS.Deploy.CLI.IntegrationTests/ServerModeTests.cs index a415874de..ef5b35d65 100644 --- a/test/AWS.Deploy.CLI.IntegrationTests/ServerModeTests.cs +++ b/test/AWS.Deploy.CLI.IntegrationTests/ServerModeTests.cs @@ -91,7 +91,12 @@ public async Task GetRecommendations() var getRecommendationOutput = await restClient.GetRecommendationsAsync(sessionId); Assert.NotEmpty(getRecommendationOutput.Recommendations); - Assert.Equal("AspNetAppElasticBeanstalkLinux", getRecommendationOutput.Recommendations.FirstOrDefault().RecipeId); + var beanstalkRecommendation = getRecommendationOutput.Recommendations.FirstOrDefault(); + Assert.Equal("AspNetAppElasticBeanstalkLinux", beanstalkRecommendation.RecipeId); + Assert.NotNull(beanstalkRecommendation.ShortDescription); + Assert.NotNull(beanstalkRecommendation.Description); + Assert.True(beanstalkRecommendation.ShortDescription.Length < beanstalkRecommendation.Description.Length); + Assert.Equal("AWS Elastic Beanstalk", beanstalkRecommendation.TargetService); } finally { @@ -212,6 +217,24 @@ public async Task WebFargateDeploymentNoConfigChanges() Assert.True(logOutput.Length > 0); Assert.Contains("Initiating deployment", logOutput.ToString()); + + var redeploymentSessionOutput = await restClient.StartDeploymentSessionAsync(new StartDeploymentSessionInput + { + AwsRegion = _awsRegion, + ProjectPath = projectPath + }); + + var redeploymentSessionId = redeploymentSessionOutput.SessionId; + + var existingDeployments = await restClient.GetExistingDeploymentsAsync(redeploymentSessionId); + var existingDeployment = existingDeployments.ExistingDeployments.First(x => string.Equals(_stackName, x.Name)); + + Assert.Equal(_stackName, existingDeployment.Name); + Assert.Equal(fargateRecommendation.RecipeId, existingDeployment.RecipeId); + Assert.Equal(fargateRecommendation.Name, existingDeployment.RecipeName); + Assert.Equal(fargateRecommendation.ShortDescription, existingDeployment.ShortDescription); + Assert.Equal(fargateRecommendation.Description, existingDeployment.Description); + Assert.Equal(fargateRecommendation.TargetService, existingDeployment.TargetService); } finally { From daf2912823c871164f90e30387aeefe9436aeea9 Mon Sep 17 00:00:00 2001 From: Norm Johanson Date: Wed, 13 Oct 2021 11:11:19 -0700 Subject: [PATCH 3/4] fix: Fixed typo "Additional Deployments Options" --- README.md | 2 +- src/AWS.Deploy.CLI/ConsoleUtilities.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 99446001c..5b8492540 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ Recommended Deployment Option 1: ASP.NET Core App to Amazon ECS using Fargate ASP.NET Core applications built as a container and deployed to Amazon Elastic Container Service (ECS) with compute power managed by AWS Fargate compute engine. Recommended for applications that can be deployed as a container image. If your project does not contain a Dockerfile, one will be generated for the project. -Additional Deployments Options +Additional Deployment Options ------------------------------ 2: ASP.NET Core App to AWS Elastic Beanstalk on Linux Deploy an ASP.NET Core application to AWS Elastic Beanstalk. Recommended for applications that are not set up to be deployed as containers. diff --git a/src/AWS.Deploy.CLI/ConsoleUtilities.cs b/src/AWS.Deploy.CLI/ConsoleUtilities.cs index 97476268e..bbbe1d61f 100644 --- a/src/AWS.Deploy.CLI/ConsoleUtilities.cs +++ b/src/AWS.Deploy.CLI/ConsoleUtilities.cs @@ -61,7 +61,7 @@ public Recommendation AskToChooseRecommendation(IList recommenda if (recommendations.Count > 1) { - _interactiveService.WriteLine("Additional Deployments Options"); + _interactiveService.WriteLine("Additional Deployment Options"); _interactiveService.WriteLine("------------------------------"); for (var index = 1; index < recommendations.Count; index++) { From 71532864c349477a4725dcb24d4e38d724fbb277 Mon Sep 17 00:00:00 2001 From: Philippe El Asmar Date: Wed, 13 Oct 2021 14:35:36 -0400 Subject: [PATCH 4/4] feat: add SummaryDisplayable field for Option Item Summary --- src/AWS.Deploy.CLI/Commands/DeployCommand.cs | 12 +----------- .../Controllers/DeploymentController.cs | 1 + .../ServerMode/Models/OptionSettingItemSummary.cs | 2 ++ src/AWS.Deploy.Common/Recommendation.cs | 15 +++++++++++++++ src/AWS.Deploy.ServerMode.Client/RestAPI.cs | 3 +++ 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/AWS.Deploy.CLI/Commands/DeployCommand.cs b/src/AWS.Deploy.CLI/Commands/DeployCommand.cs index cc784a662..8ea3fafe7 100644 --- a/src/AWS.Deploy.CLI/Commands/DeployCommand.cs +++ b/src/AWS.Deploy.CLI/Commands/DeployCommand.cs @@ -299,17 +299,7 @@ private async Task GetSelectedRecommendationFromPreviousDeployme selectedRecommendation .Recipe .OptionSettings - .Where(x => - { - if (!selectedRecommendation.IsOptionSettingDisplayable(x)) - return false; - - var value = selectedRecommendation.GetOptionSettingValue(x); - if (value == null || value.ToString() == string.Empty) - return false; - - return true; - }) + .Where(x => selectedRecommendation.IsSummaryDisplayable(x)) .ToArray(); foreach (var setting in optionSettings) diff --git a/src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs b/src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs index 316c7f32f..b86550f96 100644 --- a/src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs +++ b/src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs @@ -189,6 +189,7 @@ private List ListOptionSettingSummary(Recommendation r Advanced = setting.AdvancedSetting, ReadOnly = recommendation.IsExistingCloudApplication && !setting.Updatable, Visible = recommendation.IsOptionSettingDisplayable(setting), + SummaryDisplayable = recommendation.IsSummaryDisplayable(setting), AllowedValues = setting.AllowedValues, ValueMapping = setting.ValueMapping, ChildOptionSettings = ListOptionSettingSummary(recommendation, setting.ChildOptionSettings) diff --git a/src/AWS.Deploy.CLI/ServerMode/Models/OptionSettingItemSummary.cs b/src/AWS.Deploy.CLI/ServerMode/Models/OptionSettingItemSummary.cs index 240a5ac58..b9be7d986 100644 --- a/src/AWS.Deploy.CLI/ServerMode/Models/OptionSettingItemSummary.cs +++ b/src/AWS.Deploy.CLI/ServerMode/Models/OptionSettingItemSummary.cs @@ -26,6 +26,8 @@ public class OptionSettingItemSummary public bool Visible { get; set; } + public bool SummaryDisplayable { get; set; } + public IList AllowedValues { get; set; } = new List(); public IDictionary ValueMapping { get; set; } = new Dictionary(StringComparer.OrdinalIgnoreCase); diff --git a/src/AWS.Deploy.Common/Recommendation.cs b/src/AWS.Deploy.Common/Recommendation.cs index 5a8a95a66..d23caf2d1 100644 --- a/src/AWS.Deploy.Common/Recommendation.cs +++ b/src/AWS.Deploy.Common/Recommendation.cs @@ -182,5 +182,20 @@ public bool IsOptionSettingDisplayable(OptionSettingItem optionSetting) return true; } + + /// + /// Checks whether the Option Setting Item can be displayed as part of the settings summary of the previous deployment. + /// + public bool IsSummaryDisplayable(OptionSettingItem optionSettingItem) + { + if (!IsOptionSettingDisplayable(optionSettingItem)) + return false; + + var value = GetOptionSettingValue(optionSettingItem); + if (string.IsNullOrEmpty(value?.ToString())) + return false; + + return true; + } } } diff --git a/src/AWS.Deploy.ServerMode.Client/RestAPI.cs b/src/AWS.Deploy.ServerMode.Client/RestAPI.cs index e0edf731c..33b3d8c5b 100644 --- a/src/AWS.Deploy.ServerMode.Client/RestAPI.cs +++ b/src/AWS.Deploy.ServerMode.Client/RestAPI.cs @@ -1536,6 +1536,9 @@ public partial class OptionSettingItemSummary [Newtonsoft.Json.JsonProperty("visible", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool Visible { get; set; } + [Newtonsoft.Json.JsonProperty("summaryDisplayable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool SummaryDisplayable { get; set; } + [Newtonsoft.Json.JsonProperty("allowedValues", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection AllowedValues { get; set; }