class Simnos::ClientWrapper
Public Class Methods
new(options)
click to toggle source
# File lib/simnos/client_wrapper.rb, line 12 def initialize(options) @options = options if options[:region] @client = Aws::SNS::Client.new(region: @options[:region]) else @client = Aws::SNS::Client.new end end
Public Instance Methods
region()
click to toggle source
# File lib/simnos/client_wrapper.rb, line 54 def region @client.config.region end
subscriptions_by_topic(topic_arn: )
click to toggle source
# File lib/simnos/client_wrapper.rb, line 43 def subscriptions_by_topic(topic_arn: ) results = [] next_token = nil begin resp = @client.list_subscriptions_by_topic(topic_arn: topic_arn, next_token: next_token) results.concat(resp.subscriptions) next_token = resp.next_token end while next_token results end
topic_attrs(topic_arn: )
click to toggle source
# File lib/simnos/client_wrapper.rb, line 21 def topic_attrs(topic_arn: ) @client.get_topic_attributes(topic_arn: topic_arn) end
topics()
click to toggle source
# File lib/simnos/client_wrapper.rb, line 25 def topics results = {} next_token = nil begin resp = @client.list_topics(next_token: next_token) resp.topics.each do |t| name = t.topic_arn.split(':').last next unless target?(name) results[name] = { topic: t, attrs: topic_attrs(topic_arn: t.topic_arn), } end next_token = resp.next_token end while next_token results end
Private Instance Methods
topic_name(topic)
click to toggle source
# File lib/simnos/client_wrapper.rb, line 60 def topic_name(topic) topic.topic_arn.split(':').last end