def version_details(client, module):
 lambda_facts = dict()
 function_name = module.params.get('function_name')
 if function_name:
  params = dict()
  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(versions=client.list_versions_by_function(FunctionName=function_name, **params)['Versions'])
  except ClientError as e:
   if (e.response['Error']['Code'] == 'ResourceNotFoundException'):
    lambda_facts.update(versions=[])
   else:
    module.fail_json(msg='Unable to get {0} versions, error: {1}'.format(function_name, e))
 else:
  module.fail_json(msg='Parameter function_name required for query=versions.')
 return {function_name: camel_dict_to_snake_dict(lambda_facts)}

def version_details ( client , module ) : lambda_facts = dict ( ) function_name = module . params . get ( 'function_name' ) if function_name : params = dict ( ) 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 ( versions = client . list_versions_by_function ( FunctionName = function_name , ** params ) [ 'Versions' ] ) except ClientError as e : if ( e . response [ 'Error' ] [ 'Code' ] == 'ResourceNotFoundException' ) : lambda_facts . update ( versions = [ ] ) else : module . fail_json ( msg = 'Unable to get {0} versions, error: {1}' . format ( function_name , e ) ) else : module . fail_json ( msg = 'Parameter function_name required for query=versions.' ) return { function_name : camel_dict_to_snake_dict ( lambda_facts ) }
returns all lambda function versions .