Class: AwsHelpers::ElasticBeanstalk::Version

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

Instance Method Summary collapse

Constructor Details

#initialize(elastic_beanstalk_client, s3_client, iam_client) ⇒ Version


10
11
12
13
14
# File 'lib/aws_helpers/elastic_beanstalk/version.rb', line 10

def initialize(elastic_beanstalk_client, s3_client, iam_client)
  @application_version = ApplicationVersion.new(elastic_beanstalk_client)
  @s3_client = s3_client
  @iam_client = iam_client
end

Instance Method Details

#deploy(application, environment, version) ⇒ Object


27
28
29
30
31
32
33
# File 'lib/aws_helpers/elastic_beanstalk/version.rb', line 27

def deploy(application, environment, version)
  raise_argument_error 'application' unless application
  raise_argument_error 'environment' unless environment
  raise_argument_error 'version' unless version

  @application_version.deploy(application, environment, version)
end

#upload(application, version, version_contents, zip_folder = false) ⇒ Object


16
17
18
19
20
21
22
23
24
25
# File 'lib/aws_helpers/elastic_beanstalk/version.rb', line 16

def upload(application, version, version_contents, zip_folder=false)
  raise_argument_error 'application' unless application
  raise_argument_error 'version' unless version
  raise_argument_error 'version_contents' unless version_contents

  klass = zip_folder ? AwsHelpers::ElasticBeanstalk::VersionZipFolder : VersionFile
  version_file = klass.new(@s3_client, @iam_client, application, version, version_contents)
  version_file.upload_to_s3
  @application_version.create(application, version_file)
end