efs_facts: Documentation update (#46826)

* Update pydoc
* Update module documentation and example
* Add aliases for name as creation_token

Fixes: #28738

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2018-10-16 00:16:24 +05:30 committed by Ryan Brown
commit 871dd77f2b

View file

@ -16,7 +16,7 @@ DOCUMENTATION = '''
module: efs_facts module: efs_facts
short_description: Get information about Amazon EFS file systems short_description: Get information about Amazon EFS file systems
description: description:
- Module searches Amazon EFS file systems - This module can be used to search Amazon EFS file systems.
version_added: "2.2" version_added: "2.2"
requirements: [ boto3 ] requirements: [ boto3 ]
author: author:
@ -25,35 +25,33 @@ options:
name: name:
description: description:
- Creation Token of Amazon EFS file system. - Creation Token of Amazon EFS file system.
aliases: [ creation_token ]
id: id:
description: description:
- ID of Amazon EFS. - ID of Amazon EFS.
tags: tags:
description: description:
- List of tags of Amazon EFS. Should be defined as dictionary - List of tags of Amazon EFS. Should be defined as dictionary.
targets: targets:
description: description:
- list of targets on which to filter the returned results - List of targets on which to filter the returned results.
- result must match all of the specified targets, each of which can be - Result must match all of the specified targets, each of which can be a security group ID, a subnet ID or an IP address.
a security group ID, a subnet ID or an IP address
extends_documentation_fragment: extends_documentation_fragment:
- aws - aws
- ec2 - ec2
''' '''
EXAMPLES = ''' EXAMPLES = '''
# find all existing efs - name: Find all existing efs
- efs_facts: efs_facts:
register: result register: result
- efs_facts: - name: Find efs using id
name: myTestNameTag efs_facts:
- efs_facts:
id: fs-1234abcd id: fs-1234abcd
# Searching all EFS instances with tag Name = 'myTestNameTag', in subnet 'subnet-1a2b3c4d' and with security group 'sg-4d3c2b1a' - name: Searching all EFS instances with tag Name = 'myTestNameTag', in subnet 'subnet-1a2b3c4d' and with security group 'sg-4d3c2b1a'
- efs_facts: efs_facts:
tags: tags:
name: myTestNameTag name: myTestNameTag
targets: targets:
@ -174,6 +172,7 @@ except ImportError:
from ansible.module_utils.aws.core import AnsibleAWSModule from ansible.module_utils.aws.core import AnsibleAWSModule
from ansible.module_utils.ec2 import boto3_conn, get_aws_connection_info, ec2_argument_spec, AWSRetry from ansible.module_utils.ec2 import boto3_conn, get_aws_connection_info, ec2_argument_spec, AWSRetry
from ansible.module_utils.ec2 import camel_dict_to_snake_dict, boto3_tag_list_to_ansible_dict from ansible.module_utils.ec2 import camel_dict_to_snake_dict, boto3_tag_list_to_ansible_dict
from ansible.module_utils._text import to_native
class EFSConnection(object): class EFSConnection(object):
@ -189,7 +188,7 @@ class EFSConnection(object):
**aws_connect_params) **aws_connect_params)
self.module = module self.module = module
except Exception as e: except Exception as e:
module.fail_json(msg="Failed to connect to AWS: %s" % str(e)) module.fail_json(msg="Failed to connect to AWS: %s" % to_native(e))
self.region = region self.region = region
@ -352,7 +351,7 @@ def main():
argument_spec = ec2_argument_spec() argument_spec = ec2_argument_spec()
argument_spec.update(dict( argument_spec.update(dict(
id=dict(), id=dict(),
name=dict(), name=dict(aliases=['creation_token']),
tags=dict(type="dict", default={}), tags=dict(type="dict", default={}),
targets=dict(type="list", default=[]) targets=dict(type="list", default=[])
)) ))