src/account_inventory.py
def run_lambda_function(awsAccountArray, lambdaFunction):
    """
    Invokes the Lambda Function that evaluates key rotation.

    :return Response from Invoke command.
    """
    for account in awsAccountArray:
        # skip accounts that are suspended
        if account['Status'] != 'ACTIVE':
            continue
        jsonPayload = {
            "account": account['Id'],
            "name": account['Name'],
            "email": account['Email']
        }
        lambdaPayloadEncoded = json.dumps(jsonPayload).encode('utf-8')
        try:
            response = lambda_client.invoke(
                FunctionName=lambdaFunction, InvocationType='Event',
                Payload=lambdaPayloadEncoded)
            lambdaPayloadEncoded_str = str(lambdaPayloadEncoded)
            log.info(f'Invoked: FunctionName= {lambdaFunction},'
                     f' InvocationType=Event,'
                     f' Payload= {lambdaPayloadEncoded_str}')
        except lambda_client.exceptions.ClientError as error:
            log.error(f'Error: {error}')
    return response

    Invokes the Lambda Function that evaluates key rotation.

    :return Response from Invoke command.
    
Invokes the Lambda Function that evaluates key rotation.
:return Response from Invoke command.
Invokes the Lambda Function that evaluates key rotation . : return Response from Invoke command .
def run_lambda_function(awsAccountArray, lambdaFunction):
    for account in awsAccountArray:
        if account['Status'] != 'ACTIVE':
            continue
        jsonPayload = {
            "account": account['Id'],
            "name": account['Name'],
            "email": account['Email']
        }
        lambdaPayloadEncoded = json.dumps(jsonPayload).encode('utf-8')
        try:
            response = lambda_client.invoke(
                FunctionName=lambdaFunction, InvocationType='Event',
                Payload=lambdaPayloadEncoded)
            lambdaPayloadEncoded_str = str(lambdaPayloadEncoded)
            log.info(f'Invoked: FunctionName= {lambdaFunction},'
                     f' InvocationType=Event,'
                     f' Payload= {lambdaPayloadEncoded_str}')
        except lambda_client.exceptions.ClientError as error:
            log.error(f'Error: {error}')
    return response
def run_lambda_function ( awsAccountArray , lambdaFunction ) : for account in awsAccountArray : if account [ 'Status' ] != 'ACTIVE' : continue jsonPayload = { "account" : account [ 'Id' ] , "name" : account [ 'Name' ] , "email" : account [ 'Email' ] } lambdaPayloadEncoded = json . dumps ( jsonPayload ) . encode ( 'utf-8' ) try : response = lambda_client . invoke ( FunctionName = lambdaFunction , InvocationType = 'Event' , Payload = lambdaPayloadEncoded ) lambdaPayloadEncoded_str = str ( lambdaPayloadEncoded ) log . info ( f'Invoked: FunctionName= {lambdaFunction},' f' InvocationType=Event,' f' Payload= {lambdaPayloadEncoded_str}' ) except lambda_client . exceptions . ClientError as error : log . error ( f'Error: {error}' ) return response
Invokes the Lambda Function that evaluates key rotation.
Invokes the Lambda Function that evaluates key rotation .
"""
    Invokes the Lambda Function that evaluates key rotation.

    :return Response from Invoke command.
    """ # skip accounts that are suspended
awsAccountArray
lambdaFunction