Class: AwsSqsMoniter::Aws::Builder::TopicBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_sqs_moniter/aws/builder/topic_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(logger, name) ⇒ TopicBuilder

Returns a new instance of TopicBuilder.



5
6
7
8
9
10
# File 'lib/aws_sqs_moniter/aws/builder/topic_builder.rb', line 5

def initialize logger, name
  @logger = logger
  @name = EnvironmentalName.new(name).to_s
  @sns = AwsSqsMoniter.sns_client
  @arns = Arns.new
end

Instance Method Details

#buildObject



12
13
14
15
16
# File 'lib/aws_sqs_moniter/aws/builder/topic_builder.rb', line 12

def build
  @logger.info building_topic: @name

  @sns.create_topic name: @name
end

#deleteObject



18
19
20
21
22
23
# File 'lib/aws_sqs_moniter/aws/builder/topic_builder.rb', line 18

def delete
  @logger.info deleting_topic: @name

  @sns.delete_topic topic_arn: @arns.sns_topic_arn(@name)
rescue ::Aws::SNS::Errors::NotFound
end