diff --git a/plugins/modules/iam_access_key.py b/plugins/modules/iam_access_key.py index 32220a216e3..af472fbe8c6 100644 --- a/plugins/modules/iam_access_key.py +++ b/plugins/modules/iam_access_key.py @@ -1,19 +1,18 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- + # Copyright (c) 2021 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function -__metaclass__ = type - - -DOCUMENTATION = r''' +DOCUMENTATION = r""" --- module: iam_access_key version_added: 2.1.0 short_description: Manage AWS IAM User access keys description: - Manage AWS IAM user access keys. -author: Mark Chappell (@tremble) +author: + - Mark Chappell (@tremble) options: user_name: description: @@ -54,12 +53,12 @@ default: false extends_documentation_fragment: -- amazon.aws.aws -- amazon.aws.ec2 -- amazon.aws.boto3 -''' + - amazon.aws.common.modules + - amazon.aws.region.modules + - amazon.aws.boto3 +""" -EXAMPLES = r''' +EXAMPLES = r""" # Note: These examples do not set authentication details, see the AWS Guide for details. - name: Create a new access key @@ -72,9 +71,9 @@ user_name: example_user id: AKIA1EXAMPLE1EXAMPLE state: absent -''' +""" -RETURN = r''' +RETURN = r""" access_key: description: A dictionary containing all the access key information. returned: When the key exists. @@ -117,7 +116,7 @@ returned: When a key was deleted during the rotation of access keys type: str sample: AKIA1EXAMPLE1EXAMPLE -''' +""" try: import botocore @@ -126,11 +125,12 @@ from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict +from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code +from ansible_collections.amazon.aws.plugins.module_utils.botocore import normalize_boto3_result +from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry +from ansible_collections.amazon.aws.plugins.module_utils.transformation import scrub_none_parameters + from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -from ansible_collections.amazon.aws.plugins.module_utils.core import is_boto3_error_code -from ansible_collections.amazon.aws.plugins.module_utils.core import normalize_boto3_result -from ansible_collections.amazon.aws.plugins.module_utils.core import scrub_none_parameters -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry def delete_access_key(access_keys, user, access_key_id): diff --git a/plugins/modules/iam_access_key_info.py b/plugins/modules/iam_access_key_info.py index 9d7363b420a..6573e657a18 100644 --- a/plugins/modules/iam_access_key_info.py +++ b/plugins/modules/iam_access_key_info.py @@ -1,12 +1,10 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- + # Copyright (c) 2021 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import, division, print_function -__metaclass__ = type - - -DOCUMENTATION = r''' +DOCUMENTATION = r""" --- module: iam_access_key_info version_added: 2.1.0 @@ -14,7 +12,8 @@ description: - 'Fetches information AWS IAM user access keys.' - 'Note: It is not possible to fetch the secret access key.' -author: Mark Chappell (@tremble) +author: + - Mark Chappell (@tremble) options: user_name: description: @@ -24,20 +23,20 @@ aliases: ['username'] extends_documentation_fragment: -- amazon.aws.aws -- amazon.aws.ec2 -- amazon.aws.boto3 -''' + - amazon.aws.common.modules + - amazon.aws.region.modules + - amazon.aws.boto3 +""" -EXAMPLES = r''' +EXAMPLES = r""" # Note: These examples do not set authentication details, see the AWS Guide for details. - name: Fetch Access keys for a user community.aws.iam_access_key_info: user_name: example_user -''' +""" -RETURN = r''' +RETURN = r""" access_key: description: A dictionary containing all the access key information. returned: When the key exists. @@ -67,7 +66,7 @@ returned: success type: str sample: Inactive -''' +""" try: import botocore @@ -76,9 +75,10 @@ from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict +from ansible_collections.amazon.aws.plugins.module_utils.botocore import normalize_boto3_result +from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry + from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -from ansible_collections.amazon.aws.plugins.module_utils.core import normalize_boto3_result -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry def get_access_keys(user):