-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add ability to select a supported architecture
- Loading branch information
Showing
29 changed files
with
234 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
src/AWS.Deploy.CLI/Commands/TypeHints/EnvironmentArchitectureCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\r | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using AWS.Deploy.Common; | ||
using AWS.Deploy.Common.Recipes; | ||
using AWS.Deploy.Common.TypeHintData; | ||
|
||
namespace AWS.Deploy.CLI.Commands.TypeHints | ||
{ | ||
public class EnvironmentArchitectureCommand : ITypeHintCommand | ||
{ | ||
private readonly IConsoleUtilities _consoleUtilities; | ||
private readonly IOptionSettingHandler _optionSettingHandler; | ||
|
||
public EnvironmentArchitectureCommand(IConsoleUtilities consoleUtilities, IOptionSettingHandler optionSettingHandler) | ||
{ | ||
_consoleUtilities = consoleUtilities; | ||
_optionSettingHandler = optionSettingHandler; | ||
} | ||
|
||
public Task<TypeHintResourceTable> GetResources(Recommendation recommendation, OptionSettingItem optionSetting) | ||
{ | ||
var resourceTable = new TypeHintResourceTable | ||
{ | ||
Columns = new List<TypeHintResourceColumn>() | ||
{ | ||
new TypeHintResourceColumn("Architecture") | ||
} | ||
}; | ||
|
||
foreach (var value in recommendation.Recipe.SupportedArchitectures ?? new List<SupportedArchitecture> { SupportedArchitecture.X86_64 }) | ||
{ | ||
var stringValue = value.ToString(); | ||
var row = new TypeHintResource(stringValue, stringValue); | ||
row.ColumnValues.Add(stringValue); | ||
|
||
resourceTable.Rows.Add(row); | ||
} | ||
|
||
return Task.FromResult(resourceTable); | ||
} | ||
|
||
public async Task<object> Execute(Recommendation recommendation, OptionSettingItem optionSetting) | ||
{ | ||
var currentValue = _optionSettingHandler.GetOptionSettingValue(recommendation, optionSetting); | ||
var resourceTable = await GetResources(recommendation, optionSetting); | ||
|
||
var userInputConfiguration = new UserInputConfiguration<TypeHintResource>( | ||
idSelector: platform => platform.SystemName, | ||
displaySelector: platform => platform.DisplayName, | ||
defaultSelector: platform => platform.SystemName.Equals(currentValue)) | ||
{ | ||
CreateNew = false | ||
}; | ||
|
||
var userResponse = _consoleUtilities.AskUserToChooseOrCreateNew(resourceTable.Rows, "Select the Platform to use:", userInputConfiguration); | ||
|
||
var result = userResponse.SelectedOption?.SystemName!; | ||
recommendation.DeploymentBundle.EnvironmentArchitecture = Enum.Parse<SupportedArchitecture>(result); | ||
return result; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\r | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
namespace AWS.Deploy.Common.Recipes; | ||
|
||
public enum SupportedArchitecture | ||
{ | ||
X86_64, | ||
Arm64 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/AWS.Deploy.Recipes/DeploymentBundleDefinitions/Container.deploymentbundle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/AWS.Deploy.Recipes/DeploymentBundleDefinitions/DotnetPublishZipFile.deploymentbundle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.