class Awful::Keypair
Public Instance Methods
create(name)
click to toggle source
# File lib/awful/keypair.rb, line 23 def create(name) ec2.create_key_pair(key_name: name.to_s).output do |k| puts k.key_material end end
delete(name)
click to toggle source
# File lib/awful/keypair.rb, line 37 def delete(name) if yes?("Really delete key pair #{name}?", :yellow) ec2.delete_key_pair(key_name: name) end end
import(name)
click to toggle source
# File lib/awful/keypair.rb, line 31 def import(name) key = file_or_stdin(options[:file]) ec2.import_key_pair(key_name: name, public_key_material: key) end
ls(*names)
click to toggle source
# File lib/awful/keypair.rb, line 11 def ls(*names) names = nil if names.empty? ec2.describe_key_pairs(key_names: names).key_pairs.output do |kp| if options[:long] print_table kp.map{ |k| [k.key_name, k.key_fingerprint] } else puts kp.map(&:key_name) end end end