Skip to content

m3o-apis/function-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Function

An m3o.com API. For example usage see m3o.com/Function/api.

Endpoints:

Call

Call a function by name

https://m3o.com/function/api#Call

package example

import(
	"fmt"
	"os"

	"github.com/micro/services/clients/go/function"
)

// Call a function by name
func CallAfunction() {
	functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := functionService.Call(&function.CallRequest{
		Name: "my-first-func",
Request: map[string]interface{}{
},

	})
	fmt.Println(rsp, err)
}

List

List all the deployed functions

https://m3o.com/function/api#List

package example

import(
	"fmt"
	"os"

	"github.com/micro/services/clients/go/function"
)

// List all the deployed functions
func ListFunctions() {
	functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := functionService.List(&function.ListRequest{
		
	})
	fmt.Println(rsp, err)
}

Delete

Delete a function by name

https://m3o.com/function/api#Delete

package example

import(
	"fmt"
	"os"

	"github.com/micro/services/clients/go/function"
)

// Delete a function by name
func DeleteAfunction() {
	functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := functionService.Delete(&function.DeleteRequest{
		Name: "my-first-func",
Project: "tests",

	})
	fmt.Println(rsp, err)
}

Describe

Get the info for a deployed function

https://m3o.com/function/api#Describe

package example

import(
	"fmt"
	"os"

	"github.com/micro/services/clients/go/function"
)

// Get the info for a deployed function
func DescribeFunctionStatus() {
	functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := functionService.Describe(&function.DescribeRequest{
		Name: "my-first-func",
Project: "tests",

	})
	fmt.Println(rsp, err)
}

Deploy

Deploy a group of functions

https://m3o.com/function/api#Deploy

package example

import(
	"fmt"
	"os"

	"github.com/micro/services/clients/go/function"
)

// Deploy a group of functions
func DeployAfunction() {
	functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := functionService.Deploy(&function.DeployRequest{
		Entrypoint: "helloworld",
Name: "my-first-func",
Project: "tests",
Repo: "github.com/m3o/nodejs-function-example",
Runtime: "nodejs14",

	})
	fmt.Println(rsp, err)
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages