go1.9.2 and above. You can install the latest version from:
go get github.com/HewlettPackard/hpe-onesphere-go
import (
"fmt"
"github.com/HewlettPackard/hpe-onesphere-go"
)
osClient, err := onesphere.Connect("https://onesphere-host-url", "username", "password")
fmt.Println("Status:", osClient.GetStatus())
example output
{"service":"OK","database":""}
osClient.Disconnect()
see sample/main.go
go get
the OneSphere project
go get github.com/HewlettPackard/hpe-onesphere-go
You must set the OneSphere host
url, user
, and password
flags.
Replace these values:
ONESPHERE_HOST_URL
YOUR_ONESPHERE_USERNAME
YOUR_ONESPHERE_PASSWORD
go run $GOPATH/src/github.com/HewlettPackard/hpe-onesphere-go/sample/main.go \
-host=https://ONESPHERE_HOST_URL \
-user=YOUR_ONESPHERE_USERNAME \
-password=YOUR_ONESPHERE_PASSWORD
alternatively use environment variables
host=https://ONESPHERE_HOST_URL \
user=YOUR_ONESPHERE_USERNAME \
password=YOUR_ONESPHERE_PASSWORD \
go run $GOPATH/src/github.com/HewlettPackard/hpe-onesphere-go/sample/main.go
http requests are not mocked, a valid OneSphere account is required to pass tests
go get
the OneSphere project
go get github.com/HewlettPackard/hpe-onesphere-go
go test github.com/HewlettPackard/hpe-onesphere-go \
-host=https://ONESPHERE_HOST_URL \
-user=YOUR_ONESPHERE_USERNAME \
-password=YOUR_ONESPHERE_PASSWORD
or use environment variables
host=https://ONESPHERE_HOST_URL \
user=YOUR_ONESPHERE_USERNAME \
password=YOUR_ONESPHERE_PASSWORD \
go test github.com/HewlettPackard/hpe-onesphere-go
All the APIs return data in JSON format the same as those returned from HPE OneSphere composable APIs.
Some APIs are not yet implemented.