module Cabal::API::Common::PrivateKey
Public Class Methods
included(base)
click to toggle source
# File lib/cabal/api/common/private_key.rb, line 12 def self.included(base) base.class_eval do include Cabal::API::Common::Authenticated include Cabal::API::Common::Mistakes include Cabal::API::Common::Services 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]) key = cluster_service.private_key(cluster_name) error_if_not_found!(key, cluster_name) { name: cluster_name, private_ssh_key: key } end end end
Public Instance Methods
error_if_not_found!(cluster, name)
click to toggle source
# File lib/cabal/api/common/private_key.rb, line 23 def error_if_not_found!(cluster, name) unless cluster error!( messagify("The cluster '#{name}' could not be found."), 404 ) end end