class ZAWS::External::AWSCLI::Commands::EC2::DescribeInstances
Public Class Methods
new(shellout=nil, awscli=nil)
click to toggle source
# File lib/zaws/external/awscli/commands/ec2/describe_instances.rb, line 8 def initialize(shellout=nil, awscli=nil) #super(shellout, awscli) @shellout=shellout @awscli=awscli clear_settings end
Public Instance Methods
aws()
click to toggle source
# File lib/zaws/external/awscli/commands/ec2/describe_instances.rb, line 15 def aws @aws ||= ZAWS::External::AWSCLI::Commands::AWS.new(self) @aws end
clear_settings()
click to toggle source
# File lib/zaws/external/awscli/commands/ec2/describe_instances.rb, line 25 def clear_settings @aws=nil @filter=nil end
execute(region, view, filters={}, textout=nil, verbose=nil, profile=nil)
click to toggle source
# File lib/zaws/external/awscli/commands/ec2/describe_instances.rb, line 36 def execute(region, view, filters={}, textout=nil, verbose=nil, profile=nil) comline = "aws" comline = comline + " --output #{view}" comline = comline + " --region #{region} ec2 describe-instances" comline = comline + " --profile #{profile}" if profile comline = comline + " --filter" if filters.length > 0 filters.each do |key, item| comline = comline + " \"Name=#{key},Values=#{item}\"" end unless @awscli.data_ec2.instance.load_cached(comline, verbose) @awscli.data_ec2.instance.load(comline, @shellout.cli(comline, verbose), verbose) end end
filter()
click to toggle source
# File lib/zaws/external/awscli/commands/ec2/describe_instances.rb, line 20 def filter @filter ||= ZAWS::External::AWSCLI::Commands::EC2::Filter.new() @filter end
get_command()
click to toggle source
# File lib/zaws/external/awscli/commands/ec2/describe_instances.rb, line 30 def get_command command = "ec2 describe-instances" command = "#{command} #{@filter.get_command}" if @filter return command end