Some checks failed
Go Tests / go-tests (push) Failing after 1m15s
Introduce a new EdgeConnect client to interact with the platform's API. Includes methods to: - Retrieve authentication tokens. - Create new app instances. - Create new apps. Defines necessary data structures for API payloads, such as app and instance keys, flavors, and configurations. Also adds an example implementation in a separate main package for demonstration purposes. Refs: IPCEICIS-5755
42 lines
955 B
Go
42 lines
955 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"net/http"
|
|
"os"
|
|
|
|
"edp.buildth.ing/DevFW-CICD/garm-provider-edge-connect/internal/client"
|
|
)
|
|
|
|
func main() {
|
|
ctx := context.TODO()
|
|
e := client.EdgeConnect{
|
|
BaseURL: "https://mc.orca.platform.mg3.mdb.osc.live",
|
|
HttpClient: &http.Client{},
|
|
}
|
|
token, err := e.RetrieveToken(ctx, os.Getenv("EDGEXR_USERNAME"), os.Getenv("EDGEXR_PASSWORD"))
|
|
fmt.Printf("Token: %v\n", token)
|
|
fmt.Printf("Error: %v\n", err)
|
|
err = e.NewAppInstance(ctx, client.NewAppInstanceInput{
|
|
Region: "us-west",
|
|
AppInst: client.AppInstance{
|
|
Key: client.AppInstanceKey{
|
|
Organization: "my-org",
|
|
Name: "my-app-instance",
|
|
CloudletKey: client.CloudletKey{
|
|
Organization: "my-org",
|
|
Name: "my-cloudlet",
|
|
},
|
|
},
|
|
AppKey: client.AppKey{
|
|
Organization: "my-org",
|
|
Name: "my-app",
|
|
},
|
|
Flavor: client.Flavor{
|
|
Name: "default",
|
|
},
|
|
},
|
|
})
|
|
fmt.Printf("Error: %v\n", err)
|
|
}
|