Class: SshKeyPair
Instance Attribute Summary
#config
Instance Method Summary
collapse
exit_on_failure?
#ask_number, #bootstrap_server, #bootstrap_server_interactive, #get_async_job_status, #print_options, #watch_jobs
Instance Method Details
#create(name) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/cloudstack-cli/commands/ssh_key_pairs.rb', line 23
def create(name)
pair = client.create_ssh_key_pair(name, options)
say "Name : #{pair['name']}"
say "Fingerprint : #{pair['fingerprint']}"
say "Privatekey:"
say pair['privatekey']
end
|
#delete(name) ⇒ Object
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/cloudstack-cli/commands/ssh_key_pairs.rb', line 35
def delete(name)
if options[:force] || yes?("Delete ssh key pair #{name}?", :yellow)
if client.delete_ssh_key_pair(name, options)['success'] == "true"
say("OK", :green)
else
say("Failed", :red)
exit 1
end
end
end
|
#list ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/cloudstack-cli/commands/ssh_key_pairs.rb', line 7
def list
pairs = client.list_ssh_key_pairs(options)
if pairs.size < 1
say "No ssh key pairs found."
else
table = [["Name", "Fingerprint"]]
pairs.each do |pair|
table << [pair['name'], pair['fingerprint']]
end
print_table table
end
end
|