Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/netscaler/adc-nitro-go
NITRO API SDK for Golang
https://github.com/netscaler/adc-nitro-go
Last synced: about 2 months ago
JSON representation
NITRO API SDK for Golang
- Host: GitHub
- URL: https://github.com/netscaler/adc-nitro-go
- Owner: netscaler
- License: apache-2.0
- Created: 2021-04-19T12:16:43.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-12T08:38:34.000Z (about 1 year ago)
- Last Synced: 2024-03-27T01:13:50.537Z (9 months ago)
- Language: Go
- Homepage:
- Size: 835 KB
- Stars: 11
- Watchers: 7
- Forks: 11
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go client for configuring Citrix ADC
## About
The Citrix®ADC® NITRO for GO allows you to configure and monitor the NetScaler appliance programmatically in GO based applications.
## Installation
- From github```
go get github.com/citrix/adc-nitro-go
```
- When downloaded from Citrix ADC GUIOnce you have a copy of the source archive unpacked into a similarly-named directory, run following command:
```
./install.sh
```
`install.sh` will copy the lib to `$GOPATH/src/github.com/citrix/adc-nitro-go`.## Usage
Import the SDK from github.com/citrix/adc-nitro-go/service. Config objects are available at github.com/citrix/adc-nitro-go/resource/config.
Instantiate a client using `NewNitroClient`. To initialize the client from environment variables:```
export NS_URL=http://
export NS_LOGIN=
export NS_PASSWORD=
```Config object types can be passed in as strings ("lbvserver"), or looked up from `service..Type()`.
The general pattern for NetScaler config objects is some combination of `AddResource`, `UpdateResource`, `BindResource`, `UnbindResource` and `DeleteResource`.Logging level can be set using env variable `NS_LOG` or calling function `client.SetLogLevel("debug")`.
## Example```
package mainimport (
"github.com/citrix/adc-nitro-go/resource/config/lb"
"github.com/citrix/adc-nitro-go/service"
)func main() {
client, _ := service.NewNitroClientFromEnv()
lb1 := lb.Lbvserver{
Name: "sample_lb",
Ipv46: "10.71.136.50",
Lbmethod: "ROUNDROBIN",
Servicetype: "HTTP",
Port: 8000,
}
_, err := client.AddResource(service.Lbvserver.Type(), "sample_lb", &lb1)
if err == nil {
client.SaveConfig()
}
}```
### Unit Tests
The unit tests are invoked with `make unit`. Note that they are actually functional tests and need a running NetScaler. The tests also need the environment variables `NS_URL`, `NS_LOGIN` and `NS_PASSWORD` to be set. Additionaly `NS_LOG` can be set for setting log level and `ADC_PLATFORM` to `CPX` for skipping some tests which don't work for CPX.### Using HTTPS
If you specify `https` in the URL then the client will use HTTPS. By default it will verify the presented certificate. If you want to use the default or self-signed certificates without verification, specify `sslVerify=false` in the constructor `NewNitroClientFromParams` or set the environment variable `NS_SSLVERIFY` to `false` and use the `NewNitroClientFromEnv` constructor