Class: ZAWS::External::AWSCLI::Commands::EC2::DescribeInstances
- Inherits:
-
Object
- Object
- ZAWS::External::AWSCLI::Commands::EC2::DescribeInstances
- Defined in:
- lib/zaws/external/awscli/commands/ec2/describe_instances.rb
Instance Method Summary collapse
- #aws ⇒ Object
- #clear_settings ⇒ Object
- #execute(region, view, filters = {}, textout = nil, verbose = nil, profile = nil) ⇒ Object
- #filter ⇒ Object
- #get_command ⇒ Object
-
#initialize(shellout = nil, awscli = nil) ⇒ DescribeInstances
constructor
A new instance of DescribeInstances.
Constructor Details
#initialize(shellout = nil, awscli = nil) ⇒ DescribeInstances
Returns a new instance of DescribeInstances.
8 9 10 11 12 13 |
# 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 |
Instance Method Details
#aws ⇒ Object
15 16 17 18 |
# 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 ⇒ Object
25 26 27 28 |
# 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) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# 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 ⇒ Object
20 21 22 23 |
# 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 ⇒ Object
30 31 32 33 34 |
# 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 |