Class: KeypairsController
Instance Method Summary
collapse
#dispatch, #get_locales, #is_dcmgr?, #set_application, #set_locale
Instance Method Details
#create_ssh_keypair ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'app/controllers/keypairs_controller.rb', line 28
def create_ssh_keypair
data = {
:download_once => params[:download_once]
}
@ssh_key_pair = DcmgrResource::SshKeyPair.create(data)
@filename = @ssh_key_pair.uuid + ".pem"
send_data(@ssh_key_pair.private_key,{
:filename => @filename,
:type => 'application/pgp-encrypted',
:status => 200
})
end
|
#destroy ⇒ Object
22
23
24
25
26
|
# File 'app/controllers/keypairs_controller.rb', line 22
def destroy
name = params[:id]
@ssh_key_pair = DcmgrResource::SshKeyPair.destroy(name)
render :json => @ssh_key_pair
end
|
#index ⇒ Object
4
5
|
# File 'app/controllers/keypairs_controller.rb', line 4
def index
end
|
#list ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'app/controllers/keypairs_controller.rb', line 7
def list
data = {
:start => params[:start].to_i - 1,
:limit => params[:limit]
}
@ssh_key_pair = DcmgrResource::SshKeyPair.list(data)
respond_with(@ssh_key_pair[0],:to => [:json])
end
|
#prk_download ⇒ Object
53
54
55
56
57
58
59
60
61
62
|
# File 'app/controllers/keypairs_controller.rb', line 53
def prk_download
uuid = params[:id]
@ssh_key_pair = DcmgrResource::SshKeyPair.show(uuid)
@filename = @ssh_key_pair['uuid'] + ".pem"
send_data(@ssh_key_pair['private_key'],{
:filename => @filename,
:type => 'application/pgp-encrypted',
:status => 200
})
end
|
#show ⇒ Object
16
17
18
19
20
|
# File 'app/controllers/keypairs_controller.rb', line 16
def show
uuid = params[:id]
@ssh_key_pair = DcmgrResource::SshKeyPair.show(uuid)
respond_with(@ssh_key_pair,:to => [:json])
end
|
#show_keypairs ⇒ Object
43
44
45
46
|
# File 'app/controllers/keypairs_controller.rb', line 43
def show_keypairs
@ssh_key_pair = DcmgrResource::SshKeyPair.list
respond_with(@ssh_key_pair[0],:to => [:json])
end
|