Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-16 09:26:30 +00:00
parent 8e78e3040b
commit 4cf3519856
19 changed files with 1009 additions and 1007 deletions

View File

@@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api](
Endpoints:
## Regions
## Describe
Return a list of supported regions
Get the info for a deployed function
[https://m3o.com/function/api#Regions](https://m3o.com/function/api#Regions)
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
```go
package example
@@ -21,11 +21,12 @@ import(
"go.m3o.com/function"
)
// Return a list of supported regions
func ListRegions() {
// Get the info for a deployed function
func DescribeFunctionStatus() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Regions(&function.RegionsRequest{
rsp, err := functionService.Describe(&function.DescribeRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
@@ -57,6 +58,62 @@ func ReserveAfunction() {
})
fmt.Println(rsp, err)
}
```
## Proxy
Return the backend url for proxying
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Return the backend url for proxying
func ProxyUrl() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Proxy(&function.ProxyRequest{
Id: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Update
Update a function. Downloads the source, builds and redeploys
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Update a function. Downloads the source, builds and redeploys
func UpdateAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Update(&function.UpdateRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Call
@@ -88,61 +145,6 @@ Request: map[string]interface{}{
})
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)
}
```
## 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
@@ -173,12 +175,12 @@ func DeleteAfunction() {
}
```
## Proxy
## Regions
Return the backend url for proxying
Return a list of supported regions
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
[https://m3o.com/function/api#Regions](https://m3o.com/function/api#Regions)
```go
package example
@@ -190,12 +192,11 @@ import(
"go.m3o.com/function"
)
// Return the backend url for proxying
func ProxyUrl() {
// Return a list of supported regions
func ListRegions() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Proxy(&function.ProxyRequest{
Id: "helloworld",
rsp, err := functionService.Regions(&function.RegionsRequest{
})
fmt.Println(rsp, err)
@@ -235,12 +236,12 @@ Subfolder: "examples/go-function",
}
```
## Update
## List
Update a function. Downloads the source, builds and redeploys
List all the deployed functions
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
[https://m3o.com/function/api#List](https://m3o.com/function/api#List)
```go
package example
@@ -252,12 +253,11 @@ import(
"go.m3o.com/function"
)
// Update a function. Downloads the source, builds and redeploys
func UpdateAfunction() {
// List all the deployed functions
func ListFunctions() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Update(&function.UpdateRequest{
Name: "helloworld",
rsp, err := functionService.List(&function.ListRequest{
})
fmt.Println(rsp, err)