class Bosh::AwsCliPlugin::MicroboshManifest

Attributes

hm_director_password[R]
hm_director_user[R]
keep_unreachable_vms[R]
route53_receipt[R]
vpc_receipt[R]

Public Class Methods

new(vpc_receipt, route53_receipt, options={}) click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 8
def initialize(vpc_receipt, route53_receipt, options={})
  @vpc_receipt = vpc_receipt
  @route53_receipt = route53_receipt
  @hm_director_user = options[:hm_director_user]
  @hm_director_password = options[:hm_director_password]
  @keep_unreachable_vms = options.fetch(:keep_unreachable_vms, false)
end

Public Instance Methods

access_key_id() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 48
def access_key_id
  vpc_config['aws']['access_key_id'] || warning('Missing aws access_key_id field')
end
availability_zone() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 44
def availability_zone
  vpc_config['vpc']['subnets']['bosh1']['availability_zone'] || warning('Missing availability zone in vpc.subnets.bosh')
end
cache_access_key_id() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 72
def cache_access_key_id
  vpc_config['compiled_package_cache']['access_key_id'] || warning('Missing compiled_package_cache access_key_id field')
end
cache_bucket_name() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 80
def cache_bucket_name
  vpc_config['compiled_package_cache']['bucket_name'] || warning('Missing compiled_package_cache bucket_name field')
end
cache_secret_access_key() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 76
def cache_secret_access_key
  vpc_config['compiled_package_cache']['secret_access_key'] || warning('Missing compiled_package_cache secret_access_key field')
end
certificate() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 92
def certificate
  @cert if @cert
  key_path = director_ssl['private_key_path'] || 'director.key'
  cert_path = director_ssl['certificate_path'] || 'director.pem'
  @cert = Bosh::Ssl::Certificate.new(key_path, cert_path, "*.#{vpc_config['vpc']['domain']}").load_or_create
end
compiled_package_cache?() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 68
def compiled_package_cache?
  !!vpc_config['compiled_package_cache']
end
deployment_name() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 20
def deployment_name
  "micro"
end
director_ssl() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 99
def director_ssl
  ssl_certs['director_cert'] || {}
end
director_ssl_cert() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 88
def director_ssl_cert
  certificate.certificate.gsub("\n", "\n          ")
end
director_ssl_key() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 84
def director_ssl_key
  certificate.key.gsub("\n", "\n          ")
end
file_name() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 16
def file_name
  "micro_bosh.yml"
end
get_template(template) click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 117
def get_template(template)
  File.expand_path("../../../templates/#{template}", __FILE__)
end
key_pair_name() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 60
def key_pair_name
  vpc_config['key_pairs'].any? ? vpc_config['key_pairs'].keys[0] : warning("Missing key_pairs field, must have at least 1 keypair")
end
name() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 28
def name
  vpc_config['name'] || warning('Missing name field')
end
network_type() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 40
def network_type
  subnet ? 'manual' : 'dynamic'
end
private_key_path() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 64
def private_key_path
  vpc_config['key_pairs'].any? ? vpc_config['key_pairs'].values[0].gsub(/\.pub$/, '') : warning("Missing key_pairs field, must have at least 1 keypair")
end
region() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 56
def region
  vpc_config['aws']['region'] || warning('Missing aws region field')
end
secret_access_key() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 52
def secret_access_key
  vpc_config['aws']['secret_access_key'] || warning('Missing aws secret_access_key field')
end
ssl_certs() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 103
def ssl_certs
  vpc_config['ssl_certs'] || {}
end
subnet() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 36
def subnet
  vpc_receipt['vpc']['subnets']['bosh1'] || warning('Missing bosh subnet field')
end
to_y() click to toggle source

RSpec overloads to_yaml when you set up expectations on an object; so to_y is just a way to get directly at the to_yaml implementation without fighting RSpec.

# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 109
def to_y
  ERB.new(File.read(get_template("micro_bosh.yml.erb"))).result(binding)
end
to_yaml() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 113
def to_yaml
  to_y
end
vip() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 32
def vip
  route53_receipt['elastic_ips']['micro']['ips'][0] || warning('Missing vip field')
end
vpc_config() click to toggle source
# File lib/bosh_cli_plugin_aws/microbosh_manifest.rb, line 24
def vpc_config
  vpc_receipt['original_configuration']
end