diff --git a/plugins/modules/ec2_spot_instance_info.py b/plugins/modules/ec2_spot_instance_info.py index 9e5839a9232..e287d07697f 100644 --- a/plugins/modules/ec2_spot_instance_info.py +++ b/plugins/modules/ec2_spot_instance_info.py @@ -13,7 +13,6 @@ RETURN = ''' ''' - import time import datetime @@ -30,23 +29,36 @@ from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict from ansible_collections.amazon.aws.plugins.module_utils.core import is_boto3_error_code -def describe_spot_instance_requests(module,connection): +def describe_spot_instance_requests(connection, module): + + params = {} + + if module.params.get('filters'): + params['Filters'] = module.params.get('filters') + if module.params.get('dry_run'): + params['DryRun'] = module.params.get('dry_run') + if module.params.get('spot_instance_request_ids'): + params['SpotInstanceRequestIds'] = module.params.get('spot_instance_request_ids') + if module.params.get('next_token'): + params['NextToken'] = module.params.get('next_token') + if module.params.get('max_results'): + params['MaxResults'] = module.params.get('max_results') + pass def main(): argument_spec=dict( - filters=dict(default={}, type='list', elements='dict'), - dry_run_options = dict(type='bool'), - spot_instance_request__ids=dict(default=[], type='list', elements='str'), - next_token = dict(type='str'), + filters=dict(default=[], type='list', elements='dict'), + dry_run = dict(default=False, type='bool', choices=[True, False]), + spot_instance_request_ids=dict(default=[], type='list', elements='str'), + next_token = dict(default=None, type='str'), max_results = dict(type='int') ) module = AnsibleAWSModule( argument_spec=argument_spec, supports_check_mode=True ) - print(argument_spec) try: connection = module.client('ec2', retry_decorator=AWSRetry.jittered_backoff()) except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: @@ -55,4 +67,4 @@ def main(): describe_spot_instance_requests(connection, module) if __name__ == '__main__': - main() \ No newline at end of file + main()