mirror of
https://github.com/inspec/inspec
synced 2024-11-27 15:10:44 +00:00
Updates based on PR feedback
Signed-off-by: Chris Redekop <chris.redekop@d2l.com>
This commit is contained in:
parent
3cdb639a0c
commit
915e2fd7c6
3 changed files with 14 additions and 5 deletions
|
@ -16,7 +16,7 @@ Encoding:
|
||||||
HashSyntax:
|
HashSyntax:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
LineLength:
|
LineLength:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
EmptyLinesAroundBlockBody:
|
EmptyLinesAroundBlockBody:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
MethodLength:
|
MethodLength:
|
||||||
|
|
|
@ -31,12 +31,19 @@ class AwsIamAccessKey < Inspec.resource(1)
|
||||||
private
|
private
|
||||||
|
|
||||||
def access_key_last_used
|
def access_key_last_used
|
||||||
@access_key_last_used ||= @iam_client.get_access_key_last_used({ access_key_id: access_key_metadata.access_key_id }).access_key_last_used
|
@access_key_last_used ||=
|
||||||
|
@iam_client.get_access_key_last_used(
|
||||||
|
{
|
||||||
|
access_key_id: access_key_metadata.access_key_id,
|
||||||
|
},
|
||||||
|
).access_key_last_used
|
||||||
end
|
end
|
||||||
|
|
||||||
def access_key_metadata
|
def access_key_metadata
|
||||||
if !(defined? @access_key_metadata) || !@access_key_metadata
|
unless (defined? @access_key_metadata) && @access_key_metadata
|
||||||
@iam_client.list_access_keys({ user_name: @opts[:username] }).access_key_metadata.each do |access_key_metadata|
|
@iam_client.list_access_keys({ user_name: @opts[:username] })
|
||||||
|
.access_key_metadata.each do |access_key_metadata|
|
||||||
|
|
||||||
if access_key_metadata.access_key_id.eql? @opts[:id]
|
if access_key_metadata.access_key_id.eql? @opts[:id]
|
||||||
@access_key_metadata = access_key_metadata
|
@access_key_metadata = access_key_metadata
|
||||||
break
|
break
|
||||||
|
|
|
@ -74,7 +74,9 @@ class Ec2 < Inspec.resource(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def security_groups
|
def security_groups
|
||||||
@security_groups ||= instance.security_groups.map { |sg| { id: sg.group_id, name: sg.group_name } }
|
@security_groups ||= instance.security_groups.map { |sg|
|
||||||
|
{ id: sg.group_id, name: sg.group_name }
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def tags
|
def tags
|
||||||
|
|
Loading…
Reference in a new issue