Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-06 19:14:19 +00:00
parent 3abd701901
commit 709e4180ec
24 changed files with 1269 additions and 1269 deletions

View File

@@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api](
Endpoints:
## Regions
## Reserve
Return a list of supported regions
Reserve function names and resources beyond free quota
[https://m3o.com/function/api#Regions](https://m3o.com/function/api#Regions)
[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve)
```go
package example
@@ -21,44 +21,11 @@ import(
"go.m3o.com/function"
)
// Return a list of supported regions
func ListRegions() {
// Reserve function names and resources beyond free quota
func ReserveAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Regions(&function.RegionsRequest{
})
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",
rsp, err := functionService.Reserve(&function.ReserveRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
@@ -120,12 +87,12 @@ func ListFunctions() {
}
```
## Delete
## Regions
Delete a function by name
Return a list of supported regions
[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete)
[https://m3o.com/function/api#Regions](https://m3o.com/function/api#Regions)
```go
package example
@@ -137,12 +104,11 @@ import(
"go.m3o.com/function"
)
// Delete a function by name
func DeleteAfunction() {
// Return a list of supported regions
func ListRegions() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Delete(&function.DeleteRequest{
Name: "helloworld",
rsp, err := functionService.Regions(&function.RegionsRequest{
})
fmt.Println(rsp, err)
@@ -174,6 +140,68 @@ func DescribeFunctionStatus() {
})
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)
}
```
## 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
@@ -207,12 +235,12 @@ Request: map[string]interface{}{
}
```
## Reserve
## Delete
Reserve function names and resources beyond free quota
Delete a function by name
[https://m3o.com/function/api#Reserve](https://m3o.com/function/api#Reserve)
[https://m3o.com/function/api#Delete](https://m3o.com/function/api#Delete)
```go
package example
@@ -224,10 +252,10 @@ import(
"go.m3o.com/function"
)
// Reserve function names and resources beyond free quota
func ReserveAfunction() {
// Delete a function by name
func DeleteAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Reserve(&function.ReserveRequest{
rsp, err := functionService.Delete(&function.DeleteRequest{
Name: "helloworld",
})
@@ -235,31 +263,3 @@ func ReserveAfunction() {
}
```
## 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)
}
```