Class: AwsKmsKeys

Inherits:
Object
  • Object
show all
Includes:
AwsPluralResourceMixin
Defined in:
lib/resources/aws/aws_kms_keys.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



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/resources/aws/aws_kms_keys.rb', line 30

def fetch_from_api
  backend = BackendFactory.create(inspec_runner)
  @table = []
  pagination_opts = { limit: 1000 }
  loop do
    api_result = backend.list_keys(pagination_opts)
    @table += api_result.keys.map(&:to_h)
    break unless api_result.truncated
    pagination_opts = { marker: api_result.next_marker }
  end
end

#to_sObject



26
27
28
# File 'lib/resources/aws/aws_kms_keys.rb', line 26

def to_s
  'KMS Keys'
end

#validate_params(resource_params) ⇒ Object



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

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