Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-02 10:29:34 +00:00
parent b7853960a4
commit 9057f09e41
26 changed files with 1293 additions and 1293 deletions

View File

@@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/function/api](
Endpoints:
## Update
## Regions
Update a function. Downloads the source, builds and redeploys
Return a list of supported regions
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
[https://m3o.com/function/api#Regions](https://m3o.com/function/api#Regions)
```go
package example
@@ -21,10 +21,65 @@ import(
"go.m3o.com/function"
)
// Update a function. Downloads the source, builds and redeploys
func UpdateAfunction() {
// Return a list of supported regions
func ListRegions() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Update(&function.UpdateRequest{
rsp, err := functionService.Regions(&function.RegionsRequest{
})
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)
}
```
## 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",
})
@@ -63,12 +118,12 @@ Request: map[string]interface{}{
}
```
## Describe
## List
Get the info for a deployed function
List all the deployed functions
[https://m3o.com/function/api#Describe](https://m3o.com/function/api#Describe)
[https://m3o.com/function/api#List](https://m3o.com/function/api#List)
```go
package example
@@ -80,23 +135,22 @@ import(
"go.m3o.com/function"
)
// Get the info for a deployed function
func DescribeFunctionStatus() {
// List all the deployed functions
func ListFunctions() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.Describe(&function.DescribeRequest{
Name: "helloworld",
rsp, err := functionService.List(&function.ListRequest{
})
fmt.Println(rsp, err)
}
```
## 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
@@ -108,11 +162,12 @@ 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{
rsp, err := functionService.Reserve(&function.ReserveRequest{
Name: "helloworld",
})
fmt.Println(rsp, err)
@@ -180,12 +235,12 @@ Subfolder: "examples/go-function",
}
```
## List
## Update
List all the deployed functions
Update a function. Downloads the source, builds and redeploys
[https://m3o.com/function/api#List](https://m3o.com/function/api#List)
[https://m3o.com/function/api#Update](https://m3o.com/function/api#Update)
```go
package example
@@ -197,65 +252,10 @@ import(
"go.m3o.com/function"
)
// List all the deployed functions
func ListFunctions() {
// Update a function. Downloads the source, builds and redeploys
func UpdateAfunction() {
functionService := function.NewFunctionService(os.Getenv("M3O_API_TOKEN"))
rsp, err := functionService.List(&function.ListRequest{
})
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)
}
```
## 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",
})