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
- Complete Cloud Connexa API coverage
- Pagination support
- Rate limiting
- Automatic token management
- Concurrent safe
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)
}
network := cloudconnexa.Network{
Name: "test-network",
Description: "Test network created via API",
InternetAccess: cloudconnexa.InternetAccessSplitTunnelOn,
Egress: false,
}
createdNetwork, err := client.Networks.Create(network)
// List all users
users, err := client.Users.List("", "")
// Create a new user
user := cloudconnexa.User{
Username: "testuser",
Email: "[email protected]",
GroupID: "group-id",
}
createdUser, err := client.Users.Create(user)
// List all VPN regions
regions, err := client.VPNRegions.List()
if err != nil {
log.Fatalf("error getting VPN regions: %v", err)
}
// Get specific region by ID
region, err := client.VPNRegions.GetByID("region-id")
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
This project is licensed under the Apache License - see the LICENSE file for details.
For security issues, please email [email protected] instead of posting a public issue on GitHub.