Class: Jets::Cfn::Resource::Sns::TopicPolicy
- Defined in:
- lib/jets/cfn/resource/sns/topic_policy.rb
Instance Method Summary collapse
- #definition ⇒ Object
-
#initialize(props = {}) ⇒ TopicPolicy
constructor
A new instance of TopicPolicy.
-
#merged_properties ⇒ Object
Do not name this method properties, that is a computed method of ‘Jets::Cfn::Resource`.
- #policy_logical_id ⇒ Object
Methods inherited from Base
#attributes, #logical_id, #outputs, #parameters, #permission, #properties, #replacements, #replacer, #standarize, #template, truncate_id, #type
Methods included from Util::Camelize
Constructor Details
#initialize(props = {}) ⇒ TopicPolicy
Returns a new instance of TopicPolicy.
4 5 6 |
# File 'lib/jets/cfn/resource/sns/topic_policy.rb', line 4 def initialize(props={}) @props = props # associated_properties from dsl.rb end |
Instance Method Details
#definition ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/jets/cfn/resource/sns/topic_policy.rb', line 8 def definition { policy_logical_id => { Type: "AWS::SNS::TopicPolicy", Properties: merged_properties, } } end |
#merged_properties ⇒ Object
Do not name this method properties, that is a computed method of ‘Jets::Cfn::Resource`
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/jets/cfn/resource/sns/topic_policy.rb', line 18 def merged_properties { PolicyDocument: { Version: "2012-10-17", Statement: { Effect: "Allow", Principal: { Service: "s3.amazonaws.com"}, Action: "sns:Publish", Resource: "*", # TODO: figure out good syntax to limit easily # Condition: # ArnLike: # aws:SourceArn: arn:aws:s3:::aa-test-95872017 } }, topics: ["!Ref {namespace}SnsTopic"], }.deep_merge(@props) end |
#policy_logical_id ⇒ Object
36 37 38 |
# File 'lib/jets/cfn/resource/sns/topic_policy.rb', line 36 def policy_logical_id "{namespace}SnsTopicPolicy" end |