(ctx)
Print a status of this Lambda function
Print a status of this Lambda function
Print a status of this Lambda function
def status(ctx):
    """Print a status of this Lambda function"""
    status = ctx.status()
    click.echo(click.style('Policy', bold=True))
    if status['policy']:
        line = '    {} ({})'.format(
            status['policy']['PolicyName'],
            status['policy']['Arn'])
        click.echo(click.style(line, fg='green'))
    click.echo(click.style('Role', bold=True))
    if status['role']:
        line = '    {} ({})'.format(
            status['role']['RoleName'],
            status['role']['Arn'])
        click.echo(click.style(line, fg='green'))
    click.echo(click.style('Function', bold=True))
    if status['function']:
        line = '    {} ({})'.format(
            status['function']['Configuration']['FunctionName'],
            status['function']['Configuration']['FunctionArn'])
        click.echo(click.style(line, fg='green'))
    else:
        click.echo(click.style('    None', fg='green'))
    click.echo(click.style('Event Sources', bold=True))
    if status['event_sources']:
        for event_source in status['event_sources']:
            if event_source:
                arn = event_source.get('EventSourceArn')
                state = event_source.get('State', 'Enabled')
                line = '    {}: {}'.format(arn, state)
                click.echo(click.style(line, fg='green'))
            else:
                click.echo(click.style('    None', fg='green'))
def status ( ctx ) : status = ctx . status ( ) click . echo ( click . style ( 'Policy' , bold = True ) ) if status [ 'policy' ] : line = '    {} ({})' . format ( status [ 'policy' ] [ 'PolicyName' ] , status [ 'policy' ] [ 'Arn' ] ) click . echo ( click . style ( line , fg = 'green' ) ) click . echo ( click . style ( 'Role' , bold = True ) ) if status [ 'role' ] : line = '    {} ({})' . format ( status [ 'role' ] [ 'RoleName' ] , status [ 'role' ] [ 'Arn' ] ) click . echo ( click . style ( line , fg = 'green' ) ) click . echo ( click . style ( 'Function' , bold = True ) ) if status [ 'function' ] : line = '    {} ({})' . format ( status [ 'function' ] [ 'Configuration' ] [ 'FunctionName' ] , status [ 'function' ] [ 'Configuration' ] [ 'FunctionArn' ] ) click . echo ( click . style ( line , fg = 'green' ) ) else : click . echo ( click . style ( '    None' , fg = 'green' ) ) click . echo ( click . style ( 'Event Sources' , bold = True ) ) if status [ 'event_sources' ] : for event_source in status [ 'event_sources' ] : if event_source : arn = event_source . get ( 'EventSourceArn' ) state = event_source . get ( 'State' , 'Enabled' ) line = '    {}: {}' . format ( arn , state ) click . echo ( click . style ( line , fg = 'green' ) ) else : click . echo ( click . style ( '    None' , fg = 'green' ) )