class Bosh::Cli::Command::AWS
Constants
- DEFAULT_CIDR
Attributes
config_dir[R]
ec2[R]
output_state[R]
vpc[RW]
Public Class Methods
new(runner = [])
click to toggle source
Calls superclass method
# File lib/bosh/cli/commands/aws.rb, line 15 def initialize(runner = []) super(runner) @output_state = {} end
Public Instance Methods
bootstrap_bosh(config_file = nil)
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 55 def bootstrap_bosh(config_file = nil) target_required err "To bootstrap BOSH, first log in to '#{config.target}'" unless logged_in? options[:hm_director_user] ||= 'hm' options[:hm_director_password] = SecureRandom.base64 bootstrap = Bosh::AwsCliPlugin::BoshBootstrap.new(director, s3(config_file), self.options) bootstrap.start say 'For security purposes, please provide a username and password for BOSH Director' username = ask('Enter username: ') password = ask('Enter password: ') { |q| q.echo = '*' } bootstrap.create_user(username, password) say "BOSH deployed successfully. You are logged in as #{username}." bootstrap.create_user(options[:hm_director_user], options[:hm_director_password]) rescue Bosh::AwsCliPlugin::BootstrapError => e err "Unable to bootstrap bosh: #{e.message}" end
bootstrap_micro()
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 30 def bootstrap_micro options[:hm_director_password] = SecureRandom.base64 options[:hm_director_user] ||= 'hm' bootstrap = Bosh::AwsCliPlugin::MicroBoshBootstrap.new(runner, options) bootstrap.start bootstrap.create_user(options[:hm_director_user], options[:hm_director_password]) if interactive? username = ask('Enter username: ') password = ask('Enter password: ') { |q| q.echo = '*' } if username.blank? || password.blank? err('Please enter username and password') end bootstrap.create_user(username, password) else bootstrap.create_user('admin', SecureRandom.base64) end end
create(config_file = nil)
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 124 def create(config_file = nil) if !!options[:trace] require 'logger' ::AWS.config(:logger => Logger.new($stdout), :http_wire_trace => true) end Bosh::AwsCliPlugin::Migrator.new(load_config(config_file)).migrate end
create_bat_manifest(vpc_receipt_file, route53_receipt_file, stemcell_version, stemcell_name)
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 110 def create_bat_manifest(vpc_receipt_file, route53_receipt_file, stemcell_version, stemcell_name) target_required vpc_config = load_yaml_file(vpc_receipt_file) route53_config = load_yaml_file(route53_receipt_file) manifest = Bosh::AwsCliPlugin::BatManifest.new( vpc_config, route53_config, stemcell_version, director.uuid, stemcell_name) write_yaml(manifest, manifest.file_name) end
create_bosh_manifest(vpc_receipt_file, route53_receipt_file, bosh_rds_receipt_file)
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 94 def create_bosh_manifest(vpc_receipt_file, route53_receipt_file, bosh_rds_receipt_file) target_required options[:hm_director_user] ||= 'hm' options[:hm_director_password] = SecureRandom.base64 vpc_config = load_yaml_file(vpc_receipt_file) route53_config = load_yaml_file(route53_receipt_file) bosh_rds_config = load_yaml_file(bosh_rds_receipt_file) bosh_manifest = Bosh::AwsCliPlugin::BoshManifest.new(vpc_config, route53_config, director.uuid, bosh_rds_config, options) write_yaml(bosh_manifest, bosh_manifest.file_name) end
create_key_pairs(config_file = nil)
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 141 def create_key_pairs(config_file = nil) Bosh::AwsCliPlugin::Migrator.new(load_config(config_file)).migrate_version('20130412000811') end
create_micro_bosh_manifest(vpc_receipt_file, route53_receipt_file)
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 80 def create_micro_bosh_manifest(vpc_receipt_file, route53_receipt_file) vpc_config = load_yaml_file(vpc_receipt_file) route53_config = load_yaml_file(route53_receipt_file) options[:hm_director_user] ||= 'hm' options[:hm_director_password] = SecureRandom.base64 manifest = Bosh::AwsCliPlugin::MicroboshManifest.new(vpc_config, route53_config, options) write_yaml(manifest, manifest.file_name) end
create_route53_records(config_file = nil)
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 147 def create_route53_records(config_file = nil) Bosh::AwsCliPlugin::Migrator.new(load_config(config_file)).migrate_version('20130412181302') end
create_s3(config_file = nil)
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 135 def create_s3(config_file = nil) Bosh::AwsCliPlugin::Migrator.new(load_config(config_file)).migrate_version('20130412192351') end
create_vpc(config_file = nil)
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 153 def create_vpc(config_file = nil) Bosh::AwsCliPlugin::Migrator.new(load_config(config_file)).migrate_version('20130412004642') end
destroy(config_file = nil)
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 159 def destroy(config_file = nil) config = load_config(config_file) rds_destroyer = Bosh::AwsCliPlugin::RdsDestroyer.new(self, config) vpc_destroyer = Bosh::AwsCliPlugin::VpcDestroyer.new(self, config) destroyer = Bosh::AwsCliPlugin::Destroyer.new(self, config, rds_destroyer, vpc_destroyer) destroyer.ensure_not_production! destroyer.delete_all_elbs destroyer.delete_all_ec2 destroyer.delete_all_ebs destroyer.delete_all_rds destroyer.delete_all_s3 destroyer.delete_all_vpcs destroyer.delete_all_key_pairs destroyer.delete_all_elastic_ips destroyer.delete_all_security_groups destroyer.delete_all_route53_records end
help()
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 22 def help say "bosh aws sub-commands:\n" commands = Bosh::Cli::Config.commands.values.find_all { |command| command.usage =~ /^aws/ } Bosh::Cli::Command::Help.list_commands(commands) end
Private Instance Methods
default_config_file()
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 186 def default_config_file File.expand_path(File.join( File.dirname(__FILE__), '..', '..', '..', '..', 'templates', 'aws_configuration_template.yml.erb' )) end
load_config(config_file=nil)
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 192 def load_config(config_file=nil) config_file ||= default_config_file Bosh::AwsCliPlugin::AwsConfig.new(config_file).configuration end
s3(config_file)
click to toggle source
# File lib/bosh/cli/commands/aws.rb, line 181 def s3(config_file) config = load_config(config_file) Bosh::AwsCliPlugin::S3.new(config['aws']) end