Skip to content

Commit

Permalink
changes and fixes for private api
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerwelin committed May 5, 2020
1 parent 3386e0b commit 9d74648
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,22 @@ Alviss is built in Go; meaning no runtime or dependencies to install, just grab
Usage
--------

Example below shows how to generate a new serverless public api using node.js as target language for the Lambda function(s):
```bash
20:55 $ ./alviss new-api
NAME:
alviss new-api - Generates a new api project

USAGE:
alviss new-api [command options] [arguments...]

OPTIONS:
-p value, --project-name value name of your API project
-t value, --api-type value api type (only rest supported for now) (default: rest)
-e value, --api-endpoint value which endpoint type (either regional, edge or private) (default: regional)
-l value, --language value which language for lambda to be used (go, node, python, ruby) (default: node)
```

And example below shows how to generate a new serverless public api using node.js as target language for the Lambda function(s):

```bash
$ ./alviss new-api --project-name my-api-project --api-endpoint regional --language node
Expand Down
14 changes: 9 additions & 5 deletions tmpl-sam.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,28 @@ Resources:
Properties:
CodeUri: src/{{ .LambdaFunctionName }}/app/
{{ if and (eq .Language "python")}}Handler: app.handler
Runtime: python3.7{{ end }}{{ if and (eq .Language "ruby")}}Handler: app.handler
Runtime: ruby2.5{{ end }}{{ if and (eq .Language "node")}}Handler: index.handler
Runtime: nodejs10.x{{ end }}{{ if and (eq .Language "go")}}Handler: helloworld
Runtime: python3.8{{ end }}{{ if and (eq .Language "ruby")}}Handler: app.handler
Runtime: ruby2.7{{ end }}{{ if and (eq .Language "node")}}Handler: index.handler
Runtime: nodejs12.x{{ end }}{{ if and (eq .Language "go")}}Handler: helloworld
Runtime: go1.x{{ end }}{{ if and (eq .Language "java")}}Handler: com.api.HelloWorld
Runtime: java8{{ end }}
MemorySize: 512
Timeout: 5
Tracing: Active
Policies:
- AWSLambdaExecute
{{ if and (eq .APIEndpoints "private") }} - AWSLambdaVPCAccessExecutionRole{{ else }} - AWSLambdaExecute{{ end }}
Events:
AnyApi:
Type: Api
Properties:
RestApiId: !Ref AWSApi
Path: '/{{ .LambdaFunctionName }}'
Method: GET
{{ if and (eq .APIEndpoints "private") }} VpcConfig:
SecurityGroupIds:
- !GetAtt LambdaSecurityGroup.GroupId
SubnetIds: !Ref SubnetIDs
{{ end }}
Outputs:
ApiURL:
Expand Down

0 comments on commit 9d74648

Please sign in to comment.