Module: Awspec::Helper::Finder::SNSTopic

Included in:
Awspec::Helper::Finder
Defined in:
lib/awspec/helper/finder/sns_topic.rb

Defined Under Namespace

Classes: SnsTopic

Instance Method Summary collapse

Instance Method Details

#find_sns_topic(topic_arn) ⇒ Object



32
33
34
35
# File 'lib/awspec/helper/finder/sns_topic.rb', line 32

def find_sns_topic(topic_arn)
  response = sns_client.get_topic_attributes({ topic_arn: topic_arn })
  SnsTopic.new(response.attributes)
end

#find_sns_topic_subs(topic_arn) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/awspec/helper/finder/sns_topic.rb', line 37

def find_sns_topic_subs(topic_arn)
  response = sns_client.list_subscriptions_by_topic({ topic_arn: topic_arn })
  subscriptions = {}
  response.subscriptions.each do |subscribed|
    subscriptions[subscribed['subscription_arn'].to_sym] = subscribed
  end
  subscriptions
end