Sha256: c477d84f8df865fe3d817514e39844105ca0e0dfb2f1f41f6aee68e28ac1bb49
Contents?: true
Size: 1.06 KB
Versions: 4
Compression:
Stored size: 1.06 KB
Contents
require 'grape' 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 V2 class PrivateKey < Grape::API 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
Version data entries
4 entries across 4 versions & 1 rubygems