Sha256: 3bfe98ddb8947fe0e2472ccb70188d4458f8150f8c27dbf8f2c8c97fb4f3f3a0
Contents?: true
Size: 1.59 KB
Versions: 3
Compression:
Stored size: 1.59 KB
Contents
class KeypairsController < ApplicationController respond_to :json,:except => [:create,:prk_download] def index end 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 def show uuid = params[:id] @ssh_key_pair = DcmgrResource::SshKeyPair.show(uuid) respond_with(@ssh_key_pair,:to => [:json]) end def destroy name = params[:id] @ssh_key_pair = DcmgrResource::SshKeyPair.destroy(name) render :json => @ssh_key_pair end def create_ssh_keypair data = { :name => params[:name], :download_once => params[:download_once] } @filename = params[:name] + ".pem" @ssh_key_pair = DcmgrResource::SshKeyPair.create(data) send_data(@ssh_key_pair.private_key,{ :filename => @filename, :type => 'application/pgp-encrypted', :status => 200 }) end def show_keypairs @ssh_key_pair = DcmgrResource::SshKeyPair.list respond_with(@ssh_key_pair[0],:to => [:json]) end def total total_resource = DcmgrResource::SshKeyPair.total_resource render :json => total_resource end def prk_download uuid = params[:id] @ssh_key_pair = DcmgrResource::SshKeyPair.show(uuid) @filename = @ssh_key_pair['name'] + ".pem" send_data(@ssh_key_pair['private_key'],{ :filename => @filename, :type => 'application/pgp-encrypted', :status => 200 }) end end
Version data entries
3 entries across 3 versions & 1 rubygems