No description, website, or topics provided.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
sample
.gitignore
LICENSE
README.md
deployment.go
onesphere.go
onesphere_test.go
patch_op.go
server.go

README.md

Go bindings for HPE OneSphere APIs

Prerequisites

go1.9.2 and above. You can install the latest version from:

https://golang.org/dl

Usage

Install the OneSphere package

go get github.com/HewlettPackard/hpe-onesphere-go

Import the package

import (
  "fmt"
  "github.com/HewlettPackard/hpe-onesphere-go"
)

Connect to the OneSphere server

oneSphere, err := onesphere.Connect("https://onesphere-host-url", "username", "password")

Make calls to the OneSphere API

fmt.Println("Status:", oneSphere.GetStatus())

example output

{"service":"OK","database":""}

Disconnect from the OneSphere server

oneSphere.Disconnect()

Full Example

see sample/main.go

Run the sample project

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

Run the tests

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

APIs

All the APIs return data in JSON format the same as those returned from HPE OneSphere composable APIs.

Not Implemented Yet

Some APIs are not yet implemented.