À utiliser ListAvailableSolutionStacks avec un AWS SDK ou CLI - Exemples de code de l'AWS SDK

D'autres AWS SDK exemples sont disponibles dans le GitHub dépôt AWS Doc SDK Examples.

Les traductions sont fournies par des outils de traduction automatique. En cas de conflit entre le contenu d'une traduction et celui de la version originale en anglais, la version anglaise prévaudra.

À utiliser ListAvailableSolutionStacks avec un AWS SDK ou CLI

Les exemples de code suivants montrent comment utiliserListAvailableSolutionStacks.

CLI
AWS CLI

Pour afficher les piles de solutions

La commande suivante répertorie les piles de solutions pour toutes les configurations de plate-forme actuellement disponibles et celles que vous avez utilisées dans le passé :

aws elasticbeanstalk list-available-solution-stacks

Sortie (abrégée) :

{ "SolutionStacks": [ "64bit Amazon Linux 2015.03 v2.0.0 running Node.js", "64bit Amazon Linux 2015.03 v2.0.0 running PHP 5.6", "64bit Amazon Linux 2015.03 v2.0.0 running PHP 5.5", "64bit Amazon Linux 2015.03 v2.0.0 running PHP 5.4", "64bit Amazon Linux 2015.03 v2.0.0 running Python 3.4", "64bit Amazon Linux 2015.03 v2.0.0 running Python 2.7", "64bit Amazon Linux 2015.03 v2.0.0 running Python", "64bit Amazon Linux 2015.03 v2.0.0 running Ruby 2.2 (Puma)", "64bit Amazon Linux 2015.03 v2.0.0 running Ruby 2.2 (Passenger Standalone)", "64bit Amazon Linux 2015.03 v2.0.0 running Ruby 2.1 (Puma)", "64bit Amazon Linux 2015.03 v2.0.0 running Ruby 2.1 (Passenger Standalone)", "64bit Amazon Linux 2015.03 v2.0.0 running Ruby 2.0 (Puma)", "64bit Amazon Linux 2015.03 v2.0.0 running Ruby 2.0 (Passenger Standalone)", "64bit Amazon Linux 2015.03 v2.0.0 running Ruby 1.9.3", "64bit Amazon Linux 2015.03 v2.0.0 running Tomcat 8 Java 8", "64bit Amazon Linux 2015.03 v2.0.0 running Tomcat 7 Java 7", "64bit Amazon Linux 2015.03 v2.0.0 running Tomcat 7 Java 6", "64bit Windows Server Core 2012 R2 running IIS 8.5", "64bit Windows Server 2012 R2 running IIS 8.5", "64bit Windows Server 2012 running IIS 8", "64bit Windows Server 2008 R2 running IIS 7.5", "64bit Amazon Linux 2015.03 v2.0.0 running Docker 1.6.2", "64bit Amazon Linux 2015.03 v2.0.0 running Multi-container Docker 1.6.2 (Generic)", "64bit Debian jessie v2.0.0 running GlassFish 4.1 Java 8 (Preconfigured - Docker)", "64bit Debian jessie v2.0.0 running GlassFish 4.0 Java 7 (Preconfigured - Docker)", "64bit Debian jessie v2.0.0 running Go 1.4 (Preconfigured - Docker)", "64bit Debian jessie v2.0.0 running Go 1.3 (Preconfigured - Docker)", "64bit Debian jessie v2.0.0 running Python 3.4 (Preconfigured - Docker)", ], "SolutionStackDetails": [ { "PermittedFileTypes": [ "zip" ], "SolutionStackName": "64bit Amazon Linux 2015.03 v2.0.0 running Node.js" }, ... ] }
Ruby
SDKpour Ruby
Note

Il y en a plus à ce sujet GitHub. Trouvez l'exemple complet et découvrez comment le configurer et l'exécuter dans le référentiel d'exemples de code AWS.

# Manages listing of AWS Elastic Beanstalk solution stacks # @param [Aws::ElasticBeanstalk::Client] eb_client # @param [String] filter - Returns subset of results based on match # @param [Logger] logger class StackLister # Initialize with AWS Elastic Beanstalk client def initialize(eb_client, filter, logger: Logger.new($stdout)) @eb_client = eb_client @filter = filter.downcase @logger = logger end # Lists and logs Elastic Beanstalk solution stacks def list_stacks stacks = @eb_client.list_available_solution_stacks.solution_stacks orig_length = stacks.length filtered_length = 0 stacks.each do |stack| if @filter.empty? || stack.downcase.include?(@filter) @logger.info(stack) filtered_length += 1 end end log_summary(filtered_length, orig_length) rescue Aws::Errors::ServiceError => e @logger.error("Error listing solution stacks: #{e.message}") end private # Logs summary of listed stacks def log_summary(filtered_length, orig_length) if @filter.empty? @logger.info("Showed #{orig_length} stack(s)") else @logger.info("Showed #{filtered_length} stack(s) of #{orig_length}") end end end