Class: Bosh::AwsCliPlugin::Migration
- Inherits:
-
Object
- Object
- Bosh::AwsCliPlugin::Migration
- Defined in:
- lib/bosh_cli_plugin_aws/migration.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#ec2 ⇒ Object
readonly
Returns the value of attribute ec2.
-
#elb ⇒ Object
readonly
Returns the value of attribute elb.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#rds ⇒ Object
readonly
Returns the value of attribute rds.
-
#route53 ⇒ Object
readonly
Returns the value of attribute route53.
-
#s3 ⇒ Object
readonly
Returns the value of attribute s3.
Instance Method Summary collapse
-
#initialize(config, receipt_bucket_name) ⇒ Migration
constructor
A new instance of Migration.
- #load_receipt(receipt_name) ⇒ Object
- #run ⇒ Object
- #save_receipt(receipt_name, receipt) ⇒ Object
Constructor Details
#initialize(config, receipt_bucket_name) ⇒ Migration
Returns a new instance of Migration.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/bosh_cli_plugin_aws/migration.rb', line 7 def initialize(config, receipt_bucket_name) @config = config @receipt_bucket_name = receipt_bucket_name aws_config = config['aws'] @s3 = S3.new(aws_config) @elb = ELB.new(aws_config) @ec2 = EC2.new(aws_config) @rds = RDS.new(aws_config) @route53 = Route53.new(aws_config) @logger = Bosh::Clouds::Config.logger end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/bosh_cli_plugin_aws/migration.rb', line 5 def config @config end |
#ec2 ⇒ Object (readonly)
Returns the value of attribute ec2.
5 6 7 |
# File 'lib/bosh_cli_plugin_aws/migration.rb', line 5 def ec2 @ec2 end |
#elb ⇒ Object (readonly)
Returns the value of attribute elb.
5 6 7 |
# File 'lib/bosh_cli_plugin_aws/migration.rb', line 5 def elb @elb end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
5 6 7 |
# File 'lib/bosh_cli_plugin_aws/migration.rb', line 5 def logger @logger end |
#rds ⇒ Object (readonly)
Returns the value of attribute rds.
5 6 7 |
# File 'lib/bosh_cli_plugin_aws/migration.rb', line 5 def rds @rds end |
#route53 ⇒ Object (readonly)
Returns the value of attribute route53.
5 6 7 |
# File 'lib/bosh_cli_plugin_aws/migration.rb', line 5 def route53 @route53 end |
#s3 ⇒ Object (readonly)
Returns the value of attribute s3.
5 6 7 |
# File 'lib/bosh_cli_plugin_aws/migration.rb', line 5 def s3 @s3 end |
Instance Method Details
#load_receipt(receipt_name) ⇒ Object
35 36 37 |
# File 'lib/bosh_cli_plugin_aws/migration.rb', line 35 def load_receipt(receipt_name) YAML.load(s3.fetch_object_contents(@receipt_bucket_name, "receipts/#{receipt_name}.yml")) end |
#run ⇒ Object
19 20 21 22 |
# File 'lib/bosh_cli_plugin_aws/migration.rb', line 19 def run say "Executing migration #{self.class.name}" execute end |
#save_receipt(receipt_name, receipt) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/bosh_cli_plugin_aws/migration.rb', line 24 def save_receipt(receipt_name, receipt) receipt_yaml = YAML.dump(receipt) s3.upload_to_bucket(@receipt_bucket_name, "receipts/#{receipt_name}.yml", receipt_yaml) File.open("#{receipt_name}.yml", "w+") do |f| f.write(receipt_yaml) end say "details in S3 receipt: #{receipt_name} and file: #{receipt_name}.yml" end |