inspec/lib/resources/aws/aws_iam_users.rb

99 lines
3.1 KiB
Ruby
Raw Normal View History

require '_aws'
# author: Alex Bedley
# author: Steffanie Freeman
# author: Simon Varlow
# author: Chris Redekop
class AwsIamUsers < Inspec.resource(1)
name 'aws_iam_users'
desc 'Verifies settings for AWS IAM users'
example '
describe aws_iam_users.where(has_mfa_enabled?: false) do
it { should_not exist }
end
describe aws_iam_users.where(has_console_password?: true) do
it { should exist }
end
'
supports platform: 'aws'
include AwsPluralResourceMixin
filter = FilterTable.create
filter.add_accessor(:where)
.add_accessor(:entries)
.add(:exists?) { |x| !x.entries.empty? }
Re-work unit tests for user and users (#125) * Constructor unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Constructor tests pass, all others gutted Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Basic 'where' test in place, no criteria Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Wired up filter table to backend list users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Unit testing for has_mfa_enabled and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Simple AWS client implementation for Users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Rework resource parameters and validation; copy in code from #121 Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add constructor tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add search/recall tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Recall unit tests pass Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for username and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_console_password works in unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled failing unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled passes unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for Access Keys Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * CLean up bad rebase commit Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Access keys property works, as an uncooked AWS response Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-linting Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests work Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove provider support libraries Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests pass for users resource Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-lint Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove aws connection load from user Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Adapt aws_iam_user to rely on AwsResourceMixin Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2017-12-08 18:34:09 +00:00
.add(:has_mfa_enabled?, field: :has_mfa_enabled)
.add(:has_console_password?, field: :has_console_password)
.add(:password_ever_used?, field: :password_ever_used?)
.add(:password_never_used?, field: :password_never_used?)
.add(:password_last_used_days_ago, field: :password_last_used_days_ago)
Re-work unit tests for user and users (#125) * Constructor unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Constructor tests pass, all others gutted Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Basic 'where' test in place, no criteria Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Wired up filter table to backend list users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Unit testing for has_mfa_enabled and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Simple AWS client implementation for Users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Rework resource parameters and validation; copy in code from #121 Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add constructor tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add search/recall tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Recall unit tests pass Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for username and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_console_password works in unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled failing unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled passes unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for Access Keys Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * CLean up bad rebase commit Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Access keys property works, as an uncooked AWS response Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-linting Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests work Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove provider support libraries Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests pass for users resource Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-lint Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove aws connection load from user Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Adapt aws_iam_user to rely on AwsResourceMixin Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2017-12-08 18:34:09 +00:00
.add(:username, field: :user_name)
filter.connect(self, :table)
def validate_params(raw_params)
# No params yet
unless raw_params.empty?
raise ArgumentError, 'aws_iam_users does not accept resource parameters'
end
raw_params
end
def fetch_from_api
backend = BackendFactory.create(inspec_runner)
@table = backend.list_users.users.map(&:to_h)
Re-work unit tests for user and users (#125) * Constructor unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Constructor tests pass, all others gutted Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Basic 'where' test in place, no criteria Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Wired up filter table to backend list users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Unit testing for has_mfa_enabled and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Simple AWS client implementation for Users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Rework resource parameters and validation; copy in code from #121 Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add constructor tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add search/recall tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Recall unit tests pass Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for username and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_console_password works in unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled failing unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled passes unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for Access Keys Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * CLean up bad rebase commit Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Access keys property works, as an uncooked AWS response Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-linting Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests work Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove provider support libraries Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests pass for users resource Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-lint Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove aws connection load from user Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Adapt aws_iam_user to rely on AwsResourceMixin Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2017-12-08 18:34:09 +00:00
# TODO: lazy columns - https://github.com/chef/inspec-aws/issues/100
@table.each do |user|
Re-work unit tests for user and users (#125) * Constructor unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Constructor tests pass, all others gutted Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Basic 'where' test in place, no criteria Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Wired up filter table to backend list users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Unit testing for has_mfa_enabled and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Simple AWS client implementation for Users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Rework resource parameters and validation; copy in code from #121 Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add constructor tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add search/recall tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Recall unit tests pass Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for username and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_console_password works in unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled failing unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled passes unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for Access Keys Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * CLean up bad rebase commit Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Access keys property works, as an uncooked AWS response Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-linting Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests work Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove provider support libraries Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests pass for users resource Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-lint Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove aws connection load from user Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Adapt aws_iam_user to rely on AwsResourceMixin Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2017-12-08 18:34:09 +00:00
begin
_login_profile = backend.get_login_profile(user_name: user[:user_name])
user[:has_console_password] = true
rescue Aws::IAM::Errors::NoSuchEntity
user[:has_console_password] = false
end
user[:has_console_password?] = user[:has_console_password]
Re-work unit tests for user and users (#125) * Constructor unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Constructor tests pass, all others gutted Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Basic 'where' test in place, no criteria Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Wired up filter table to backend list users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Unit testing for has_mfa_enabled and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Simple AWS client implementation for Users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Rework resource parameters and validation; copy in code from #121 Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add constructor tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add search/recall tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Recall unit tests pass Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for username and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_console_password works in unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled failing unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled passes unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for Access Keys Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * CLean up bad rebase commit Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Access keys property works, as an uncooked AWS response Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-linting Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests work Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove provider support libraries Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests pass for users resource Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-lint Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove aws connection load from user Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Adapt aws_iam_user to rely on AwsResourceMixin Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2017-12-08 18:34:09 +00:00
begin
aws_mfa_devices = backend.list_mfa_devices(user_name: user[:user_name])
user[:has_mfa_enabled] = !aws_mfa_devices.mfa_devices.empty?
rescue Aws::IAM::Errors::NoSuchEntity
user[:has_mfa_enabled] = false
end
user[:has_mfa_enabled?] = user[:has_mfa_enabled]
password_last_used = user[:password_last_used]
user[:password_ever_used?] = !password_last_used.nil?
user[:password_never_used?] = password_last_used.nil?
next unless user[:password_ever_used?]
user[:password_last_used_days_ago] = ((Time.now - password_last_used) / (24*60*60)).to_i
Re-work unit tests for user and users (#125) * Constructor unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Constructor tests pass, all others gutted Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Basic 'where' test in place, no criteria Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Wired up filter table to backend list users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Unit testing for has_mfa_enabled and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Simple AWS client implementation for Users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Rework resource parameters and validation; copy in code from #121 Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add constructor tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add search/recall tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Recall unit tests pass Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for username and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_console_password works in unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled failing unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled passes unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for Access Keys Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * CLean up bad rebase commit Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Access keys property works, as an uncooked AWS response Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-linting Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests work Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove provider support libraries Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests pass for users resource Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-lint Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove aws connection load from user Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Adapt aws_iam_user to rely on AwsResourceMixin Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2017-12-08 18:34:09 +00:00
end
@table
end
def to_s
'IAM Users'
end
Re-work unit tests for user and users (#125) * Constructor unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Constructor tests pass, all others gutted Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Basic 'where' test in place, no criteria Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Wired up filter table to backend list users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Unit testing for has_mfa_enabled and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Simple AWS client implementation for Users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Rework resource parameters and validation; copy in code from #121 Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add constructor tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add search/recall tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Recall unit tests pass Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for username and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_console_password works in unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled failing unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled passes unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for Access Keys Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * CLean up bad rebase commit Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Access keys property works, as an uncooked AWS response Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-linting Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests work Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove provider support libraries Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests pass for users resource Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-lint Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove aws connection load from user Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Adapt aws_iam_user to rely on AwsResourceMixin Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2017-12-08 18:34:09 +00:00
#===========================================================================#
# Backend Implementation
#===========================================================================#
class Backend
class AwsClientApi < AwsBackendBase
BackendFactory.set_default_backend(self)
self.aws_client_class = Aws::IAM::Client
Re-work unit tests for user and users (#125) * Constructor unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Constructor tests pass, all others gutted Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Basic 'where' test in place, no criteria Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Wired up filter table to backend list users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Unit testing for has_mfa_enabled and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Simple AWS client implementation for Users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Rework resource parameters and validation; copy in code from #121 Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add constructor tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add search/recall tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Recall unit tests pass Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for username and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_console_password works in unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled failing unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled passes unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for Access Keys Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * CLean up bad rebase commit Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Access keys property works, as an uncooked AWS response Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-linting Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests work Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove provider support libraries Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests pass for users resource Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-lint Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove aws connection load from user Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Adapt aws_iam_user to rely on AwsResourceMixin Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2017-12-08 18:34:09 +00:00
# TODO: delegate this out
def list_users(query = {})
aws_service_client.list_users(query)
Re-work unit tests for user and users (#125) * Constructor unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Constructor tests pass, all others gutted Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Basic 'where' test in place, no criteria Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Wired up filter table to backend list users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Unit testing for has_mfa_enabled and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Simple AWS client implementation for Users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Rework resource parameters and validation; copy in code from #121 Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add constructor tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add search/recall tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Recall unit tests pass Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for username and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_console_password works in unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled failing unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled passes unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for Access Keys Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * CLean up bad rebase commit Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Access keys property works, as an uncooked AWS response Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-linting Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests work Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove provider support libraries Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests pass for users resource Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-lint Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove aws connection load from user Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Adapt aws_iam_user to rely on AwsResourceMixin Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2017-12-08 18:34:09 +00:00
end
def get_login_profile(query)
aws_service_client.get_login_profile(query)
Re-work unit tests for user and users (#125) * Constructor unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Constructor tests pass, all others gutted Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Basic 'where' test in place, no criteria Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Wired up filter table to backend list users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Unit testing for has_mfa_enabled and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Simple AWS client implementation for Users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Rework resource parameters and validation; copy in code from #121 Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add constructor tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add search/recall tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Recall unit tests pass Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for username and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_console_password works in unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled failing unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled passes unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for Access Keys Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * CLean up bad rebase commit Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Access keys property works, as an uncooked AWS response Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-linting Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests work Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove provider support libraries Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests pass for users resource Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-lint Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove aws connection load from user Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Adapt aws_iam_user to rely on AwsResourceMixin Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2017-12-08 18:34:09 +00:00
end
def list_mfa_devices(query)
aws_service_client.list_mfa_devices(query)
Re-work unit tests for user and users (#125) * Constructor unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Constructor tests pass, all others gutted Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Basic 'where' test in place, no criteria Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Wired up filter table to backend list users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Unit testing for has_mfa_enabled and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Simple AWS client implementation for Users Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Rework resource parameters and validation; copy in code from #121 Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add constructor tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Add search/recall tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Recall unit tests pass Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for username and has_console_password Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_console_password works in unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled failing unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * has_mfa_enabled passes unit tests Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Failing unit tests for Access Keys Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * CLean up bad rebase commit Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Access keys property works, as an uncooked AWS response Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-linting Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests work Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove provider support libraries Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Integration tests pass for users resource Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * De-lint Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Remove aws connection load from user Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com> * Adapt aws_iam_user to rely on AwsResourceMixin Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2017-12-08 18:34:09 +00:00
end
end
end
end