Sha256: fdd5910acb515a142fbac2263b67cddb58e3bf518cd95dfecb60d90be078b09c

Contents?: true

Size: 1.88 KB

Versions: 28

Compression:

Stored size: 1.88 KB

Contents


module Rudy; module CLI
module AWS; module EC2;

  class Info < Rudy::CLI::CommandBase

    def info
      process_region @@global.region
      oregions = Rudy::AWS::VALID_REGIONS - [@@global.region.to_sym]
      if @option.all
        oregions.each do |region| 
          Rudy::AWS::EC2.connect @@global.accesskey, @@global.secretkey, region
          process_region region
        end
      else
        li $/, "Other regions: " << oregions.join(', ')
      end
    end
    
    
    private 
    def process_region(region)
      li " Region: %s %30s".att(:reverse) % [region, '']
      li "  Instances".bright
      istatus = @option.all ? :any : :running
      (Rudy::AWS::EC2::Instances.list(istatus) || []).collect do |inst| 
        #li "    %s (%s): %s; %s; %s" % [inst.awsid, inst.state, inst.dns_public || '[no dns]', inst.size, inst.created]
        li "    #{inst.to_s.noatt}"
      end
      
      li "  Volumes".bright
      (Rudy::AWS::EC2::Volumes.list || []).collect do |vol|
        li "    %s (%s): %sGB; %s" % [vol.awsid, vol.instid || vol.status, vol.size, vol.created]
      end
              
      li "  Snapshots".bright
      (Rudy::AWS::EC2::Snapshots.list || []).collect do |snap|
        li "    %s: %s; %s" % [snap.awsid, snap.volid, snap.created]
      end
      
      li "  Addresses".bright
      (Rudy::AWS::EC2::Addresses.list || []).collect do |o| 
        li "    %s (%s)" % [o.ipaddress, o.instid || 'available']
      end
      
      li "  Groups".bright
      li (Rudy::AWS::EC2::Groups.list || []).collect { |o| "    #{o.name}" }
      
      li "  Keypairs".bright
      li (Rudy::AWS::EC2::Keypairs.list || []).collect { |o| "    #{o.name}" }

      li "  Images".bright
      (Rudy::AWS::EC2::Images.list('self') || []).collect do |o|
        li "    %s: %s; %s; %s" % [o.awsid, o.location, o.arch, o.visibility]
      end
      li
    end
    
  end
  
end; end
end; end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
solutious-rudy-0.9.4 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.020 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.019 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.018 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.017 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.016 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.015 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.014 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.013 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.012 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.011 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.010 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.009 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.008 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.007 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.006 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.005 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.004 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.003 lib/rudy/cli/aws/ec2/info.rb
rudy-0.9.8.002 lib/rudy/cli/aws/ec2/info.rb