def mapping_details(client, module):
 lambda_facts = dict()
 params = dict()
 function_name = module.params.get('function_name')
 if function_name:
  params['FunctionName'] = module.params.get('function_name')
 if module.params.get('event_source_arn'):
  params['EventSourceArn'] = module.params.get('event_source_arn')
 if module.params.get('max_items'):
  params['MaxItems'] = module.params.get('max_items')
 if module.params.get('next_marker'):
  params['Marker'] = module.params.get('next_marker')
 try:
  lambda_facts.update(mappings=client.list_event_source_mappings(**params)['EventSourceMappings'])
 except ClientError as e:
  if (e.response['Error']['Code'] == 'ResourceNotFoundException'):
   lambda_facts.update(mappings=[])
  else:
   module.fail_json(msg='Unable to get source event mappings, error: {0}'.format(e))
 if function_name:
  return {function_name: camel_dict_to_snake_dict(lambda_facts)}
 return camel_dict_to_snake_dict(lambda_facts)

def mapping_details ( client , module ) : lambda_facts = dict ( ) params = dict ( ) function_name = module . params . get ( 'function_name' ) if function_name : params [ 'FunctionName' ] = module . params . get ( 'function_name' ) if module . params . get ( 'event_source_arn' ) : params [ 'EventSourceArn' ] = module . params . get ( 'event_source_arn' ) if module . params . get ( 'max_items' ) : params [ 'MaxItems' ] = module . params . get ( 'max_items' ) if module . params . get ( 'next_marker' ) : params [ 'Marker' ] = module . params . get ( 'next_marker' ) try : lambda_facts . update ( mappings = client . list_event_source_mappings ( ** params ) [ 'EventSourceMappings' ] ) except ClientError as e : if ( e . response [ 'Error' ] [ 'Code' ] == 'ResourceNotFoundException' ) : lambda_facts . update ( mappings = [ ] ) else : module . fail_json ( msg = 'Unable to get source event mappings, error: {0}' . format ( e ) ) if function_name : return { function_name : camel_dict_to_snake_dict ( lambda_facts ) } return camel_dict_to_snake_dict ( lambda_facts )
returns all lambda event source mappings .