-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tencent provider create-template #6898
Changes from 2 commits
07d141f
0b76f29
085c64d
378c3e6
7428966
57740c5
f219a13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.PHONY: all deps clean build | ||
all: deps clean build | ||
deps: | ||
go get github.com/tencentyun/scf-go-lib/cloudfunction | ||
|
||
clean: | ||
rm -rf ./index | ||
|
||
build: | ||
GOOS=linux GOARCH=amd64 go build -o ./index . |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Serverless directories | ||
.serverless | ||
|
||
# golang output binary directory | ||
bin | ||
|
||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"github.com/tencentyun/scf-go-lib/cloudfunction" | ||
) | ||
|
||
type DefineEvent struct { | ||
Key1 string `json:"key1"` | ||
Key2 string `json:"key2"` | ||
} | ||
|
||
func hello(ctx context.Context, event DefineEvent) (string, error) { | ||
fmt.Println("key1:", event.Key1) | ||
fmt.Println("key2:", event.Key2) | ||
return fmt.Sprintf("Hello World"), nil | ||
} | ||
|
||
func main() { | ||
cloudfunction.Start(hello) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "tencent-golang", | ||
"version": "1.0.0", | ||
"description": "Tencent Serverless Cloud Function example using Golang", | ||
"main": "index.go", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "cloud.tencent.com", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"serverless-tencent-scf": "*" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# 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: my-service # service name | ||
|
||
provider: # provider information | ||
name: tencent | ||
runtime: Go1 | ||
credentials: ~/credentials | ||
|
||
# you can overwrite defaults here | ||
# stage: dev | ||
# cosBucket: DEFAULT | ||
# role: QCS_SCFExcuteRole | ||
# memorySize: 256 | ||
# timeout: 10 | ||
# region: ap-shanghai | ||
# environment: | ||
# variables: | ||
# ENV_FIRST: env1 | ||
# ENV_SECOND: env2 | ||
|
||
plugins: | ||
- serverless-tencent-scf | ||
|
||
# you can add packaging information here | ||
#package: | ||
# exclude: | ||
# - ./** | ||
# include: | ||
# - ./bin/** | ||
|
||
|
||
functions: | ||
function_one: | ||
handler: main | ||
# description: Tencent Serverless Cloud Function | ||
# runtime: Go1 | ||
# memorySize: 256 | ||
# timeout: 10 | ||
# environment: | ||
# variables: | ||
# ENV_FIRST: env1 | ||
# ENV_Third: env2 | ||
# events: | ||
# - timer: | ||
# name: timer | ||
# parameters: | ||
# cronExpression: '*/5 * * * *' | ||
# enable: true | ||
# - cos: | ||
# name: cli-appid.cos.ap-beijing.myqcloud.com | ||
# parameters: | ||
# bucket: cli-appid.cos.ap-beijing.myqcloud.com | ||
# filter: | ||
# prefix: filterdir/ | ||
# suffix: .jpg | ||
# events: cos:ObjectCreated:* | ||
# enable: true | ||
# - apigw: | ||
# name: hello_world_apigw | ||
# parameters: | ||
# stageName: release | ||
# serviceId: | ||
# httpMethod: ANY | ||
# - cmq: | ||
# name: cmq_trigger | ||
# parameters: | ||
# name: test-topic-queue | ||
# enable: true | ||
# - ckafka: | ||
# name: ckafka_trigger | ||
# parameters: | ||
# name: ckafka-2o10hua5 | ||
# topic: test | ||
# maxMsgNum: 999 | ||
# offset: latest | ||
# enable: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# package directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Serverless directories | ||
.serverless |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
exports.main_handler = (event, context, callback) => { | ||
console.log("%j", event); | ||
callback(null, "Hello World"); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "tencent-nodejs", | ||
"version": "1.0.0", | ||
"description": "Tencent Serverless Cloud Function example using Nodejs", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "cloud.tencent.com", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"serverless-tencent-scf": "*" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# 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: my-service # service name | ||
|
||
provider: # provider information | ||
name: tencent | ||
runtime: Nodejs6.10 | ||
credentials: ~/credentials | ||
|
||
# you can overwrite defaults here | ||
# stage: dev | ||
# cosBucket: DEFAULT | ||
# role: QCS_SCFExcuteRole | ||
# memorySize: 256 | ||
# timeout: 10 | ||
# region: ap-shanghai | ||
# environment: | ||
# variables: | ||
# ENV_FIRST: env1 | ||
# ENV_SECOND: env2 | ||
|
||
plugins: | ||
- serverless-tencent-scf | ||
|
||
# you can add packaging information here | ||
#package: | ||
# include: | ||
# - include-me.js | ||
# - include-me-dir/** | ||
# exclude: | ||
# - exclude-me.js | ||
# - exclude-me-dir/** | ||
|
||
|
||
functions: | ||
function_one: | ||
handler: index.main_handler | ||
# description: Tencent Serverless Cloud Function | ||
# runtime: Nodejs6.10 | ||
# memorySize: 256 | ||
# timeout: 10 | ||
# environment: | ||
# variables: | ||
# ENV_FIRST: env1 | ||
# ENV_Third: env2 | ||
# events: | ||
# - timer: | ||
# name: timer | ||
# parameters: | ||
# cronExpression: '*/5 * * * *' | ||
# enable: true | ||
# - cos: | ||
# name: cli-appid.cos.ap-beijing.myqcloud.com | ||
# parameters: | ||
# bucket: cli-appid.cos.ap-beijing.myqcloud.com | ||
# filter: | ||
# prefix: filterdir/ | ||
# suffix: .jpg | ||
# events: cos:ObjectCreated:* | ||
# enable: true | ||
# - apigw: | ||
# name: hello_world_apigw | ||
# parameters: | ||
# stageName: release | ||
# serviceId: | ||
# httpMethod: ANY | ||
# - cmq: | ||
# name: cmq_trigger | ||
# parameters: | ||
# name: test-topic-queue | ||
# enable: true | ||
# - ckafka: | ||
# name: ckafka_trigger | ||
# parameters: | ||
# name: ckafka-2o10hua5 | ||
# topic: test | ||
# maxMsgNum: 999 | ||
# offset: latest | ||
# enable: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# package directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Serverless directories | ||
.serverless |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
exports.main_handler = async (event, context, callback) => { | ||
console.log("%j", event); | ||
return "hello world" | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "tencent-nodejs", | ||
"version": "1.0.0", | ||
"description": "Tencent Serverless Cloud Function example using Nodejs", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "cloud.tencent.com", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"serverless-tencent-scf": "*" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'll be good to pin it to current version so There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you. |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# 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: my-service # service name | ||
|
||
provider: # provider information | ||
name: tencent | ||
runtime: Nodejs8.9 | ||
credentials: ~/credentials | ||
|
||
# you can overwrite defaults here | ||
# stage: dev | ||
# cosBucket: DEFAULT | ||
# role: QCS_SCFExcuteRole | ||
# memorySize: 256 | ||
# timeout: 10 | ||
# region: ap-shanghai | ||
# environment: | ||
# variables: | ||
# ENV_FIRST: env1 | ||
# ENV_SECOND: env2 | ||
|
||
plugins: | ||
- serverless-tencent-scf | ||
|
||
# you can add packaging information here | ||
#package: | ||
# include: | ||
# - include-me.js | ||
# - include-me-dir/** | ||
# exclude: | ||
# - exclude-me.js | ||
# - exclude-me-dir/** | ||
|
||
|
||
functions: | ||
function_one: | ||
handler: index.main_handler | ||
# description: Tencent Serverless Cloud Function | ||
# runtime: Nodejs8.9 | ||
# memorySize: 256 | ||
# timeout: 10 | ||
# environment: | ||
# variables: | ||
# ENV_FIRST: env1 | ||
# ENV_Third: env2 | ||
# events: | ||
# - timer: | ||
# name: timer | ||
# parameters: | ||
# cronExpression: '*/5 * * * *' | ||
# enable: true | ||
# - cos: | ||
# name: cli-appid.cos.ap-beijing.myqcloud.com | ||
# parameters: | ||
# bucket: cli-appid.cos.ap-beijing.myqcloud.com | ||
# filter: | ||
# prefix: filterdir/ | ||
# suffix: .jpg | ||
# events: cos:ObjectCreated:* | ||
# enable: true | ||
# - apigw: | ||
# name: hello_world_apigw | ||
# parameters: | ||
# stageName: release | ||
# serviceId: | ||
# httpMethod: ANY | ||
# - cmq: | ||
# name: cmq_trigger | ||
# parameters: | ||
# name: test-topic-queue | ||
# enable: true | ||
# - ckafka: | ||
# name: ckafka_trigger | ||
# parameters: | ||
# name: ckafka-2o10hua5 | ||
# topic: test | ||
# maxMsgNum: 999 | ||
# offset: latest | ||
# enable: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Node.js v6 is already at EOL. Do you feel there's a value in providing template for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I have updated the template.