forked from nficano/python-lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda
More file actions
executable file
·46 lines (33 loc) · 1.2 KB
/
lambda
File metadata and controls
executable file
·46 lines (33 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import click
import aws_lambda
import logging
CURRENT_DIR = os.getcwd()
logging.getLogger('pip').setLevel(logging.CRITICAL)
@click.group()
def cli():
pass
@click.command(help="Create a new function for Lambda.")
def init():
aws_lambda.init(CURRENT_DIR)
@click.command(help="Bundles package for deployment.")
@click.option('--local-package', default=None, help='Install local package as well.', type=click.Path())
def build(local_package):
aws_lambda.build(CURRENT_DIR, local_package)
@click.command(help="Run a local test of your function.")
@click.option('--event-file', default=None, help='Alternate event file.')
@click.option('--verbose', '-v', is_flag=True)
def invoke(event_file, verbose):
aws_lambda.invoke(CURRENT_DIR, event_file, verbose)
@click.command(help="Register and deploy your code to lambda.")
@click.option('--local-package', default=None, help='Install local package as well.', type=click.Path())
def deploy(local_package):
aws_lambda.deploy(CURRENT_DIR, local_package)
if __name__ == '__main__':
cli.add_command(init)
cli.add_command(invoke)
cli.add_command(deploy)
cli.add_command(build)
cli()