Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-05 21:32:59 +00:00
parent c7afdd237d
commit a64a7a6162
17 changed files with 757 additions and 757 deletions

View File

@@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api](
Endpoints:
## Describe
## Deploy
Get the info for a deployed function
Deploy a group of functions
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy)
```go
package example
@@ -21,23 +21,29 @@ import(
"go.m3o.com/function"
)
// Get the info for a deployed function
func DescribeFunctionStatus() {
// Deploy a group of functions
func DeployAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Describe(&function.DescribeRequest{
Name: "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)
}
```
## Regions
## Call
Return a list of supported regions
Call a function by name
[https://m3o.com/function/api#Regions](https://m3o.com/function/api#Regions)
[https://m3o.com/function/api#Call](https://m3o.com/function/api#Call)
```go
package example
@@ -49,11 +55,43 @@ import(
"go.m3o.com/function"
)
// Return a list of supported regions
func ListRegions() {
// Call a function by name
func CallAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Regions(&function.RegionsRequest{
rsp, err := functionService.Call(&function.CallRequest{
Name: "helloworld",
Request: map[string]interface{}{
"name": "Alice",
},
})
fmt.Println(rsp, err)
}
```
## Delete
Delete a function by name
[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Delete a function by name
func DeleteAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Delete(&function.DeleteRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
@@ -113,37 +151,6 @@ func ProxyUrl() {
})
fmt.Println(rsp, err)
}
```
## Call
Call a function by name
[https://m3o.com/function/api#Call](https://m3o.com/function/api#Call)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Call a function by name
func CallAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Call(&function.CallRequest{
Name: "helloworld",
Request: map[string]interface{}{
"name": "Alice",
},
})
fmt.Println(rsp, err)
}
```
## Update
@@ -201,12 +208,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
@@ -218,10 +225,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",
})
@@ -229,12 +236,12 @@ func DeleteAfunction() {
}
```
## Deploy
## Regions
Deploy a group of functions
Return a list of supported regions
[https://m3o.com/function/api#Deploy](https://m3o.com/function/api#Deploy)
[https://m3o.com/function/api#Regions](https://m3o.com/function/api#Regions)
```go
package example
@@ -246,18 +253,11 @@ import(
"go.m3o.com/function"
)
// Deploy a group of functions
func DeployAfunction() {
// Return a list of supported regions
func ListRegions() {
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.Regions(&function.RegionsRequest{
})
fmt.Println(rsp, err)