Class: ImageBuilder::Builders::AWS::Base
- Defined in:
- lib/image_builder/builders/aws_base.rb
Overview
Generic class doc comment
Constant Summary
Constants included from ImageBuilder
Instance Attribute Summary collapse
-
#access_key ⇒ Object
Returns the value of attribute access_key.
-
#ami_block_device_mappings ⇒ Object
-
opt -.
-
-
#ami_description ⇒ Object
Returns the value of attribute ami_description.
-
#ami_groups ⇒ Object
Returns the value of attribute ami_groups.
-
#ami_name ⇒ Object
Returns the value of attribute ami_name.
-
#ami_product_codes ⇒ Object
Returns the value of attribute ami_product_codes.
-
#ami_regions ⇒ Object
Returns the value of attribute ami_regions.
-
#ami_users ⇒ Object
Returns the value of attribute ami_users.
-
#ami_virtualization_type ⇒ Object
Returns the value of attribute ami_virtualization_type.
-
#associate_public_ip_address ⇒ Object
Returns the value of attribute associate_public_ip_address.
-
#availability_zone ⇒ Object
Returns the value of attribute availability_zone.
-
#enhanced_networking ⇒ Object
Returns the value of attribute enhanced_networking.
-
#iam_instance_profile ⇒ Object
Returns the value of attribute iam_instance_profile.
-
#instance_type ⇒ Object
Returns the value of attribute instance_type.
-
#launch_block_device_mappings ⇒ Object
Returns the value of attribute launch_block_device_mappings.
-
#region ⇒ Object
Returns the value of attribute region.
-
#run_tags ⇒ Object
Returns the value of attribute run_tags.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
-
#security_group_id ⇒ Object
Returns the value of attribute security_group_id.
-
#security_group_ids ⇒ Object
Returns the value of attribute security_group_ids.
-
#source_ami ⇒ Object
Returns the value of attribute source_ami.
-
#spot_price ⇒ Object
Returns the value of attribute spot_price.
-
#spot_price_auto_product ⇒ Object
Returns the value of attribute spot_price_auto_product.
-
#ssh_port ⇒ Object
Returns the value of attribute ssh_port.
-
#ssh_private_ip ⇒ Object
Returns the value of attribute ssh_private_ip.
-
#ssh_private_key_file ⇒ Object
Returns the value of attribute ssh_private_key_file.
-
#ssh_timeout ⇒ Object
Returns the value of attribute ssh_timeout.
-
#ssh_username ⇒ Object
Returns the value of attribute ssh_username.
-
#subnet_id ⇒ Object
Returns the value of attribute subnet_id.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#temporary_key_pair_name ⇒ Object
Returns the value of attribute temporary_key_pair_name.
-
#token ⇒ Object
Returns the value of attribute token.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#user_data ⇒ Object
Returns the value of attribute user_data.
-
#user_data_file ⇒ Object
Returns the value of attribute user_data_file.
-
#vpc_id ⇒ Object
Returns the value of attribute vpc_id.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #packer_hash ⇒ Object
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
47 48 49 50 51 |
# File 'lib/image_builder/builders/aws_base.rb', line 47 def initialize @access_key = ENV['AWS_ACCESS_KEY_ID'] || ENV['AWS_ACCESS_KEY'] @secret_key = ENV['AWS_SECRET_ACCESS_KEY'] || ENV['AWS_SECRET_KEY'] @region = 'us-east-1' end |
Instance Attribute Details
#access_key ⇒ Object
Returns the value of attribute access_key.
8 9 10 |
# File 'lib/image_builder/builders/aws_base.rb', line 8 def access_key @access_key end |
#ami_block_device_mappings ⇒ Object
-
opt -
16 17 18 |
# File 'lib/image_builder/builders/aws_base.rb', line 16 def ami_block_device_mappings @ami_block_device_mappings end |
#ami_description ⇒ Object
Returns the value of attribute ami_description.
17 18 19 |
# File 'lib/image_builder/builders/aws_base.rb', line 17 def ami_description @ami_description end |
#ami_groups ⇒ Object
Returns the value of attribute ami_groups.
18 19 20 |
# File 'lib/image_builder/builders/aws_base.rb', line 18 def ami_groups @ami_groups end |
#ami_name ⇒ Object
Returns the value of attribute ami_name.
9 10 11 |
# File 'lib/image_builder/builders/aws_base.rb', line 9 def ami_name @ami_name end |
#ami_product_codes ⇒ Object
Returns the value of attribute ami_product_codes.
19 20 21 |
# File 'lib/image_builder/builders/aws_base.rb', line 19 def ami_product_codes @ami_product_codes end |
#ami_regions ⇒ Object
Returns the value of attribute ami_regions.
20 21 22 |
# File 'lib/image_builder/builders/aws_base.rb', line 20 def ami_regions @ami_regions end |
#ami_users ⇒ Object
Returns the value of attribute ami_users.
21 22 23 |
# File 'lib/image_builder/builders/aws_base.rb', line 21 def ami_users @ami_users end |
#ami_virtualization_type ⇒ Object
Returns the value of attribute ami_virtualization_type.
22 23 24 |
# File 'lib/image_builder/builders/aws_base.rb', line 22 def ami_virtualization_type @ami_virtualization_type end |
#associate_public_ip_address ⇒ Object
Returns the value of attribute associate_public_ip_address.
23 24 25 |
# File 'lib/image_builder/builders/aws_base.rb', line 23 def associate_public_ip_address @associate_public_ip_address end |
#availability_zone ⇒ Object
Returns the value of attribute availability_zone.
24 25 26 |
# File 'lib/image_builder/builders/aws_base.rb', line 24 def availability_zone @availability_zone end |
#enhanced_networking ⇒ Object
Returns the value of attribute enhanced_networking.
25 26 27 |
# File 'lib/image_builder/builders/aws_base.rb', line 25 def enhanced_networking @enhanced_networking end |
#iam_instance_profile ⇒ Object
Returns the value of attribute iam_instance_profile.
26 27 28 |
# File 'lib/image_builder/builders/aws_base.rb', line 26 def iam_instance_profile @iam_instance_profile end |
#instance_type ⇒ Object
Returns the value of attribute instance_type.
10 11 12 |
# File 'lib/image_builder/builders/aws_base.rb', line 10 def instance_type @instance_type end |
#launch_block_device_mappings ⇒ Object
Returns the value of attribute launch_block_device_mappings.
27 28 29 |
# File 'lib/image_builder/builders/aws_base.rb', line 27 def launch_block_device_mappings @launch_block_device_mappings end |
#region ⇒ Object
Returns the value of attribute region.
11 12 13 |
# File 'lib/image_builder/builders/aws_base.rb', line 11 def region @region end |
#run_tags ⇒ Object
Returns the value of attribute run_tags.
28 29 30 |
# File 'lib/image_builder/builders/aws_base.rb', line 28 def @run_tags end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
12 13 14 |
# File 'lib/image_builder/builders/aws_base.rb', line 12 def secret_key @secret_key end |
#security_group_id ⇒ Object
Returns the value of attribute security_group_id.
29 30 31 |
# File 'lib/image_builder/builders/aws_base.rb', line 29 def security_group_id @security_group_id end |
#security_group_ids ⇒ Object
Returns the value of attribute security_group_ids.
30 31 32 |
# File 'lib/image_builder/builders/aws_base.rb', line 30 def security_group_ids @security_group_ids end |
#source_ami ⇒ Object
Returns the value of attribute source_ami.
13 14 15 |
# File 'lib/image_builder/builders/aws_base.rb', line 13 def source_ami @source_ami end |
#spot_price ⇒ Object
Returns the value of attribute spot_price.
31 32 33 |
# File 'lib/image_builder/builders/aws_base.rb', line 31 def spot_price @spot_price end |
#spot_price_auto_product ⇒ Object
Returns the value of attribute spot_price_auto_product.
32 33 34 |
# File 'lib/image_builder/builders/aws_base.rb', line 32 def spot_price_auto_product @spot_price_auto_product end |
#ssh_port ⇒ Object
Returns the value of attribute ssh_port.
33 34 35 |
# File 'lib/image_builder/builders/aws_base.rb', line 33 def ssh_port @ssh_port end |
#ssh_private_ip ⇒ Object
Returns the value of attribute ssh_private_ip.
35 36 37 |
# File 'lib/image_builder/builders/aws_base.rb', line 35 def ssh_private_ip @ssh_private_ip end |
#ssh_private_key_file ⇒ Object
Returns the value of attribute ssh_private_key_file.
34 35 36 |
# File 'lib/image_builder/builders/aws_base.rb', line 34 def ssh_private_key_file @ssh_private_key_file end |
#ssh_timeout ⇒ Object
Returns the value of attribute ssh_timeout.
36 37 38 |
# File 'lib/image_builder/builders/aws_base.rb', line 36 def ssh_timeout @ssh_timeout end |
#ssh_username ⇒ Object
Returns the value of attribute ssh_username.
14 15 16 |
# File 'lib/image_builder/builders/aws_base.rb', line 14 def ssh_username @ssh_username end |
#subnet_id ⇒ Object
Returns the value of attribute subnet_id.
37 38 39 |
# File 'lib/image_builder/builders/aws_base.rb', line 37 def subnet_id @subnet_id end |
#tags ⇒ Object
Returns the value of attribute tags.
38 39 40 |
# File 'lib/image_builder/builders/aws_base.rb', line 38 def @tags end |
#temporary_key_pair_name ⇒ Object
Returns the value of attribute temporary_key_pair_name.
39 40 41 |
# File 'lib/image_builder/builders/aws_base.rb', line 39 def temporary_key_pair_name @temporary_key_pair_name end |
#token ⇒ Object
Returns the value of attribute token.
40 41 42 |
# File 'lib/image_builder/builders/aws_base.rb', line 40 def token @token end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
45 46 47 |
# File 'lib/image_builder/builders/aws_base.rb', line 45 def type @type end |
#user_data ⇒ Object
Returns the value of attribute user_data.
41 42 43 |
# File 'lib/image_builder/builders/aws_base.rb', line 41 def user_data @user_data end |
#user_data_file ⇒ Object
Returns the value of attribute user_data_file.
42 43 44 |
# File 'lib/image_builder/builders/aws_base.rb', line 42 def user_data_file @user_data_file end |
#vpc_id ⇒ Object
Returns the value of attribute vpc_id.
43 44 45 |
# File 'lib/image_builder/builders/aws_base.rb', line 43 def vpc_id @vpc_id end |
Class Method Details
.default_block_device_mappings ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/image_builder/builders/aws_base.rb', line 53 def self.default_block_device_mappings [ { device_name: '/dev/sdf', virtual_name: 'ephemeral0' }, { device_name: '/dev/sdg', virtual_name: 'ephemeral1' }, { device_name: '/dev/sdh', virtual_name: 'ephemeral2' }, { device_name: '/dev/sdi', virtual_name: 'ephemeral3' } ] end |
.default_launch_block_device_mappings ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/image_builder/builders/aws_base.rb', line 62 def self.default_launch_block_device_mappings [ { device_name: '/dev/sdb', no_device: true }, { device_name: '/dev/sdc', no_device: true }, { device_name: '/dev/sdd', no_device: true } ] end |
Instance Method Details
#packer_hash ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/image_builder/builders/aws_base.rb', line 70 def packer_hash hash = {} req_attrs = [ :type, :name, :access_key, :ami_name, :instance_type, :region, :secret_key, :source_ami, :ssh_username ] opt_attrs = [ :ami_description, :ami_groups, :ami_product_codes, :ami_regions, :ami_regions, :ami_users, :ami_virtualization_type, :associate_public_ip_address, :availability_zone, :enhanced_networking, :iam_instance_profile, :run_tags, :security_group_id, :security_group_ids, :spot_price, :spot_price_auto_product, :ssh_port, :ssh_private_key_file, :ssh_private_ip, :ssh_timeout, :subnet_id, :tags, :temporary_key_pair_name, :token, :user_data, :user_data_file, :vpc_id, :launch_block_device_mappings, :ami_block_device_mappings ] # Required attrs req_attrs.each do |a| attr_to_hash(hash, a, true) end opt_attrs.each do |a| attr_to_hash(hash, a) end hash end |