Class: Bosh::Aws::MicroboshManifest
- Inherits:
-
Object
- Object
- Bosh::Aws::MicroboshManifest
show all
- Defined in:
- lib/bosh_cli_plugin_aws/microbosh_manifest.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(vpc_receipt, route53_receipt, options = {}) ⇒ MicroboshManifest
Returns a new instance of MicroboshManifest.
8
9
10
11
12
13
|
# 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]
end
|
Instance Attribute Details
#hm_director_password ⇒ Object
Returns the value of attribute hm_director_password.
6
7
8
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 6
def hm_director_password
@hm_director_password
end
|
#hm_director_user ⇒ Object
Returns the value of attribute hm_director_user.
6
7
8
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 6
def hm_director_user
@hm_director_user
end
|
#route53_receipt ⇒ Object
Returns the value of attribute route53_receipt.
6
7
8
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 6
def route53_receipt
@route53_receipt
end
|
#vpc_receipt ⇒ Object
Returns the value of attribute vpc_receipt.
6
7
8
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 6
def vpc_receipt
@vpc_receipt
end
|
Instance Method Details
#access_key_id ⇒ Object
43
44
45
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 43
def access_key_id
vpc_config['aws']['access_key_id'] || warning('Missing aws access_key_id field')
end
|
#availability_zone ⇒ Object
39
40
41
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 39
def availability_zone
vpc_config['vpc']['subnets']['bosh1']['availability_zone'] || warning('Missing availability zone in vpc.subnets.bosh')
end
|
#cache_access_key_id ⇒ Object
67
68
69
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 67
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 ⇒ Object
75
76
77
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 75
def cache_bucket_name
vpc_config['compiled_package_cache']['bucket_name'] || warning('Missing compiled_package_cache bucket_name field')
end
|
#cache_secret_access_key ⇒ Object
71
72
73
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 71
def cache_secret_access_key
vpc_config['compiled_package_cache']['secret_access_key'] || warning('Missing compiled_package_cache secret_access_key field')
end
|
#certificate ⇒ Object
87
88
89
90
91
92
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 87
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? ⇒ Boolean
63
64
65
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 63
def compiled_package_cache?
!!vpc_config['compiled_package_cache']
end
|
#deployment_name ⇒ Object
19
20
21
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 19
def deployment_name
"micro"
end
|
#director_ssl ⇒ Object
94
95
96
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 94
def director_ssl
ssl_certs['director_cert'] || {}
end
|
#director_ssl_cert ⇒ Object
83
84
85
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 83
def director_ssl_cert
certificate.certificate.gsub("\n", "\n ")
end
|
#director_ssl_key ⇒ Object
79
80
81
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 79
def director_ssl_key
certificate.key.gsub("\n", "\n ")
end
|
#file_name ⇒ Object
15
16
17
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 15
def file_name
"micro_bosh.yml"
end
|
#get_template(template) ⇒ Object
112
113
114
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 112
def get_template(template)
File.expand_path("../../../templates/#{template}", __FILE__)
end
|
#key_pair_name ⇒ Object
55
56
57
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 55
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 ⇒ Object
27
28
29
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 27
def name
vpc_config['name'] || warning('Missing name field')
end
|
#private_key_path ⇒ Object
59
60
61
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 59
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 ⇒ Object
51
52
53
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 51
def region
vpc_config['aws']['region'] || warning('Missing aws region field')
end
|
#secret_access_key ⇒ Object
47
48
49
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 47
def secret_access_key
vpc_config['aws']['secret_access_key'] || warning('Missing aws secret_access_key field')
end
|
#ssl_certs ⇒ Object
98
99
100
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 98
def ssl_certs
vpc_config['ssl_certs'] || {}
end
|
#subnet ⇒ Object
35
36
37
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 35
def subnet
vpc_receipt['vpc']['subnets']['bosh1'] || warning('Missing bosh subnet field')
end
|
#to_y ⇒ Object
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.
104
105
106
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 104
def to_y
ERB.new(File.read(get_template("micro_bosh.yml.erb"))).result(binding)
end
|
#to_yaml ⇒ Object
108
109
110
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 108
def to_yaml
to_y
end
|
#vip ⇒ Object
31
32
33
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 31
def vip
route53_receipt['elastic_ips']['micro']['ips'][0] || warning('Missing vip field')
end
|
#vpc_config ⇒ Object
23
24
25
|
# File 'lib/bosh_cli_plugin_aws/microbosh_manifest.rb', line 23
def vpc_config
vpc_receipt['original_configuration']
end
|