Class: Simnos::DSL::Subscription
- Inherits:
-
Object
- Object
- Simnos::DSL::Subscription
- Includes:
- TemplateHelper
- Defined in:
- lib/simnos/dsl/subscription.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
-
#topic ⇒ Object
readonly
Returns the value of attribute topic.
Instance Method Summary collapse
- #aws_topic(aws_topic) ⇒ Object
- #create ⇒ Object
-
#initialize(context, topic:, protocol:, endpoint:) ⇒ Subscription
constructor
A new instance of Subscription.
Methods included from TemplateHelper
Constructor Details
#initialize(context, topic:, protocol:, endpoint:) ⇒ Subscription
Returns a new instance of Subscription.
24 25 26 27 28 29 30 |
# File 'lib/simnos/dsl/subscription.rb', line 24 def initialize(context, topic: , protocol: , endpoint: ) @context = context = @context. @topic = topic @protocol = protocol @endpoint = endpoint end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
32 33 34 |
# File 'lib/simnos/dsl/subscription.rb', line 32 def endpoint @endpoint end |
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
32 33 34 |
# File 'lib/simnos/dsl/subscription.rb', line 32 def protocol @protocol end |
#topic ⇒ Object (readonly)
Returns the value of attribute topic.
32 33 34 |
# File 'lib/simnos/dsl/subscription.rb', line 32 def topic @topic end |
Instance Method Details
#aws_topic(aws_topic) ⇒ Object
19 20 21 22 |
# File 'lib/simnos/dsl/subscription.rb', line 19 def aws_topic(aws_topic) @aws_topic = aws_topic self end |
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/simnos/dsl/subscription.rb', line 8 def create Simnos.logger.info("Create Topic(#{@aws_topic[:topic].topic_arn.split(':').last}) Subscription. protocol: #{protocol.inspect}, endpoint: #{endpoint.inspect}#{@options[:dry_run] ? ' [dry-run]' : ''}") return if [:dry_run] client.subscribe( topic_arn: @aws_topic[:topic].topic_arn, protocol: protocol, endpoint: endpoint, ) end |