Sha256: 78d8d7531d47c400f8c1edaf1094f092706aaa9e53e3546b4f26425925f0182b
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
require 'cabal/util' require 'cabal/api/cluster' require 'cabal/api/user' require 'cabal/api/common/authenticated' require 'cabal/api/common/mistakes' module Cabal module API module Common module PrivateKey def self.included(base) base.class_eval do include Cabal::API::Common::Authenticated include Cabal::API::Common::Mistakes formatter :txt, ->(object, env) { object[:private_ssh_key] } helpers do def error_if_not_found!(cluster, name) unless cluster error!( messagify("The cluster '#{name}' could not be found."), 404 ) end end end get '/private-key/:name' do authenticate! cluster_name = Cabal::Util.normalize(params[:name]) cluster = Cabal::API::Cluster.find(name: cluster_name).first error_if_not_found!(cluster, cluster_name) { name: cluster.name, private_ssh_key: cluster.private_key } end end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cabal-api-0.2.2 | lib/cabal/api/common/private_key.rb |
cabal-api-0.2.1 | lib/cabal/api/common/private_key.rb |
cabal-api-0.2.0 | lib/cabal/api/common/private_key.rb |