class RenderCFN::Stack

Public Class Methods

new( arguments) click to toggle source
Calls superclass method RenderCFN::AwsObject::new
# 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

Public Instance Methods

add( thing) click to toggle source
# File lib/renderCFN/stack.rb, line 38
def add( thing)
  @awsObject['Resources'].merge!(thing)
end
render() click to toggle source
# File lib/renderCFN/stack.rb, line 34
def render 
  YAML.dump(self.get)
end
uploadTemplate( ) click to toggle source
# 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