Sha256: 7fccedb5a5ac95fd0645f92390dd27f5976127718a7cdcd91edc9925c8267cc0
Contents?: true
Size: 822 Bytes
Versions: 2
Compression:
Stored size: 822 Bytes
Contents
# frozen_string_literal: true require 'singleton' module CycloneLariat class ListTopicsStore include Singleton def topic_arn(topic_name) @topics[topic_name.to_sym] end def list @topics.keys end def add_topics(aws_client) @topics ||= {} @aws_client = aws_client fetch end def clear_store! @topics = {} end private def fetch return unless @topics.empty? @next_token = '' topics_from_aws until @next_token.nil? end def topics_from_aws result = @aws_client.list_topics(next_token: @next_token) @next_token = result.next_token result.topics.each do |topic| topic_name = topic.topic_arn.split(':').last @topics[topic_name.to_sym] = topic.topic_arn end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cyclone_lariat-0.3.9 | lib/cyclone_lariat/list_topics_store.rb |
cyclone_lariat-0.3.8 | lib/cyclone_lariat/list_topics_store.rb |