class Bim::Subcommands::Ssl

Ssl class defines subcommands

Public Instance Methods

bundles() click to toggle source
# File lib/bim/subcommands/ssl.rb, line 9
def bundles
  puts Bim::Action::SSL.bundles
end
create_ssl_profile(profilename, chain) click to toggle source
# File lib/bim/subcommands/ssl.rb, line 66
def create_ssl_profile(profilename, chain)
  puts Bim::Action::SSL.create_ssl_profile(profilename, chain)
end
deploy(old_ssl_profilename, new_ssl_profilename, key_file, crt_file, chain) click to toggle source
# File lib/bim/subcommands/ssl.rb, line 89
def deploy(old_ssl_profilename, new_ssl_profilename, key_file, crt_file, chain)
  if options[:test] && !ENV['TEST_VS']
    puts 'You have to set TEST_VS environment variable.'
    return
  end

  log('start deploy')
  log('start upload private key and certificate')
  upload(new_ssl_profilename, key_file, crt_file)
  log('finish upload private key and certificate')
  log('start create ssl profile')
  create_ssl_profile(new_ssl_profilename, chain)
  log('finish create ssl profile')
  log('start replace ssl profile')
  replace(old_ssl_profilename, new_ssl_profilename)
  log('finish replace ssl profile')
  log('finish deploy')
end
detail(profile_name) click to toggle source
# File lib/bim/subcommands/ssl.rb, line 25
def detail(profile_name)
  puts Bim::Action::SSL.detail(profile_name)
end
profiles() click to toggle source
# File lib/bim/subcommands/ssl.rb, line 17
def profiles
  puts Bim::Action::SSL.profiles
end
replace(old_ssl_profilename, new_ssl_profilename) click to toggle source
# File lib/bim/subcommands/ssl.rb, line 75
def replace(old_ssl_profilename, new_ssl_profilename)
  if options[:test] && !ENV['TEST_VS']
    puts 'You have to set TEST_VS environment variable.'
    return
  end

  puts Bim::Action::SSL.replace(old_ssl_profilename, new_ssl_profilename, options[:test])
end
upload(crt_name, key_file, crt_file) click to toggle source
# File lib/bim/subcommands/ssl.rb, line 51
def upload(crt_name, key_file, crt_file)
  result = []
  r = Bim::Action::SSL.upload(key_file)
  result.push Bim::Action::SSL.install(:key, crt_name, JSON.parse(r)['localFilePath'])

  r = Bim::Action::SSL.upload(crt_file)
  result.push Bim::Action::SSL.install(:crt, crt_name, JSON.parse(r)['localFilePath'])

  puts result.map { |res| JSON.parse(res) }.to_json
end
upload_crt(crt_name, crt_file) click to toggle source
# File lib/bim/subcommands/ssl.rb, line 42
def upload_crt(crt_name, crt_file)
  r = Bim::Action::SSL.upload(crt_file)
  puts Bim::Action::SSL.install(:crt, crt_name, JSON.parse(r)['localFilePath'])
end
upload_key(crt_name, key_file) click to toggle source
# File lib/bim/subcommands/ssl.rb, line 33
def upload_key(crt_name, key_file)
  r = Bim::Action::SSL.upload(key_file)
  puts Bim::Action::SSL.install(:key, crt_name, JSON.parse(r)['localFilePath'])
end

Private Instance Methods

log(msg, full_length = 50) click to toggle source
# File lib/bim/subcommands/ssl.rb, line 110
def log(msg, full_length = 50)
  l = (full_length - msg.length) / 2
  puts "#{'=' * l}#{msg}#{'=' * l}"
end