-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…-deployment [GH-1] Basic first example of the go lambda function deployment in snowflake
- Loading branch information
Showing
6 changed files
with
1,153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
lambda-go/.serverless | ||
lambda-go/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module lambda-golang | ||
|
||
go 1.16 | ||
|
||
require github.com/aws/aws-lambda-go v1.23.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | ||
github.com/aws/aws-lambda-go v1.23.0 h1:Vjwow5COkFJp7GePkk9kjAo/DyX36b7wVPKwseQZbRo= | ||
github.com/aws/aws-lambda-go v1.23.0/go.mod h1:jJmlefzPfGnckuHdXX7/80O3BvUUi12XOkbv4w9SGLU= | ||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= | ||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= | ||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= | ||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | ||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ= | ||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/aws/aws-lambda-go/events" | ||
"github.com/aws/aws-lambda-go/lambda" | ||
) | ||
|
||
func handleRequest(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { | ||
|
||
jsonMock := "{'data': [[0, 'test-value']]}" | ||
return events.APIGatewayProxyResponse{Body: string(jsonMock), StatusCode: 200}, nil | ||
} | ||
func main() { | ||
lambda.Start(handleRequest) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
# Welcome to Serverless! | ||
# | ||
# This file is the main config file for your service. | ||
# It's very minimal at this point and uses default values. | ||
# You can always add more config options for more control. | ||
# We've included some commented out config examples here. | ||
# Just uncomment any of them to get that config option. | ||
# | ||
# For full config options, check the docs: | ||
# docs.serverless.com | ||
# | ||
# Happy Coding! | ||
|
||
service: lambda-go | ||
# app and org for use with dashboard.serverless.com | ||
#app: your-app-name | ||
#org: your-org-name | ||
|
||
# You can pin your service to only deploy with a specific Serverless version | ||
# Check out our docs for more details | ||
# frameworkVersion: "=X.X.X" | ||
|
||
plugins: | ||
- serverless-snowflake-external-function-plugin | ||
|
||
package: | ||
include: | ||
- ./bin/** | ||
|
||
|
||
provider: | ||
name: aws | ||
runtime: go1.x | ||
|
||
# you can overwrite defaults here | ||
# stage: dev | ||
region: eu-west-1 | ||
|
||
|
||
custom: | ||
snowflake: | ||
role: "" | ||
account: "" | ||
username: "" | ||
password: "" | ||
warehouse: "" | ||
database: "" | ||
schema: "" | ||
|
||
# you can add statements to the Lambda function's IAM Role here | ||
# iamRoleStatements: | ||
# - Effect: "Allow" | ||
# Action: | ||
# - "s3:ListBucket" | ||
# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] } | ||
# - Effect: "Allow" | ||
# Action: | ||
# - "s3:PutObject" | ||
# Resource: | ||
# Fn::Join: | ||
# - "" | ||
# - - "arn:aws:s3:::" | ||
# - "Ref" : "ServerlessDeploymentBucket" | ||
# - "/*" | ||
|
||
# you can define service wide environment variables here | ||
# environment: | ||
# variable1: value1 | ||
|
||
# you can add packaging information here | ||
#package: | ||
# include: | ||
# - include-me.js | ||
# - include-me-dir/** | ||
# exclude: | ||
# - exclude-me.js | ||
# - exclude-me-dir/** | ||
|
||
functions: | ||
lambda-go: | ||
handler: bin/lambda-go | ||
|
||
# Every function that should be available as external function in snowflake needs | ||
# at least argument_signature and data_type information | ||
snowflake: | ||
argument_signature: () | ||
data_type: variant | ||
|
||
# The following are a few example events you can configure | ||
# NOTE: Please make sure to change your handler code to work with those events | ||
# Check the event documentation for details | ||
events: | ||
- http: | ||
path: / | ||
method: POST | ||
authorizer: aws_iam | ||
# - websocket: $connect | ||
# - s3: ${env:BUCKET} | ||
# - schedule: rate(10 minutes) | ||
# - sns: greeter-topic | ||
# - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000 | ||
# - alexaSkill: amzn1.ask.skill.xx-xx-xx-xx | ||
# - alexaSmartHome: amzn1.ask.skill.xx-xx-xx-xx | ||
# - iot: | ||
# sql: "SELECT * FROM 'some_topic'" | ||
# - cloudwatchEvent: | ||
# event: | ||
# source: | ||
# - "aws.ec2" | ||
# detail-type: | ||
# - "EC2 Instance State-change Notification" | ||
# detail: | ||
# state: | ||
# - pending | ||
# - cloudwatchLog: '/aws/lambda/hello' | ||
# - cognitoUserPool: | ||
# pool: MyUserPool | ||
# trigger: PreSignUp | ||
# - alb: | ||
# listenerArn: arn:aws:elasticloadbalancing:us-east-1:XXXXXX:listener/app/my-load-balancer/50dc6c495c0c9188/ | ||
# priority: 1 | ||
# conditions: | ||
# host: example.com | ||
# path: /hello | ||
|
||
# Define function environment variables here | ||
# environment: | ||
# variable2: value2 | ||
|
||
# you can add CloudFormation resource templates here | ||
#resources: | ||
# Resources: | ||
# NewResource: | ||
# Type: AWS::S3::Bucket | ||
# Properties: | ||
# BucketName: my-new-bucket | ||
# Outputs: | ||
# NewOutput: | ||
# Description: "Description for the output" | ||
# Value: "Some output value" |
Oops, something went wrong.