Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

HewlettPackard/hpe-onesphere-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

Make calls to the OneSphere API

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

example output

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

Disconnect from the OneSphere server

osClient.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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages