Sha256: 897098a01ab76949a61dd5135b539ef269e11350acff9b095fbe61cf3b2a28e7
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
require 'forwardable' require 'aws-sdk' require 'simnos/filterable' module Simnos class ClientWrapper extend Forwardable include Filterable def_delegators :@client, *%i/delete_topic get_topic_attributes create_topic set_topic_attributes set_subscription_attributes/ def initialize(options) @options = options if options[:region] @client = Aws::SNS::Client.new(region: @options[:region]) else @client = Aws::SNS::Client.new end end def topic_attrs(topic_arn: ) @client.get_topic_attributes(topic_arn: topic_arn) end 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 def region @client.config.region end private def topic_name(topic) topic.topic_arn.split(':').last end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simnos-0.1.0.beta4 | lib/simnos/client_wrapper.rb |