-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3555e1a
commit e7c0231
Showing
2 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,61 @@ | ||
# CloudConnexa Go Client | ||
|
||
This Go library enables access to the CloudConnexa API, as detailed in the [CloudConnexa API Documentation](https://openvpn.net/cloud-docs/developer/cloudconnexa-api.html). | ||
|
||
## Installation Instructions | ||
|
||
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: | ||
|
||
```sh | ||
go get github.com/openvpn/cloudconnexa-go-client/v2/cloudconnexa | ||
``` | ||
|
||
## How to Use | ||
|
||
In your Go project, you can use the library by importing it as follows: | ||
|
||
```go | ||
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: | ||
|
||
```go | ||
client := cloudconnexa.NewClient("api_url", "client_id", "client_secret") | ||
|
||
// List connectors | ||
connectors, _, err := client.Connectors.List(ctx, nil) | ||
``` | ||
|
||
## Authentication | ||
|
||
For auth need to pass three parameters: | ||
1. client_id | ||
2. client_secret | ||
3. api_url (example: `https://myorg.api.openvpn.com`) | ||
|
||
```go | ||
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) | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters