Class: TemplateValidation
- Inherits:
-
Object
- Object
- TemplateValidation
- Defined in:
- lib/cf_factory/help/template_validation.rb
Instance Method Summary collapse
- #apply(parameters = {}) ⇒ Object
-
#initialize(template_string, config_options) ⇒ TemplateValidation
constructor
A new instance of TemplateValidation.
- #validate ⇒ Object
Constructor Details
#initialize(template_string, config_options) ⇒ TemplateValidation
Returns a new instance of TemplateValidation.
4 5 6 7 |
# File 'lib/cf_factory/help/template_validation.rb', line 4 def initialize(template_string, ) @template_string = template_string @config_options = end |
Instance Method Details
#apply(parameters = {}) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/cf_factory/help/template_validation.rb', line 20 def apply(parameters = {}) cf = AWS::CloudFormation.new(@config_options) stack_name = "StackStartedFromEclipse#{Time.new.to_i}" puts "going to start stack #{stack_name} with parameters #{parameters.inspect}" stack = cf.stacks.create(stack_name, @template_string, :parameters => parameters, :capabilities => ["CAPABILITY_IAM"]) puts "started stack with parameters: #{stack.parameters}" end |
#validate ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/cf_factory/help/template_validation.rb', line 9 def validate cf = AWS::CloudFormation.new(@config_options) response = cf.validate_template(@template_string) if response[:code] == "ValidationError" puts "Validation failed: #{response[:message]}" else puts "Validation successful" end response end |