Class: Rudy::CLI::AWS::EC2::KeyPairs
Instance Attribute Summary
Attributes inherited from CommandBase
#config
Instance Method Summary
collapse
Methods included from Huxtable
change_environment, change_position, change_region, change_role, change_zone, #check_keys, #config_dirname, create_domain, #current_group_name, #current_machine_address, #current_machine_count, #current_machine_group, #current_machine_hostname, #current_machine_image, #current_machine_name, #current_machine_size, #current_user, #current_user_keypairpath, debug?, #debug?, domain, domain_exists?, #group_metadata, #has_keypair?, #has_keys?, #has_pem_keys?, #has_root_keypair?, keypair_path_to_name, #known_machine_group?, #root_keypairname, #root_keypairpath, #switch_user, update_config, update_global, update_logger, #user_keypairname, #user_keypairpath
Instance Method Details
#create_keypairs ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/rudy/cli/aws/ec2/keypairs.rb', line 12
def create_keypairs
rkey = Rudy::AWS::EC2::KeyPairs.new(@@global.accesskey, @@global.secretkey, @@global.region)
kp = execute_action { rkey.create(@argv.name) }
if [:s, :string].member?(@@global.format)
puts "Name: #{kp.name}"
puts "Fingerprint: #{kp.fingerprint}", $/
puts "Copy the following private key data into a file."
puts "Set the permissions to 0600 and keep it safe.", $/
puts kp.private_key
else
puts @@global.verbose > 0 ? kp.inspect : kp.dump(@@global.format)
end
end
|
#create_keypairs_valid? ⇒ Boolean
8
9
10
11
|
# File 'lib/rudy/cli/aws/ec2/keypairs.rb', line 8
def create_keypairs_valid?
raise Drydock::ArgError.new('name', @alias) unless @argv.name
true
end
|
#destroy_keypairs ⇒ Object
30
31
32
33
34
35
36
37
38
|
# File 'lib/rudy/cli/aws/ec2/keypairs.rb', line 30
def destroy_keypairs
rkey = Rudy::AWS::EC2::KeyPairs.new(@@global.accesskey, @@global.secretkey, @@global.region)
raise "KeyPair #{@argv.name} does not exist" unless rkey.exists?(@argv.name)
kp = rkey.get(@argv.name)
puts "Destroying: #{kp.name}"
execute_check(:medium)
execute_action { rkey.destroy(kp.name) }
keypairs
end
|
#destroy_keypairs_valid? ⇒ Boolean
26
27
28
29
|
# File 'lib/rudy/cli/aws/ec2/keypairs.rb', line 26
def destroy_keypairs_valid?
raise Drydock::ArgError.new('name', @alias) unless @argv.name
true
end
|
#keypairs ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/rudy/cli/aws/ec2/keypairs.rb', line 40
def keypairs
rkey = Rudy::AWS::EC2::KeyPairs.new(@@global.accesskey, @@global.secretkey, @@global.region)
(rkey.list || []).each do |kp|
puts @@global.verbose > 0 ? kp.inspect : kp.dump(@@global.format)
end
puts "No keypairs" unless rkey.any?
end
|