Class: RenderCFN::Stack
Direct Known Subclasses
Instance Method Summary collapse
- #add(thing) ⇒ Object
-
#initialize(arguments) ⇒ Stack
constructor
A new instance of Stack.
- #render ⇒ Object
- #uploadTemplate ⇒ Object
Methods inherited from AwsObject
Constructor Details
#initialize(arguments) ⇒ Stack
Returns a new instance of Stack.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/renderCFN/stack.rb', line 10 def initialize( arguments) super( arguments) @stackID = String.new() @templateName = 'main.yml' @templateURL = "https://s3.amazonaws.com/#{@@bucket}/stacks/#{@@stackName}/#{@templateName}" unless @@action then print "Must set action.\n" end unless @@stackType and @@environmentType and @@environmentName then print "Must set arguments for to stack name.\n" exit 1 end unless @@action == 'create' or @@action == 'print' then @@stackID = getAWSStackID() end @awsObject = Hash.new end |
Instance Method Details
#add(thing) ⇒ Object
38 39 40 |
# File 'lib/renderCFN/stack.rb', line 38 def add( thing) @awsObject['Resources'].merge!(thing) end |
#render ⇒ Object
34 35 36 |
# File 'lib/renderCFN/stack.rb', line 34 def render YAML.dump(self.get) end |
#uploadTemplate ⇒ Object
42 43 44 45 46 |
# File 'lib/renderCFN/stack.rb', line 42 def uploadTemplate( ) s3 = Aws::S3::Resource.new(region:'us-east-1') obj = s3.bucket(@@bucket).object("stacks/#{@@stackName}/#{@templateName}") obj.put(body: render) end |