class DrawCloud::SNSTopic
Attributes
display_name[RW]
name[RW]
subscriptions[RW]
Public Class Methods
new(name, options={}, &block)
click to toggle source
Calls superclass method
DrawCloud::Base::new
# File lib/draw_cloud/sns_topic.rb, line 24 def initialize(name, options={}, &block) @name = name @subscriptions = options.fetch(:subscriptions, []) super(options, &block) end
Public Instance Methods
add_subscription(endpoint, protocol)
click to toggle source
# File lib/draw_cloud/sns_topic.rb, line 30 def add_subscription(endpoint, protocol) subscriptions << {:endpoint => endpoint, :protocol => protocol} end
load_into_config(config)
click to toggle source
Calls superclass method
DrawCloud::Base#load_into_config
# File lib/draw_cloud/sns_topic.rb, line 38 def load_into_config(config) config.cf_add_resource resource_name, self super(config) end
resource_name()
click to toggle source
# File lib/draw_cloud/sns_topic.rb, line 43 def resource_name resource_style(name) + "SNSTopic" end
sns_topic()
click to toggle source
# File lib/draw_cloud/sns_topic.rb, line 34 def sns_topic self end
to_h()
click to toggle source
# File lib/draw_cloud/sns_topic.rb, line 47 def to_h h = { "Type" => "AWS::SNS::Topic", "Properties" => { "Subscription" => subscriptions.collect {|s| {"Endpoint" => DrawCloud.ref(s[:endpoint]), "Protocol" => DrawCloud.ref(s[:protocol])} } } } h["Properties"]["DisplayName"] = DrawCloud.ref(display_name) if display_name h end