From f3a5459c1996061cb9ded6f1b12b80148327e6ef Mon Sep 17 00:00:00 2001 From: FUJIWARA Shunichiro Date: Mon, 28 Oct 2019 23:19:44 +0900 Subject: [PATCH] update readme --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d87c685..af953e5 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ usage: lambroll [] [ ...] Flags: --help Show context-sensitive help (also try --help-long and --help-man). --region="ap-northeast-1" AWS region - --log-level="info" log level (debug, info, warn, error) + --log-level=info log level (trace, debug, info, warn, error) Commands: help [...] @@ -84,7 +84,16 @@ Commands: list functions deploy [] - deploy function + deploy or create function + + rollback [] + rollback function + + delete [] + delete function + + invoke [] + invoke function ``` ### Init @@ -128,6 +137,65 @@ Flags: - Excludes files matched (wildcard pattern) in `--exclude-file`. - Create / Update Lambda function. +### Rollback + +``` +usage: lambroll rollback [] + +rollback function + +Flags: + --help Show context-sensitive help (also try --help-long and --help-man). + --region="ap-northeast-1" AWS region + --log-level=info log level (trace, debug, info, warn, error) + --function="function.json" Function file path + --delete-version Delete rolled back version + --dry-run dry run +``` + +`lambroll deploy` create/update alias `current` to the published function version on deploy. + +`lambroll rollback` works as below. + +1. Find previous one version of function. +2. Update alias `current` to the previous version. +3. When `--delete-version` specified, delete old version of function. + +### Invoke + +``` +usage: lambroll invoke [] + +invoke function + +Flags: + --help Show context-sensitive help (also try --help-long and --help-man). + --region="ap-northeast-1" AWS region + --log-level=info log level (trace, debug, info, warn, error) + --function="function.json" Function file path + --async invocation type async + --log-tail output tail of log to STDERR +``` + +`lambroll invoke` accepts multiple JSON payloads for invocations from STDIN. + +Outputs from function are printed in STDOUT. + +```console +$ echo '{"foo":1}{"foo":2}' | lambroll invoke --log-tail +{"success": true, payload{"foo:1}} +2019/10/28 23:16:43 [info] StatusCode:200 ExecutionVersion:$LATEST +START RequestId: 60140e16-018e-41b1-bb46-3f021d4960c0 Version: $LATEST +END RequestId: 60140e16-018e-41b1-bb46-3f021d4960c0 +REPORT RequestId: 60140e16-018e-41b1-bb46-3f021d4960c0 Duration: 561.77 ms Billed Duration: 600 ms Memory Size: 128 MB Max Memory Used: 50 MB +{"success": true, payload:{"foo":2}} +2019/10/28 23:16:43 [info] StatusCode:200 ExecutionVersion:$LATEST +START RequestId: dcc584f5-ceaf-4109-b405-8e59ca7ae92f Version: $LATEST +END RequestId: dcc584f5-ceaf-4109-b405-8e59ca7ae92f +REPORT RequestId: dcc584f5-ceaf-4109-b405-8e59ca7ae92f Duration: 597.87 ms Billed Duration: 600 ms Memory Size: 128 MB Max Memory Used: 50 MB +2019/10/28 23:16:43 [info] completed +``` + #### function.json function.json is a definition for Lambda function. JSON structure is same as `CreateFunction` for Lambda API.