Class: OpenStax::Aws::Configuration
- Inherits:
-
Object
- Object
- OpenStax::Aws::Configuration
- Defined in:
- lib/openstax_aws.rb
Instance Attribute Summary collapse
-
#cfn_template_bucket_folder ⇒ Object
Returns the value of attribute cfn_template_bucket_folder.
- #cfn_template_bucket_name ⇒ Object
- #cfn_template_bucket_region ⇒ Object
-
#default_cycle_if_different_parameter ⇒ Object
Returns the value of attribute default_cycle_if_different_parameter.
-
#fixed_s3_template_folder ⇒ Object
Returns the value of attribute fixed_s3_template_folder.
-
#infer_parameter_defaults ⇒ Object
Returns the value of attribute infer_parameter_defaults.
-
#infer_stack_capabilities ⇒ Object
Returns the value of attribute infer_stack_capabilities.
- #logger ⇒ Object
-
#production_env_name ⇒ Object
Returns the value of attribute production_env_name.
- #required_stack_tags ⇒ Object
-
#stack_waiter_delay ⇒ Object
Returns the value of attribute stack_waiter_delay.
-
#stack_waiter_max_attempts ⇒ Object
Returns the value of attribute stack_waiter_max_attempts.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#without_required_stack_tags ⇒ Object
Sometimes you want to make a Stack object without requirng stack tags, e.g.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/openstax_aws.rb', line 62 def initialize @stack_waiter_delay = 30 @stack_waiter_max_attempts = 180 @cfn_template_bucket_folder = "cfn_templates" @infer_stack_capabilities = true @infer_parameter_defaults = true @production_env_name = "production" @default_cycle_if_different_parameter = "CycleIfDifferent" @required_stack_tags = %w(Application Environment Owner) end |
Instance Attribute Details
#cfn_template_bucket_folder ⇒ Object
Returns the value of attribute cfn_template_bucket_folder.
51 52 53 |
# File 'lib/openstax_aws.rb', line 51 def cfn_template_bucket_folder @cfn_template_bucket_folder end |
#cfn_template_bucket_name ⇒ Object
78 79 80 81 |
# File 'lib/openstax_aws.rb', line 78 def cfn_template_bucket_name raise "cfn_template_bucket_name isn't set!" if @cfn_template_bucket_name.blank? @cfn_template_bucket_name end |
#cfn_template_bucket_region ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/openstax_aws.rb', line 83 def cfn_template_bucket_region raise "cfn_template_bucket_region isn't set!" if @cfn_template_bucket_region.blank? @cfn_template_bucket_region # We used to find the region automagically with the following, but this played some havoc # with recorded test interactions (as it only ran in some tests since memoized). Just # require manual setting now. # # @cfn_template_bucket_region ||= ::Aws::S3::Client.new(region: "us-east-1") # could be any region # .get_bucket_location(bucket: cfn_template_bucket_name) # .location_constraint end |
#default_cycle_if_different_parameter ⇒ Object
Returns the value of attribute default_cycle_if_different_parameter.
59 60 61 |
# File 'lib/openstax_aws.rb', line 59 def default_cycle_if_different_parameter @default_cycle_if_different_parameter end |
#fixed_s3_template_folder ⇒ Object
Returns the value of attribute fixed_s3_template_folder.
58 59 60 |
# File 'lib/openstax_aws.rb', line 58 def fixed_s3_template_folder @fixed_s3_template_folder end |
#infer_parameter_defaults ⇒ Object
Returns the value of attribute infer_parameter_defaults.
56 57 58 |
# File 'lib/openstax_aws.rb', line 56 def infer_parameter_defaults @infer_parameter_defaults end |
#infer_stack_capabilities ⇒ Object
Returns the value of attribute infer_stack_capabilities.
55 56 57 |
# File 'lib/openstax_aws.rb', line 55 def infer_stack_capabilities @infer_stack_capabilities end |
#logger ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/openstax_aws.rb', line 96 def logger @logger ||= Logger.new(STDERR).tap do |the_logger| the_logger.formatter = proc do |severity, datetime, progname, msg| date_format = datetime.strftime("%Y-%m-%d %H:%M:%S.%3N") if severity == "INFO" or severity == "WARN" "[#{date_format}] #{severity} | #{msg}\n" else "[#{date_format}] #{severity} | #{msg}\n" end end end end |
#production_env_name ⇒ Object
Returns the value of attribute production_env_name.
57 58 59 |
# File 'lib/openstax_aws.rb', line 57 def production_env_name @production_env_name end |
#required_stack_tags ⇒ Object
73 74 75 76 |
# File 'lib/openstax_aws.rb', line 73 def # Make sure always returned as an array [@required_stack_tags].compact.uniq.flatten end |
#stack_waiter_delay ⇒ Object
Returns the value of attribute stack_waiter_delay.
53 54 55 |
# File 'lib/openstax_aws.rb', line 53 def stack_waiter_delay @stack_waiter_delay end |
#stack_waiter_max_attempts ⇒ Object
Returns the value of attribute stack_waiter_max_attempts.
54 55 56 |
# File 'lib/openstax_aws.rb', line 54 def stack_waiter_max_attempts @stack_waiter_max_attempts end |
Instance Method Details
#without_required_stack_tags ⇒ Object
Sometimes you want to make a Stack object without requirng stack tags, e.g. if you’re just inspecting a stack. Wrapping such instantiations with this method enables this, e.g. without_required_stack_tags do … end
112 113 114 115 116 117 118 119 120 |
# File 'lib/openstax_aws.rb', line 112 def begin = self. = [] yield ensure self. = end end |