How to use the mangum.platforms.aws.helpers.get_config function in mangum

To help you get started, we’ve selected a few mangum examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github erm / mangum / mangum / platforms / aws / commands.py View on Github external
def update() -> None:
    """
    Update the application files only.
    """
    config, error = get_config()
    if error is not None:
        click.echo(error)
    else:
        click.echo("Updating the application build.")
        config.build(update=True)
        click.echo("Update complete!")
github erm / mangum / mangum / platforms / aws / commands.py View on Github external
def deploy() -> None:
    config, error = get_config()
    if error is not None:
        click.echo(error)
    else:
        click.echo("Deploying your application! This may take some time...")
        deployed = config.cli_deploy()
        if not deployed:
            click.echo("There was an error...")
        else:
            endpoints = config.cli_describe()
            click.echo(
                f"Deployment successful! API endpoints available at:\n\n{endpoints}"
            )
github erm / mangum / mangum / platforms / aws / commands.py View on Github external
def tail() -> None:
    config, error = get_config()
    if error is not None:
        click.echo(error)
    else:
        # Display the CloudWatch logs for the last 10 minutes.
        # TODO: Make this configurable.
        log_events = get_log_events(
            f"/aws/lambda/{config.resource_name}Function", minutes=10
        )
        log_output = []
        for log in log_events:
            message = log["message"].rstrip()
            if not any(
                i in message
                for i in ("START RequestId", "REPORT RequestId", "END RequestId")
            ):
                timestamp = log["timestamp"]
github erm / mangum / mangum / platforms / aws / commands.py View on Github external
def validate() -> None:
    config, error = get_config()
    if error is not None:
        click.echo(error)
    else:
        error = config.validate()
        if not error:
            click.echo("Template file validated successfully!")
        else:
            click.echo(error)
github erm / mangum / mangum / platforms / aws / commands.py View on Github external
def build() -> None:
    """
    Install the packages listed in the requirements file and copy the application files
    to the 'build/' directory to prepare for packaging.
    """
    config, error = get_config()
    if error is not None:
        click.echo(error)
    else:
        click.echo("Building application and installing requirements...")
        config.build()
        click.echo("Build complete!")
github erm / mangum / mangum / platforms / aws / commands.py View on Github external
def describe() -> None:
    config, error = get_config()
    if error is not None:
        click.echo(error)
    else:
        endpoints = config.cli_describe()
        if not endpoints:
            click.echo("Error! Could not retrieve endpoints.")
        else:
            click.echo(f"API endpoints available at:\n\n{endpoints}")
github erm / mangum / mangum / platforms / aws / commands.py View on Github external
def package() -> None:
    config, error = get_config()
    if error is not None:
        click.echo(error)
    else:
        click.echo("Packaging your application...")
        packaged = config.cli_package()
        if not packaged:
            click.echo("There was an error...")
        else:
            click.echo(
                "Successfully packaged. Run 'mangum aws deploy' to deploy it now."
            )