Class: AwsSnsTopics

Inherits:
Object
  • Object
show all
Includes:
AwsPluralResourceMixin
Defined in:
lib/resources/aws/aws_sns_topics.rb

Defined Under Namespace

Classes: Backend

Instance Attribute Summary

Attributes included from AwsPluralResourceMixin

#table

Instance Method Summary collapse

Methods included from AwsPluralResourceMixin

included

Methods included from AwsResourceMixin

#catch_aws_errors, #check_resource_param_names, #initialize, #inspec_runner

Instance Method Details

#fetch_from_apiObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/resources/aws/aws_sns_topics.rb', line 20

def fetch_from_api
  backend = BackendFactory.create(inspec_runner)
  @table = []
  pagination_opts = nil
  catch_aws_errors do
    loop do
      api_result = backend.list_topics(pagination_opts)
      @table += api_result.topics.map(&:to_h)
      break if api_result.next_token.nil?
      pagination_opts = { next_token: api_result.next_token }
    end
  end
end

#to_sObject



42
43
44
# File 'lib/resources/aws/aws_sns_topics.rb', line 42

def to_s
  'EC2 SNS Topics'
end

#validate_params(resource_params) ⇒ Object



13
14
15
16
17
18
# File 'lib/resources/aws/aws_sns_topics.rb', line 13

def validate_params(resource_params)
  unless resource_params.empty?
    raise ArgumentError, 'aws_sns_topics does not accept resource parameters.'
  end
  resource_params
end