Function service (#227)

This commit is contained in:
Janos Dobronszki
2021-10-11 11:54:53 +01:00
committed by GitHub
parent ee1674dda6
commit 599b418c20
36 changed files with 1988 additions and 41 deletions

View File

@@ -0,0 +1,9 @@
curl "https://api.m3o.com/v1/function/Deploy" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{
"entrypoint": "helloworld",
"name": "my-first-func",
"project": "tests",
"repo": "github.com/crufter/gcloud-nodejs-test"
}'

View File

@@ -0,0 +1,19 @@
package example
import (
"fmt"
"github.com/micro/services/clients/go/function"
"os"
)
// Deploy a group of functions
func DeployAfunction() {
functionService := function.NewFunctionService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := functionService.Deploy(&function.DeployRequest{
Entrypoint: "helloworld",
Name: "my-first-func",
Project: "tests",
Repo: "github.com/crufter/gcloud-nodejs-test",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,15 @@
import * as fx from "m3o/function";
// Deploy a group of functions
async function DeployAfunction() {
let functionService = new fx.FunctionService(process.env.MICRO_API_TOKEN);
let rsp = await functionService.deploy({
entrypoint: "helloworld",
name: "my-first-func",
project: "tests",
repo: "github.com/crufter/gcloud-nodejs-test",
});
console.log(rsp);
}
await DeployAfunction();