Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-21 11:44:41 +00:00
parent f78928459e
commit 6c61a79774
23 changed files with 1215 additions and 1215 deletions

View File

@@ -4,6 +4,40 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api](
Endpoints:
## Deploy
Deploy a group of functions
[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Deploy a group of functions
func DeployAfunction() {
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",
})
fmt.Println(rsp, err)
}
```
## Update
Update a function. Downloads the source, builds and redeploys
@@ -59,12 +93,12 @@ func ListFunctions() {
}
```
## Delete
## Describe
Delete a function by name
Get the info for a deployed function
[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete)
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
```go
package example
@@ -76,10 +110,10 @@ import(
"go.m3o.com/function"
)
// Delete a function by name
func DeleteAfunction() {
// Get the info for a deployed function
func DescribeFunctionStatus() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Delete(&function.DeleteRequest{
rsp, err := functionService.Describe(&function.DescribeRequest{
Name: "helloworld",
})
@@ -141,40 +175,6 @@ func ProxyUrl() {
})
fmt.Println(rsp, err)
}
```
## Deploy
Deploy a group of functions
[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Deploy a group of functions
func DeployAfunction() {
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",
})
fmt.Println(rsp, err)
}
```
## Call
@@ -208,12 +208,12 @@ Request: map[string]interface{}{
}
```
## Describe
## Delete
Get the info for a deployed function
Delete a function by name
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete)
```go
package example
@@ -225,10 +225,10 @@ import(
"go.m3o.com/function"
)
// Get the info for a deployed function
func DescribeFunctionStatus() {
// Delete a function by name
func DeleteAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Describe(&function.DescribeRequest{
rsp, err := functionService.Delete(&function.DeleteRequest{
Name: "helloworld",
})