Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-19 20:47:51 +00:00
parent 3c113f0f22
commit f1290e2b67
25 changed files with 1249 additions and 1249 deletions

View File

@@ -38,12 +38,12 @@ Subfolder: "examples/go-function",
}
```
## Reserve
## Update
Reserve function names and resources beyond free quota
Update a function. Downloads the source, builds and redeploys
[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve)
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
```go
package example
@@ -55,10 +55,10 @@ import(
"go.m3o.com/function"
)
// Reserve function names and resources beyond free quota
func ReserveAfunction() {
// Update a function. Downloads the source, builds and redeploys
func UpdateAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Reserve(&function.ReserveRequest{
rsp, err := functionService.Update(&function.UpdateRequest{
Name: "helloworld",
})
@@ -66,12 +66,12 @@ func ReserveAfunction() {
}
```
## Proxy
## List
Return the backend url for proxying
List all the deployed functions
[https://m3o.com/function/api#Proxy](https://m3o.com/function/api#Proxy)
[https://m3o.com/function/api#List](https://m3o.com/function/api#List)
```go
package example
@@ -83,12 +83,11 @@ import(
"go.m3o.com/function"
)
// Return the backend url for proxying
func ProxyUrl() {
// List all the deployed functions
func ListFunctions() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Proxy(&function.ProxyRequest{
Id: "helloworld",
rsp, err := functionService.List(&function.ListRequest{
})
fmt.Println(rsp, err)
@@ -120,34 +119,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
@@ -177,12 +148,12 @@ func ListRegions() {
}
```
## Update
## Reserve
Update a function. Downloads the source, builds and redeploys
Reserve function names and resources beyond free quota
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve)
```go
package example
@@ -194,10 +165,10 @@ import(
"go.m3o.com/function"
)
// Update a function. Downloads the source, builds and redeploys
func UpdateAfunction() {
// Reserve function names and resources beyond free quota
func ReserveAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Update(&function.UpdateRequest{
rsp, err := functionService.Reserve(&function.ReserveRequest{
Name: "helloworld",
})
@@ -236,12 +207,12 @@ Request: map[string]interface{}{
}
```
## 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
@@ -253,11 +224,40 @@ 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)
}
```
## 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)