This Go library enables access to the Cloud Connexa API, as detailed in the Cloud Connexa API Documentation.
To install the cloudconnexa-go-client, ensure you are using a modern Go release that supports module mode. With Go set up, execute the following command:
go get github.com/openvpn/cloudconnexa-go-client/v2/cloudconnexa
In your Go project, you can use the library by importing it as follows:
import "github.com/openvpn/cloudconnexa-go-client/v2/cloudconnexa"
Instantiate a new CloudConnexa client. Subsequently, utilize the diverse services provided by the client to interact with distinct segments of the CloudConnexa API. For instance:
client := cloudconnexa.NewClient("api_url", "client_id", "client_secret")
// List connectors
connectors, _, err := client.Connectors.List()
For auth need to pass three parameters:
- client_id
- client_secret
- api_url (example:
https://myorg.api.openvpn.com
)
package main
import (
"fmt"
"log"
"github.com/openvpn/cloudconnexa-go-client/v2/cloudconnexa"
)
func main() {
client, err := cloudconnexa.NewClient("api_url", "client_id", "client_secret")
if err != nil {
log.Fatalf("error creating client: %v", err)
}
networkId := "your_network_id"
routes, err := client.Routes.List(networkId)
if err != nil {
log.Fatalf("error getting routes: %v", err)
}
fmt.Println("Received routes:", routes)
}