Class: AwsHelpers::ElasticBeanstalk::ApplicationVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_helpers/elastic_beanstalk/application_version.rb

Instance Method Summary collapse

Constructor Details

#initialize(elastic_beanstalk_client) ⇒ ApplicationVersion

Returns a new instance of ApplicationVersion


8
9
10
11
# File 'lib/aws_helpers/elastic_beanstalk/application_version.rb', line 8

def initialize(elastic_beanstalk_client)
  @elastic_beanstalk_client = elastic_beanstalk_client
  @events = Events.new(elastic_beanstalk_client)
end

Instance Method Details

#create(application, version_file) ⇒ Object


13
14
15
16
17
18
19
20
21
# File 'lib/aws_helpers/elastic_beanstalk/application_version.rb', line 13

def create(application, version_file)
  puts "Creating version #{version_file.version} for #{application}"
  @elastic_beanstalk_client.create_application_version(
    application_name: application,
    version_label: version_file.version,
    source_bundle: {
      s3_bucket: version_file.bucket,
      s3_key: version_file.file_name })
end

#deploy(application, environment, version) ⇒ Object


23
24
25
26
27
28
29
# File 'lib/aws_helpers/elastic_beanstalk/application_version.rb', line 23

def deploy(application, environment, version)
  puts "Deploying version #{version} to #{application}, #{environment}"
  response = @elastic_beanstalk_client.update_environment(
    environment_name: environment,
    version_label: version)
  @events.pool(response[:date_updated], application, environment)
end