Class: DrawCloud::SNSTopic
Instance Attribute Summary collapse
-
#display_name ⇒ Object
Returns the value of attribute display_name.
-
#name ⇒ Object
Returns the value of attribute name.
-
#subscriptions ⇒ Object
Returns the value of attribute subscriptions.
Attributes inherited from Base
#as_groups, #as_launch_configurations, #deletion_policy, #depends_on, #ec2_instances, #elastic_ips, #gateways, #iam_access_keys, #iam_policies, #iam_users, #mappings, #metadata, #network_acls, #network_interfaces, #outputs, #parameters, #parent, #rdses, #resources, #route_tables, #security_groups, #sns_topics, #subnets, #vpcs, #wait_handles
Instance Method Summary collapse
- #add_subscription(endpoint, protocol) ⇒ Object
-
#initialize(name, options = {}, &block) ⇒ SNSTopic
constructor
A new instance of SNSTopic.
- #load_into_config(config) ⇒ Object
- #resource_name ⇒ Object
- #sns_topic ⇒ Object
- #to_h ⇒ Object
Methods inherited from Base
#[], #accessor, #add_standard_properties, #create_as_group, #create_as_launch_configuration, #create_ec2_instance, #create_ec2_instance_template, #create_elastic_ip, #create_iam_access_key, #create_iam_policy, #create_iam_user, #create_mapping, #create_network_acl, #create_network_interface, #create_output, #create_parameter, #create_rds, #create_route_table, #create_security_group, #create_service, #create_sns_topic, #create_subnet, #create_vpc, #create_wait_handle, #ref
Methods included from Locations
Methods included from Utilities
#desplice, #fnbase64, #fngetatt, #fnjoin, #hash_to_tag_array, #region, #resource_style, #splice, #stack_name
Constructor Details
#initialize(name, options = {}, &block) ⇒ SNSTopic
Returns a new instance of SNSTopic.
24 25 26 27 28 |
# File 'lib/draw_cloud/sns_topic.rb', line 24 def initialize(name, ={}, &block) @name = name @subscriptions = .fetch(:subscriptions, []) super(, &block) end |
Instance Attribute Details
#display_name ⇒ Object
Returns the value of attribute display_name.
21 22 23 |
# File 'lib/draw_cloud/sns_topic.rb', line 21 def display_name @display_name end |
#name ⇒ Object
Returns the value of attribute name.
21 22 23 |
# File 'lib/draw_cloud/sns_topic.rb', line 21 def name @name end |
#subscriptions ⇒ Object
Returns the value of attribute subscriptions.
21 22 23 |
# File 'lib/draw_cloud/sns_topic.rb', line 21 def subscriptions @subscriptions end |
Instance Method Details
#add_subscription(endpoint, protocol) ⇒ Object
30 31 32 |
# File 'lib/draw_cloud/sns_topic.rb', line 30 def add_subscription(endpoint, protocol) subscriptions << {:endpoint => endpoint, :protocol => protocol} end |
#load_into_config(config) ⇒ Object
38 39 40 41 |
# 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 ⇒ Object
43 44 45 |
# File 'lib/draw_cloud/sns_topic.rb', line 43 def resource_name resource_style(name) + "SNSTopic" end |
#sns_topic ⇒ Object
34 35 36 |
# File 'lib/draw_cloud/sns_topic.rb', line 34 def sns_topic self end |
#to_h ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# 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 |