Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-14 16:40:54 +00:00
parent 63fb62a55e
commit 9685cb5d53
25 changed files with 1145 additions and 1145 deletions

View File

@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api](
Endpoints:
## 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)
}
```
## Deploy
Deploy a group of functions
@@ -66,12 +38,12 @@ Subfolder: "examples/go-function",
}
```
## Describe
## Update
Get the info for a deployed function
Update a function. Downloads the source, builds and redeploys
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
```go
package example
@@ -83,38 +55,10 @@ import(
"go.m3o.com/function"
)
// Get the info for a deployed function
func DescribeFunctionStatus() {
// Update a function. Downloads the source, builds and redeploys
func UpdateAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Describe(&function.DescribeRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```
## Reserve
Reserve function names and resources beyond free quota
[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Reserve function names and resources beyond free quota
func ReserveAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Reserve(&function.ReserveRequest{
rsp, err := functionService.Update(&function.UpdateRequest{
Name: "helloworld",
})
@@ -177,12 +121,12 @@ func ListRegions() {
}
```
## Update
## Proxy
Update a function. Downloads the source, builds and redeploys
Return the backend url for proxying
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
```go
package example
@@ -194,11 +138,11 @@ import(
"go.m3o.com/function"
)
// Update a function. Downloads the source, builds and redeploys
func UpdateAfunction() {
// Return the backend url for proxying
func ProxyUrl() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Update(&function.UpdateRequest{
Name: "helloworld",
rsp, err := functionService.Proxy(&function.ProxyRequest{
Id: "helloworld",
})
fmt.Println(rsp, err)
@@ -263,3 +207,59 @@ func ListFunctions() {
}
```
## 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)
}
```
## Reserve
Reserve function names and resources beyond free quota
[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/function"
)
// Reserve function names and resources beyond free quota
func ReserveAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Reserve(&function.ReserveRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
}
```