From a35ad220c0f610842380488a25ab6c84e7c94da6 Mon Sep 17 00:00:00 2001 From: Phil Asmar Date: Wed, 8 Dec 2021 16:49:02 -0500 Subject: [PATCH] feat: Add type hints on child settings --- .../TypeHints/DynamoDBTableCommand.cs | 5 +- .../Commands/TypeHints/InstanceTypeCommand.cs | 93 +++++++++++++++++++ .../Commands/TypeHints/S3BucketNameCommand.cs | 5 +- .../Commands/TypeHints/SNSTopicArnsCommand.cs | 4 +- .../Commands/TypeHints/SQSQueueUrlCommand.cs | 4 +- .../TypeHints/TypeHintCommandFactory.cs | 5 + .../Recipes/OptionSettingTypeHint.cs | 6 +- .../TypeHintData/DynamoDBTableTypeHintData.cs | 23 +++++ .../TypeHintData/S3BucketNameTypeHintData.cs | 23 +++++ .../TypeHintData/SNSTopicArnsTypeHintData.cs | 23 +++++ .../TypeHintData/SQSQueueUrlTypeHintData.cs | 23 +++++ .../Data/AWSResourceQueryer.cs | 15 +++ .../ASP.NETAppAppRunner.recipe | 8 ++ .../ASP.NETAppECSFargate.recipe | 6 ++ .../ASP.NETAppElasticBeanstalk.recipe | 6 +- .../RecipeDefinitions/BlazorWasm.recipe | 4 + .../ConsoleAppECSFargateScheduleTask.recipe | 6 ++ .../ConsoleAppECSFargateService.recipe | 6 ++ .../Utilities/TestToolAWSResourceQueryer.cs | 1 + .../Utilities/TestToolAWSResourceQueryer.cs | 1 + 20 files changed, 261 insertions(+), 6 deletions(-) create mode 100644 src/AWS.Deploy.CLI/Commands/TypeHints/InstanceTypeCommand.cs create mode 100644 src/AWS.Deploy.Common/TypeHintData/DynamoDBTableTypeHintData.cs create mode 100644 src/AWS.Deploy.Common/TypeHintData/S3BucketNameTypeHintData.cs create mode 100644 src/AWS.Deploy.Common/TypeHintData/SNSTopicArnsTypeHintData.cs create mode 100644 src/AWS.Deploy.Common/TypeHintData/SQSQueueUrlTypeHintData.cs diff --git a/src/AWS.Deploy.CLI/Commands/TypeHints/DynamoDBTableCommand.cs b/src/AWS.Deploy.CLI/Commands/TypeHints/DynamoDBTableCommand.cs index 766834f7a..35231e01e 100644 --- a/src/AWS.Deploy.CLI/Commands/TypeHints/DynamoDBTableCommand.cs +++ b/src/AWS.Deploy.CLI/Commands/TypeHints/DynamoDBTableCommand.cs @@ -38,9 +38,12 @@ public async Task Execute(Recommendation recommendation, OptionSettingIt { const string NO_VALUE = "*** Do not select table ***"; var currentValue = recommendation.GetOptionSettingValue(optionSetting); + var typeHintData = optionSetting.GetTypeHintData(); var tables = await GetData(); - tables.Add(NO_VALUE); + if (typeHintData?.AllowNoValue ?? false) + tables.Add(NO_VALUE); + var userResponse = _consoleUtilities.AskUserToChoose( values: tables, title: "Select a DynamoDB table:", diff --git a/src/AWS.Deploy.CLI/Commands/TypeHints/InstanceTypeCommand.cs b/src/AWS.Deploy.CLI/Commands/TypeHints/InstanceTypeCommand.cs new file mode 100644 index 000000000..098b2b800 --- /dev/null +++ b/src/AWS.Deploy.CLI/Commands/TypeHints/InstanceTypeCommand.cs @@ -0,0 +1,93 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Amazon.EC2.Model; +using AWS.Deploy.Common; +using AWS.Deploy.Common.Recipes; +using AWS.Deploy.Common.TypeHintData; +using AWS.Deploy.Orchestration.Data; + +namespace AWS.Deploy.CLI.Commands.TypeHints +{ + public class InstanceTypeCommand : ITypeHintCommand + { + private readonly IAWSResourceQueryer _awsResourceQueryer; + private readonly IConsoleUtilities _consoleUtilities; + + public InstanceTypeCommand(IAWSResourceQueryer awsResourceQueryer, IConsoleUtilities consoleUtilities) + { + _awsResourceQueryer = awsResourceQueryer; + _consoleUtilities = consoleUtilities; + } + + private async Task?> GetData(Recommendation recommendation, OptionSettingItem optionSetting) + { + return await _awsResourceQueryer.ListOfAvailableInstanceTypes(); + } + + public async Task?> GetResources(Recommendation recommendation, OptionSettingItem optionSetting) + { + var instanceType = await GetData(recommendation, optionSetting); + return instanceType? + .Select(x => new TypeHintResource(x.InstanceType.Value, x.InstanceType.Value)) + .Distinct() + .OrderBy(x => x) + .ToList(); + } + + public async Task Execute(Recommendation recommendation, OptionSettingItem optionSetting) + { + var instanceTypes = await GetData(recommendation, optionSetting); + var instanceTypeDefaultValue = recommendation.GetOptionSettingDefaultValue(optionSetting); + if (instanceTypes == null) + { + return _consoleUtilities.AskUserForValue("Select EC2 Instance Type:", instanceTypeDefaultValue ?? string.Empty, true); + } + + var freeTierEligibleAnswer = _consoleUtilities.AskYesNoQuestion("Do you want the EC2 instance to be free tier eligible?", "true"); + var freeTierEligible = freeTierEligibleAnswer == YesNo.Yes; + + var architectureAllowedValues = new List { "x86_64", "arm64"}; + + var architecture = _consoleUtilities.AskUserToChoose(architectureAllowedValues, "The architecture of the EC2 instances created for the environment.", "x86_64"); + + var cpuCores = instanceTypes + .Where(x => x.FreeTierEligible.Equals(freeTierEligible)) + .Where(x => x.ProcessorInfo.SupportedArchitectures.Contains(architecture)) + .Select(x => x.VCpuInfo.DefaultCores).Distinct().OrderBy(x => x).ToList(); + + if (cpuCores.Count == 0) + return _consoleUtilities.AskUserForValue("Select EC2 Instance Type:", instanceTypeDefaultValue ?? string.Empty, true); + + var cpuCoreCount = int.Parse(_consoleUtilities.AskUserToChoose(cpuCores.Select(x => x.ToString()).ToList(), "Select EC2 Instance CPU Cores:", "1")); + + var memory = instanceTypes + .Where(x => x.FreeTierEligible.Equals(freeTierEligible)) + .Where(x => x.ProcessorInfo.SupportedArchitectures.Contains(architecture)) + .Where(x => x.VCpuInfo.DefaultCores.Equals(cpuCoreCount)) + .Select(x => x.MemoryInfo.SizeInMiB).Distinct().OrderBy(x => x).ToList(); + + if (memory.Count == 0) + return _consoleUtilities.AskUserForValue("Select EC2 Instance Type:", instanceTypeDefaultValue ?? string.Empty, true); + + var memoryCount = _consoleUtilities.AskUserToChoose(memory.Select(x => x.ToString()).ToList(), "Select EC2 Instance Memory:", "1024"); + + var availableInstanceTypes = instanceTypes + .Where(x => x.FreeTierEligible.Equals(freeTierEligible)) + .Where(x => x.ProcessorInfo.SupportedArchitectures.Contains(architecture)) + .Where(x => x.VCpuInfo.DefaultCores.Equals(cpuCoreCount)) + .Where(x => x.MemoryInfo.SizeInMiB.Equals(long.Parse(memoryCount))) + .Select(x => x.InstanceType.Value).Distinct().OrderBy(x => x).ToList(); + + if (availableInstanceTypes.Count == 0) + return _consoleUtilities.AskUserForValue("Select EC2 Instance Type:", instanceTypeDefaultValue ?? string.Empty, true); + + var userResponse = _consoleUtilities.AskUserToChoose(availableInstanceTypes, "Select EC2 Instance Type:", availableInstanceTypes.First()); + + return userResponse; + } + } +} diff --git a/src/AWS.Deploy.CLI/Commands/TypeHints/S3BucketNameCommand.cs b/src/AWS.Deploy.CLI/Commands/TypeHints/S3BucketNameCommand.cs index 9c3763036..a76be855f 100644 --- a/src/AWS.Deploy.CLI/Commands/TypeHints/S3BucketNameCommand.cs +++ b/src/AWS.Deploy.CLI/Commands/TypeHints/S3BucketNameCommand.cs @@ -39,9 +39,12 @@ public async Task Execute(Recommendation recommendation, OptionSettingIt { const string NO_VALUE = "*** Do not select bucket ***"; var currentValue = recommendation.GetOptionSettingValue(optionSetting); + var typeHintData = optionSetting.GetTypeHintData(); var buckets = (await GetData()).Select(bucket => bucket.BucketName).ToList(); - buckets.Add(NO_VALUE); + if (typeHintData?.AllowNoValue ?? false) + buckets.Add(NO_VALUE); + var userResponse = _consoleUtilities.AskUserToChoose( values: buckets, title: "Select a S3 bucket:", diff --git a/src/AWS.Deploy.CLI/Commands/TypeHints/SNSTopicArnsCommand.cs b/src/AWS.Deploy.CLI/Commands/TypeHints/SNSTopicArnsCommand.cs index 024bf19af..148a1a496 100644 --- a/src/AWS.Deploy.CLI/Commands/TypeHints/SNSTopicArnsCommand.cs +++ b/src/AWS.Deploy.CLI/Commands/TypeHints/SNSTopicArnsCommand.cs @@ -33,6 +33,7 @@ public async Task Execute(Recommendation recommendation, OptionSettingIt { const string NO_VALUE = "*** Do not select topic ***"; var currentValue = recommendation.GetOptionSettingValue(optionSetting); + var typeHintData = optionSetting.GetTypeHintData(); var currentValueStr = currentValue.ToString() ?? string.Empty; var topicArns = await GetResources(recommendation, optionSetting); @@ -43,7 +44,8 @@ public async Task Execute(Recommendation recommendation, OptionSettingIt currentName = currentValueStr.Substring(currentValueStr.LastIndexOf(':') + 1); } - topicNames.Add(NO_VALUE); + if (typeHintData?.AllowNoValue ?? false) + topicNames.Add(NO_VALUE); var userResponse = _consoleUtilities.AskUserToChoose( values: topicNames, title: "Select a SNS topic:", diff --git a/src/AWS.Deploy.CLI/Commands/TypeHints/SQSQueueUrlCommand.cs b/src/AWS.Deploy.CLI/Commands/TypeHints/SQSQueueUrlCommand.cs index 2572bbd15..8fcba0ff0 100644 --- a/src/AWS.Deploy.CLI/Commands/TypeHints/SQSQueueUrlCommand.cs +++ b/src/AWS.Deploy.CLI/Commands/TypeHints/SQSQueueUrlCommand.cs @@ -33,6 +33,7 @@ public async Task Execute(Recommendation recommendation, OptionSettingIt { const string NO_VALUE = "*** Do not select queue ***"; var currentValue = recommendation.GetOptionSettingValue(optionSetting); + var typeHintData = optionSetting.GetTypeHintData(); var currentValueStr = currentValue.ToString() ?? string.Empty; var queueUrls = await GetResources(recommendation, optionSetting); @@ -43,7 +44,8 @@ public async Task Execute(Recommendation recommendation, OptionSettingIt currentName = currentValueStr.Substring(currentValueStr.LastIndexOf('/') + 1); } - queueNames.Add(NO_VALUE); + if (typeHintData?.AllowNoValue ?? false) + queueNames.Add(NO_VALUE); var userResponse = _consoleUtilities.AskUserToChoose( values: queueNames, title: "Select a SQS queue:", diff --git a/src/AWS.Deploy.CLI/Commands/TypeHints/TypeHintCommandFactory.cs b/src/AWS.Deploy.CLI/Commands/TypeHints/TypeHintCommandFactory.cs index c4443b527..050dad9af 100644 --- a/src/AWS.Deploy.CLI/Commands/TypeHints/TypeHintCommandFactory.cs +++ b/src/AWS.Deploy.CLI/Commands/TypeHints/TypeHintCommandFactory.cs @@ -38,22 +38,27 @@ public TypeHintCommandFactory(IToolInteractiveService toolInteractiveService, IA _commands = new Dictionary { { OptionSettingTypeHint.BeanstalkApplication, new BeanstalkApplicationCommand(awsResourceQueryer, consoleUtilities) }, + { OptionSettingTypeHint.ExistingBeanstalkApplication, new BeanstalkApplicationCommand(awsResourceQueryer, consoleUtilities) }, { OptionSettingTypeHint.BeanstalkEnvironment, new BeanstalkEnvironmentCommand(awsResourceQueryer, consoleUtilities) }, { OptionSettingTypeHint.DotnetBeanstalkPlatformArn, new DotnetBeanstalkPlatformArnCommand(awsResourceQueryer, consoleUtilities) }, { OptionSettingTypeHint.EC2KeyPair, new EC2KeyPairCommand(toolInteractiveService, awsResourceQueryer, consoleUtilities) }, { OptionSettingTypeHint.IAMRole, new IAMRoleCommand(awsResourceQueryer, consoleUtilities) }, + { OptionSettingTypeHint.ExistingIAMRole, new IAMRoleCommand(awsResourceQueryer, consoleUtilities) }, { OptionSettingTypeHint.Vpc, new VpcCommand(awsResourceQueryer, consoleUtilities) }, + { OptionSettingTypeHint.ExistingVpc, new VpcCommand(awsResourceQueryer, consoleUtilities) }, { OptionSettingTypeHint.DotnetPublishAdditionalBuildArguments, new DotnetPublishArgsCommand(consoleUtilities) }, { OptionSettingTypeHint.DotnetPublishSelfContainedBuild, new DotnetPublishSelfContainedBuildCommand(consoleUtilities) }, { OptionSettingTypeHint.DotnetPublishBuildConfiguration, new DotnetPublishBuildConfigurationCommand(consoleUtilities) }, { OptionSettingTypeHint.DockerExecutionDirectory, new DockerExecutionDirectoryCommand(consoleUtilities, directoryManager) }, { OptionSettingTypeHint.DockerBuildArgs, new DockerBuildArgsCommand(consoleUtilities) }, { OptionSettingTypeHint.ECSCluster, new ECSClusterCommand(awsResourceQueryer, consoleUtilities) }, + { OptionSettingTypeHint.ExistingECSCluster, new ECSClusterCommand(awsResourceQueryer, consoleUtilities) }, { OptionSettingTypeHint.ExistingApplicationLoadBalancer, new ExistingApplicationLoadBalancerCommand(awsResourceQueryer, consoleUtilities) }, { OptionSettingTypeHint.DynamoDBTableName, new DynamoDBTableCommand(awsResourceQueryer, consoleUtilities) }, { OptionSettingTypeHint.SQSQueueUrl, new SQSQueueUrlCommand(awsResourceQueryer, consoleUtilities) }, { OptionSettingTypeHint.SNSTopicArn, new SNSTopicArnsCommand(awsResourceQueryer, consoleUtilities) }, { OptionSettingTypeHint.S3BucketName, new S3BucketNameCommand(awsResourceQueryer, consoleUtilities) }, + { OptionSettingTypeHint.InstanceType, new InstanceTypeCommand(awsResourceQueryer, consoleUtilities) }, }; } diff --git a/src/AWS.Deploy.Common/Recipes/OptionSettingTypeHint.cs b/src/AWS.Deploy.Common/Recipes/OptionSettingTypeHint.cs index 95c60759b..cc7d20aef 100644 --- a/src/AWS.Deploy.Common/Recipes/OptionSettingTypeHint.cs +++ b/src/AWS.Deploy.Common/Recipes/OptionSettingTypeHint.cs @@ -26,6 +26,10 @@ public enum OptionSettingTypeHint SQSQueueUrl, SNSTopicArn, S3BucketName, - BeanstalkRollingUpdates + BeanstalkRollingUpdates, + ExistingIAMRole, + ExistingECSCluster, + ExistingVpc, + ExistingBeanstalkApplication }; } diff --git a/src/AWS.Deploy.Common/TypeHintData/DynamoDBTableTypeHintData.cs b/src/AWS.Deploy.Common/TypeHintData/DynamoDBTableTypeHintData.cs new file mode 100644 index 000000000..af4cd1908 --- /dev/null +++ b/src/AWS.Deploy.Common/TypeHintData/DynamoDBTableTypeHintData.cs @@ -0,0 +1,23 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\r +// SPDX-License-Identifier: Apache-2.0 + +using AWS.Deploy.Common.Recipes; + +namespace AWS.Deploy.Common.TypeHintData +{ + /// + /// Holds additional data for processing. + /// + public class DynamoDBTableTypeHintData + { + /// + /// Determines whether to allow no value or not. + /// + public bool AllowNoValue { get; set; } + + public DynamoDBTableTypeHintData(bool allowNoValue) + { + AllowNoValue = allowNoValue; + } + } +} diff --git a/src/AWS.Deploy.Common/TypeHintData/S3BucketNameTypeHintData.cs b/src/AWS.Deploy.Common/TypeHintData/S3BucketNameTypeHintData.cs new file mode 100644 index 000000000..807b5e0e6 --- /dev/null +++ b/src/AWS.Deploy.Common/TypeHintData/S3BucketNameTypeHintData.cs @@ -0,0 +1,23 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\r +// SPDX-License-Identifier: Apache-2.0 + +using AWS.Deploy.Common.Recipes; + +namespace AWS.Deploy.Common.TypeHintData +{ + /// + /// Holds additional data for processing. + /// + public class S3BucketNameTypeHintData + { + /// + /// Determines whether to allow no value or not. + /// + public bool AllowNoValue { get; set; } + + public S3BucketNameTypeHintData(bool allowNoValue) + { + AllowNoValue = allowNoValue; + } + } +} diff --git a/src/AWS.Deploy.Common/TypeHintData/SNSTopicArnsTypeHintData.cs b/src/AWS.Deploy.Common/TypeHintData/SNSTopicArnsTypeHintData.cs new file mode 100644 index 000000000..14eda19d1 --- /dev/null +++ b/src/AWS.Deploy.Common/TypeHintData/SNSTopicArnsTypeHintData.cs @@ -0,0 +1,23 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\r +// SPDX-License-Identifier: Apache-2.0 + +using AWS.Deploy.Common.Recipes; + +namespace AWS.Deploy.Common.TypeHintData +{ + /// + /// Holds additional data for processing. + /// + public class SNSTopicArnsTypeHintData + { + /// + /// Determines whether to allow no value or not. + /// + public bool AllowNoValue { get; set; } + + public SNSTopicArnsTypeHintData(bool allowNoValue) + { + AllowNoValue = allowNoValue; + } + } +} diff --git a/src/AWS.Deploy.Common/TypeHintData/SQSQueueUrlTypeHintData.cs b/src/AWS.Deploy.Common/TypeHintData/SQSQueueUrlTypeHintData.cs new file mode 100644 index 000000000..7cc7652e1 --- /dev/null +++ b/src/AWS.Deploy.Common/TypeHintData/SQSQueueUrlTypeHintData.cs @@ -0,0 +1,23 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\r +// SPDX-License-Identifier: Apache-2.0 + +using AWS.Deploy.Common.Recipes; + +namespace AWS.Deploy.Common.TypeHintData +{ + /// + /// Holds additional data for processing. + /// + public class SQSQueueUrlTypeHintData + { + /// + /// Determines whether to allow no value or not. + /// + public bool AllowNoValue { get; set; } + + public SQSQueueUrlTypeHintData(bool allowNoValue) + { + AllowNoValue = allowNoValue; + } + } +} diff --git a/src/AWS.Deploy.Orchestration/Data/AWSResourceQueryer.cs b/src/AWS.Deploy.Orchestration/Data/AWSResourceQueryer.cs index df5f30ab4..cd5017bd7 100644 --- a/src/AWS.Deploy.Orchestration/Data/AWSResourceQueryer.cs +++ b/src/AWS.Deploy.Orchestration/Data/AWSResourceQueryer.cs @@ -39,6 +39,7 @@ namespace AWS.Deploy.Orchestration.Data { public interface IAWSResourceQueryer { + Task> ListOfAvailableInstanceTypes(); Task DescribeAppRunnerService(string serviceArn); Task> DescribeCloudFormationResources(string stackName); Task DescribeElasticBeanstalkEnvironment(string environmentId); @@ -78,6 +79,20 @@ public AWSResourceQueryer(IAWSClientFactory awsClientFactory) _awsClientFactory = awsClientFactory; } + public async Task> ListOfAvailableInstanceTypes() + { + var ec2Client = _awsClientFactory.GetAWSClient(); + var instanceTypes = new List(); + var listInstanceTypesPaginator = ec2Client.Paginators.DescribeInstanceTypes(new DescribeInstanceTypesRequest()); + + await foreach (var response in listInstanceTypesPaginator.Responses) + { + instanceTypes.AddRange(response.InstanceTypes); + } + + return instanceTypes; + } + public async Task DescribeAppRunnerService(string serviceArn) { var appRunnerClient = _awsClientFactory.GetAWSClient(); diff --git a/src/AWS.Deploy.Recipes/RecipeDefinitions/ASP.NETAppAppRunner.recipe b/src/AWS.Deploy.Recipes/RecipeDefinitions/ASP.NETAppAppRunner.recipe index ea6c09692..e76f38c36 100644 --- a/src/AWS.Deploy.Recipes/RecipeDefinitions/ASP.NETAppAppRunner.recipe +++ b/src/AWS.Deploy.Recipes/RecipeDefinitions/ASP.NETAppAppRunner.recipe @@ -108,6 +108,10 @@ "Name": "Existing Role ARN", "Description": "The ARN of the existing role to use.", "Type": "String", + "TypeHint": "ExistingIAMRole", + "TypeHintData": { + "ServicePrincipal": "tasks.apprunner.amazonaws.com" + }, "AdvancedSetting": false, "Updatable": true, "DependsOn": [ @@ -145,6 +149,10 @@ "Name": "Existing Role ARN", "Description": "The ARN of the existing role to use.", "Type": "String", + "TypeHint": "ExistingIAMRole", + "TypeHintData": { + "ServicePrincipal": "build.apprunner.amazonaws.com" + }, "AdvancedSetting": false, "Updatable": true, "DependsOn": [ diff --git a/src/AWS.Deploy.Recipes/RecipeDefinitions/ASP.NETAppECSFargate.recipe b/src/AWS.Deploy.Recipes/RecipeDefinitions/ASP.NETAppECSFargate.recipe index e26be9b28..b835bab1e 100644 --- a/src/AWS.Deploy.Recipes/RecipeDefinitions/ASP.NETAppECSFargate.recipe +++ b/src/AWS.Deploy.Recipes/RecipeDefinitions/ASP.NETAppECSFargate.recipe @@ -92,6 +92,7 @@ "Name": "Existing Cluster ARN", "Description": "The ARN of the existing cluster to use.", "Type": "String", + "TypeHint": "ExistingECSCluster", "AdvancedSetting": false, "Updatable": false, "Validators": [ @@ -202,6 +203,10 @@ "Name": "Existing Role ARN", "Description": "The ARN of the existing role to use.", "Type": "String", + "TypeHint": "ExistingIAMRole", + "TypeHintData": { + "ServicePrincipal": "ecs-tasks.amazonaws.com" + }, "AdvancedSetting": false, "Updatable": true, "Validators": [ @@ -261,6 +266,7 @@ "Name": "Existing VPC ID", "Description": "The ID of the existing VPC to use.", "Type": "String", + "TypeHint": "ExistingVpc", "DefaultValue": null, "AdvancedSetting": false, "Updatable": false, diff --git a/src/AWS.Deploy.Recipes/RecipeDefinitions/ASP.NETAppElasticBeanstalk.recipe b/src/AWS.Deploy.Recipes/RecipeDefinitions/ASP.NETAppElasticBeanstalk.recipe index 1431791a5..b926cab41 100644 --- a/src/AWS.Deploy.Recipes/RecipeDefinitions/ASP.NETAppElasticBeanstalk.recipe +++ b/src/AWS.Deploy.Recipes/RecipeDefinitions/ASP.NETAppElasticBeanstalk.recipe @@ -98,6 +98,7 @@ "Name": "Application Name", "Description": "The Elastic Beanstalk application name.", "Type": "String", + "TypeHint": "ExistingBeanstalkApplication", "DefaultValue": "{StackName}", "AdvancedSetting": false, "Updatable": false, @@ -139,7 +140,6 @@ "Description": "The EC2 instance type of the EC2 instances created for the environment.", "Type": "String", "TypeHint": "InstanceType", - "DefaultValue": "", "AdvancedSetting": true, "Updatable": true }, @@ -211,6 +211,10 @@ "Name": "Existing Role ARN", "Description": "The ARN of the existing role to use.", "Type": "String", + "TypeHint": "ExistingIAMRole", + "TypeHintData": { + "ServicePrincipal": "elasticbeanstalk.amazonaws.com" + }, "AdvancedSetting": false, "Updatable": false, "DependsOn": [ diff --git a/src/AWS.Deploy.Recipes/RecipeDefinitions/BlazorWasm.recipe b/src/AWS.Deploy.Recipes/RecipeDefinitions/BlazorWasm.recipe index 9425baca2..2f38583ca 100644 --- a/src/AWS.Deploy.Recipes/RecipeDefinitions/BlazorWasm.recipe +++ b/src/AWS.Deploy.Recipes/RecipeDefinitions/BlazorWasm.recipe @@ -222,6 +222,10 @@ "Name": "Logging Bucket", "Description": "S3 bucket to use for storing access logs", "Type": "String", + "TypeHint": "S3BucketName", + "TypeHintData": { + "AllowNoValue": true + }, "DefaultValue": true, "AdvancedSetting": true, "Updatable": true, diff --git a/src/AWS.Deploy.Recipes/RecipeDefinitions/ConsoleAppECSFargateScheduleTask.recipe b/src/AWS.Deploy.Recipes/RecipeDefinitions/ConsoleAppECSFargateScheduleTask.recipe index 4975447cf..a1b027d12 100644 --- a/src/AWS.Deploy.Recipes/RecipeDefinitions/ConsoleAppECSFargateScheduleTask.recipe +++ b/src/AWS.Deploy.Recipes/RecipeDefinitions/ConsoleAppECSFargateScheduleTask.recipe @@ -119,6 +119,7 @@ "Name": "Existing Cluster ARN", "Description": "The ARN of the existing cluster to use.", "Type": "String", + "TypeHint": "ExistingECSCluster", "AdvancedSetting": false, "Updatable": false, "Validators": [ @@ -191,6 +192,10 @@ "Name": "Existing Role ARN", "Description": "The ARN of the existing role to use.", "Type": "String", + "TypeHint": "ExistingIAMRole", + "TypeHintData": { + "ServicePrincipal": "ecs-tasks.amazonaws.com" + }, "AdvancedSetting": false, "Updatable": true, "Validators": [ @@ -260,6 +265,7 @@ "Name": "Existing VPC ID", "Description": "The ID of the existing VPC to use.", "Type": "String", + "TypeHint": "ExistingVpc", "DefaultValue": null, "AdvancedSetting": false, "Updatable": false, diff --git a/src/AWS.Deploy.Recipes/RecipeDefinitions/ConsoleAppECSFargateService.recipe b/src/AWS.Deploy.Recipes/RecipeDefinitions/ConsoleAppECSFargateService.recipe index 1a94d8d39..38e01dfda 100644 --- a/src/AWS.Deploy.Recipes/RecipeDefinitions/ConsoleAppECSFargateService.recipe +++ b/src/AWS.Deploy.Recipes/RecipeDefinitions/ConsoleAppECSFargateService.recipe @@ -119,6 +119,7 @@ "Name": "Existing Cluster ARN", "Description": "The ARN of the existing cluster to use.", "Type": "String", + "TypeHint": "ExistingECSCluster", "AdvancedSetting": false, "Updatable": false, "Validators": [ @@ -229,6 +230,10 @@ "Name": "Existing Role ARN", "Description": "The ARN of the existing role to use.", "Type": "String", + "TypeHint": "ExistingIAMRole", + "TypeHintData": { + "ServicePrincipal": "ecs-tasks.amazonaws.com" + }, "AdvancedSetting": false, "Updatable": true, "Validators": [ @@ -288,6 +293,7 @@ "Name": "Existing VPC ID", "Description": "The ID of the existing VPC to use.", "Type": "String", + "TypeHint": "ExistingVpc", "DefaultValue": null, "AdvancedSetting": false, "Updatable": false, diff --git a/test/AWS.Deploy.CLI.IntegrationTests/Utilities/TestToolAWSResourceQueryer.cs b/test/AWS.Deploy.CLI.IntegrationTests/Utilities/TestToolAWSResourceQueryer.cs index 20ebe5099..2aca9720d 100644 --- a/test/AWS.Deploy.CLI.IntegrationTests/Utilities/TestToolAWSResourceQueryer.cs +++ b/test/AWS.Deploy.CLI.IntegrationTests/Utilities/TestToolAWSResourceQueryer.cs @@ -53,5 +53,6 @@ public Task GetLatestElasticBeanstalkPlatformArn() public Task> ListOfSQSQueuesUrls() => throw new NotImplementedException(); public Task> ListOfSNSTopicArns() => throw new NotImplementedException(); public Task> ListOfS3Buckets() => throw new NotImplementedException(); + public Task> ListOfAvailableInstanceTypes() => throw new NotImplementedException(); } } diff --git a/test/AWS.Deploy.CLI.UnitTests/Utilities/TestToolAWSResourceQueryer.cs b/test/AWS.Deploy.CLI.UnitTests/Utilities/TestToolAWSResourceQueryer.cs index a5c53781f..9401b8511 100644 --- a/test/AWS.Deploy.CLI.UnitTests/Utilities/TestToolAWSResourceQueryer.cs +++ b/test/AWS.Deploy.CLI.UnitTests/Utilities/TestToolAWSResourceQueryer.cs @@ -78,5 +78,6 @@ public Task GetLatestElasticBeanstalkPlatformArn() public Task> ListOfSQSQueuesUrls() => throw new NotImplementedException(); public Task> ListOfSNSTopicArns() => throw new NotImplementedException(); public Task> ListOfS3Buckets() => throw new NotImplementedException(); + public Task> ListOfAvailableInstanceTypes() => throw new NotImplementedException(); } }