Class: AwsIamPolicies

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



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/resources/aws/aws_iam_policies.rb', line 35

def fetch_from_api
  backend = BackendFactory.create(inspec_runner)
  @table = []
  pagination_opts = {}
  loop do
    api_result = backend.list_policies(pagination_opts)
    @table += api_result.policies.map(&:to_h)
    pagination_opts = { marker: api_result.marker }
    break unless api_result.is_truncated
  end
end

#to_sObject



31
32
33
# File 'lib/resources/aws/aws_iam_policies.rb', line 31

def to_s
  "IAM Policies"
end

#validate_params(resource_params) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/resources/aws/aws_iam_policies.rb', line 16

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

  resource_params
end