Skip to content

Commit

Permalink
fixes in templates
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerwelin committed Feb 10, 2020
1 parent e9b4bd4 commit cadf474
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion new-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (tmpl *TmplData) bootstrapAPI() error {
}

green := color.New(color.FgGreen).SprintFunc()
fmt.Printf("Success! Created API GW project at %s\nInside that directory, you can run several commands:\n\n\t%s\n\t\tcreates a zip of your code and dependencies and uploads it to S3\n\t%s\n\t\tdeploys the specified CloudFormation/SAM template by creating and then executing a change set\n\nHowever I recommend taking a look at the README file first\n\n", green(tmpl.ApiProjectName+"/"), green("sam package --template-file apigw.yml --output-template-file out.yaml --s3-bucket Your-S3-bucket"), green("sam deploy --template-file ./out.yaml --stack-name your-api-project --capabilities CAPABILITY_IAM"))
fmt.Printf("Success! Created API GW project at %s\nInside that directory, you can run several commands:\n\n\t%s\n\t\tcreates a zip of your code and dependencies and uploads it to S3\n\t%s\n\t\tdeploys the specified CloudFormation/SAM template by creating and then executing a change set\n\nHowever I recommend taking a look at the README file first\n\n", green(tmpl.ApiProjectName+"/"), green("sam package --template-file apigw.yml --output-template-file out.yaml --s3-bucket Your-S3-bucket"), green("aws cloudformation deploy --template-file ./out.yaml --stack-name my-api-stack --capabilities CAPABILITY_IAM"))

return nil
}
2 changes: 1 addition & 1 deletion tmpl-readme.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $ sam package --template-file apigw.yml --output-template-file out.yaml --s3-bu
### Deploy the API
` + "```" + `bash
$ sam deploy --template-file ./out.yaml --stack-name your-api-project --capabilities CAPABILITY_IAM
$ aws cloudformation deploy --template-file ./out.yaml --stack-name your-api-project --capabilities CAPABILITY_IAM
` + "```" + `
Go to the AWS console > Cloudformation. Make sure the Cloudformations stack finishes. Take a look at the output to get the URL of your newly created API project. Either curl the address at the /hello endpoint or run the endpoint directly in the API Gateway console.
Expand Down
15 changes: 3 additions & 12 deletions tmpl-sam.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ Parameters:
Environment:
Description: name of the environment
Type: String
Default: test
AllowedValues: [test, prod]
{{ else }}
Parameters:
Environment:
Description: name of the environment
Type: String
Default: test
AllowedValues: [test, prod]
{{ end}}
Expand Down Expand Up @@ -149,25 +151,14 @@ Resources:
Tracing: Active
Policies:
- AWSLambdaExecute
Layers:
- !Ref HelloWorldLayer
Events:
AnyApi:
Type: Api
Properties:
RestApiId: !Ref AWSApi
Path: '/{{ .LambdaFunctionName }}/{userId}'
Path: '/{{ .LambdaFunctionName }}'
Method: GET
HelloWorldLayer:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: recommendations-deps
Description: Dependencies for HelloWorldFunction
ContentUri: src/{{ .LambdaFunctionName }}/dependencies/
CompatibleRuntimes:
- python3.7
RetentionPolicy: Retain
Outputs:
ApiURL:
Expand Down
2 changes: 1 addition & 1 deletion tmpl-swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ servers:
description: Production environment URL
paths:
/v1/{{ .LambdaFunctionName }}:
/{{ .LambdaFunctionName }}:
get:
summary: hello world endpoint
description: outputs hello world
Expand Down

0 comments on commit cadf474

Please sign in to comment.