Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-03-02 10:19:39 +00:00
parent fd8353bc9c
commit ddef868d22
27 changed files with 1129 additions and 1129 deletions

View File

@@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api](
Endpoints:
## List
## Describe
List all the deployed functions
Get the info for a deployed function
[https://m3o.com/function/api#List](https://m3o.com/function/api#List)
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
```go
package example
@@ -21,11 +21,12 @@ import(
"go.m3o.com/function"
)
// List all the deployed functions
func ListFunctions() {
// Get the info for a deployed function
func DescribeFunctionStatus() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.List(&function.ListRequest{
rsp, err := functionService.Describe(&function.DescribeRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
@@ -58,12 +59,12 @@ func ListRuntimes() {
}
```
## Proxy
## Deploy
Return the backend url for proxying
Deploy a group of functions
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy)
```go
package example
@@ -75,11 +76,17 @@ import(
"go.m3o.com/function"
)
// Return the backend url for proxying
func ProxyUrl() {
// Deploy a group of functions
func DeployAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Proxy(&function.ProxyRequest{
Id: "helloworld",
rsp, err := functionService.Deploy(&function.DeployRequest{
Branch: "main",
Entrypoint: "Helloworld",
Name: "helloworld",
Region: "europe-west1",
Repo: "https://github.com/m3o/m3o",
Runtime: "go116",
Subfolder: "examples/go-function",
})
fmt.Println(rsp, err)
@@ -143,6 +150,33 @@ Request: map[string]interface{}{
})
fmt.Println(rsp, err)
}
```
## List
List all the deployed functions
[https://m3o.com/function/api#List](https://m3o.com/function/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/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
@@ -171,34 +205,6 @@ func DeleteAfunction() {
})
fmt.Println(rsp, err)
}
```
## Describe
Get the info for a deployed function
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/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: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Regions
@@ -256,12 +262,12 @@ func ReserveAfunction() {
}
```
## Deploy
## Proxy
Deploy a group of functions
Return the backend url for proxying
[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy)
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
```go
package example
@@ -273,17 +279,11 @@ import(
"go.m3o.com/function"
)
// Deploy a group of functions
func DeployAfunction() {
// Return the backend url for proxying
func ProxyUrl() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Deploy(&function.DeployRequest{
Branch: "main",
Entrypoint: "Helloworld",
Name: "helloworld",
Region: "europe-west1",
Repo: "https://github.com/m3o/m3o",
Runtime: "go116",
Subfolder: "examples/go-function",
rsp, err := functionService.Proxy(&function.ProxyRequest{
Id: "helloworld",
})
fmt.Println(rsp, err)