Class: StackMaster::StackDefinition
- Inherits:
-
Object
- Object
- StackMaster::StackDefinition
- Includes:
- Utils::Initializable
- Defined in:
- lib/stack_master/stack_definition.rb
Instance Attribute Summary collapse
-
#additional_parameter_lookup_dirs ⇒ Object
Returns the value of attribute additional_parameter_lookup_dirs.
-
#allowed_accounts ⇒ Object
Returns the value of attribute allowed_accounts.
-
#base_dir ⇒ Object
Returns the value of attribute base_dir.
-
#compiler ⇒ Object
Returns the value of attribute compiler.
-
#compiler_options ⇒ Object
Returns the value of attribute compiler_options.
-
#ejson_file ⇒ Object
Returns the value of attribute ejson_file.
-
#ejson_file_kms ⇒ Object
Returns the value of attribute ejson_file_kms.
-
#ejson_file_region ⇒ Object
Returns the value of attribute ejson_file_region.
-
#files ⇒ Object
Returns the value of attribute files.
-
#notification_arns ⇒ Object
Returns the value of attribute notification_arns.
-
#region ⇒ Object
Returns the value of attribute region.
-
#role_arn ⇒ Object
Returns the value of attribute role_arn.
-
#s3 ⇒ Object
Returns the value of attribute s3.
-
#stack_name ⇒ Object
Returns the value of attribute stack_name.
-
#stack_policy_file ⇒ Object
Returns the value of attribute stack_policy_file.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#template ⇒ Object
Returns the value of attribute template.
-
#template_dir ⇒ Object
Returns the value of attribute template_dir.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #files_dir ⇒ Object
-
#initialize(attributes = {}) ⇒ StackDefinition
constructor
A new instance of StackDefinition.
- #parameter_files ⇒ Object
- #s3_configured? ⇒ Boolean
- #s3_files ⇒ Object
- #s3_template_file_name ⇒ Object
- #stack_policy_file_path ⇒ Object
- #template_file_path ⇒ Object
Methods included from Utils::Initializable
Constructor Details
#initialize(attributes = {}) ⇒ StackDefinition
Returns a new instance of StackDefinition.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/stack_master/stack_definition.rb', line 25 def initialize(attributes = {}) @additional_parameter_lookup_dirs = [] @compiler_options = {} @notification_arns = [] @s3 = {} @files = [] @allowed_accounts = nil @ejson_file_kms = true @compiler = nil super @template_dir ||= File.join(@base_dir, 'templates') @allowed_accounts = Array(@allowed_accounts) end |
Instance Attribute Details
#additional_parameter_lookup_dirs ⇒ Object
Returns the value of attribute additional_parameter_lookup_dirs.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def additional_parameter_lookup_dirs @additional_parameter_lookup_dirs end |
#allowed_accounts ⇒ Object
Returns the value of attribute allowed_accounts.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def allowed_accounts @allowed_accounts end |
#base_dir ⇒ Object
Returns the value of attribute base_dir.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def base_dir @base_dir end |
#compiler ⇒ Object
Returns the value of attribute compiler.
21 22 23 |
# File 'lib/stack_master/stack_definition.rb', line 21 def compiler @compiler end |
#compiler_options ⇒ Object
Returns the value of attribute compiler_options.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def @compiler_options end |
#ejson_file ⇒ Object
Returns the value of attribute ejson_file.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def ejson_file @ejson_file end |
#ejson_file_kms ⇒ Object
Returns the value of attribute ejson_file_kms.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def ejson_file_kms @ejson_file_kms end |
#ejson_file_region ⇒ Object
Returns the value of attribute ejson_file_region.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def ejson_file_region @ejson_file_region end |
#files ⇒ Object
Returns the value of attribute files.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def files @files end |
#notification_arns ⇒ Object
Returns the value of attribute notification_arns.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def notification_arns @notification_arns end |
#region ⇒ Object
Returns the value of attribute region.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def region @region end |
#role_arn ⇒ Object
Returns the value of attribute role_arn.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def role_arn @role_arn end |
#s3 ⇒ Object
Returns the value of attribute s3.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def s3 @s3 end |
#stack_name ⇒ Object
Returns the value of attribute stack_name.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def stack_name @stack_name end |
#stack_policy_file ⇒ Object
Returns the value of attribute stack_policy_file.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def stack_policy_file @stack_policy_file end |
#tags ⇒ Object
Returns the value of attribute tags.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def @tags end |
#template ⇒ Object
Returns the value of attribute template.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def template @template end |
#template_dir ⇒ Object
Returns the value of attribute template_dir.
3 4 5 |
# File 'lib/stack_master/stack_definition.rb', line 3 def template_dir @template_dir end |
Instance Method Details
#==(other) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/stack_master/stack_definition.rb', line 39 def ==(other) self.class === other && @region == other.region && @stack_name == other.stack_name && @template == other.template && @tags == other. && @role_arn == other.role_arn && @allowed_accounts == other.allowed_accounts && @notification_arns == other.notification_arns && @base_dir == other.base_dir && @ejson_file == other.ejson_file && @ejson_file_region == other.ejson_file_region && @ejson_file_kms == other.ejson_file_kms && @stack_policy_file == other.stack_policy_file && @additional_parameter_lookup_dirs == other.additional_parameter_lookup_dirs && @s3 == other.s3 && @compiler == other.compiler && @compiler_options == other. end |
#files_dir ⇒ Object
68 69 70 |
# File 'lib/stack_master/stack_definition.rb', line 68 def files_dir File.join(base_dir, 'files') end |
#parameter_files ⇒ Object
88 89 90 |
# File 'lib/stack_master/stack_definition.rb', line 88 def parameter_files [ default_parameter_file_path, region_parameter_file_path, additional_parameter_lookup_file_paths ].flatten.compact end |
#s3_configured? ⇒ Boolean
96 97 98 |
# File 'lib/stack_master/stack_definition.rb', line 96 def s3_configured? !s3.nil? end |
#s3_files ⇒ Object
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/stack_master/stack_definition.rb', line 72 def s3_files files.inject({}) do |hash, file| path = File.join(files_dir, file) hash[file] = { path: path, body: File.read(path) } hash end end |
#s3_template_file_name ⇒ Object
83 84 85 86 |
# File 'lib/stack_master/stack_definition.rb', line 83 def s3_template_file_name return template if ['.json', '.yaml', '.yml'].include?(File.extname(template)) Utils.change_extension(template, 'json') end |
#stack_policy_file_path ⇒ Object
92 93 94 |
# File 'lib/stack_master/stack_definition.rb', line 92 def stack_policy_file_path File.join(base_dir, 'policies', stack_policy_file) if stack_policy_file end |
#template_file_path ⇒ Object
63 64 65 66 |
# File 'lib/stack_master/stack_definition.rb', line 63 def template_file_path return unless template File.(File.join(template_dir, template)) end |