Sha256: 8433c3d0b623b634a8a120513e90645707270b25fd6d81de07c3baa0098e081e

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents


module Rudy; module CLI; 
module AWS; module EC2;
  
  class EC2::Keypairs < Rudy::CLI::CommandBase
    
    def create_keypairs_valid?
      raise Drydock::ArgError.new('name', @alias) unless @argv.name
      true
    end
    def create_keypairs
      kp = execute_action { Rudy::AWS::EC2::Keypairs.create(@argv.name) }
      if [:s, :string].member?(@@global.format)
        li "Name: #{kp.name}"
        li "Fingerprint: #{kp.fingerprint}", $/
        li "Copy the following private key data into a file."
        li "Set the permissions to 0600 and keep it safe.", $/
        li kp.private_key
      else
         print_stobject kp
      end
    end
    
    def destroy_keypairs_valid?
      raise Drydock::ArgError.new('name', @alias) unless @argv.name
      true
    end
    def destroy_keypairs
      raise "Keypair #{@argv.name} does not exist" unless Rudy::AWS::EC2::Keypairs.exists?(@argv.name)
      kp = Rudy::AWS::EC2::Keypairs.get(@argv.name)
      li "Destroying: #{kp.name}"
      execute_check(:medium)
      execute_action { Rudy::AWS::EC2::Keypairs.destroy(kp.name) }
    end
    
    def keypairs
      klist = Rudy::AWS::EC2::Keypairs.list
      print_stobjects klist
    end
    
    
  end


end; end
end; end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
solutious-rudy-0.9.4 lib/rudy/cli/aws/ec2/keypairs.rb
rudy-0.9.5.004 lib/rudy/cli/aws/ec2/keypairs.rb
rudy-0.9.5.003 lib/rudy/cli/aws/ec2/keypairs.rb
rudy-0.9.5.002 lib/rudy/cli/aws/ec2/keypairs.rb
rudy-0.9.5 lib/rudy/cli/aws/ec2/keypairs.rb
rudy-0.9.4 lib/rudy/cli/aws/ec2/keypairs.rb