IBM Cloud SDK for Power Cloud
The power-go-client project provides the Go SDK for IBM® Power Systems™ Virtual Server.
Prerequisites
Install
Install the SDK using the following methods.
go get command
Use this command to download and install the SDK to allow your Go application to use it:
go get -u github.com/IBM-Cloud/power-go-client
Go modules
If your application is using Go modules, you can add a suitable import to your Go application, like this:
import (
"github.com/IBM-Cloud/power-go-client"
)
then run go mod tidy to download and install the new dependency and update your Go application's
go.mod file.
dep dependency manager
If your application is using the dep dependency management tool, you can add a dependency
to your Gopkg.toml file. Here is an example:
[[constraint]]
name = "github.com/IBM-Cloud/power-go-client"
version = "1.1.0"
then run dep ensure.
Usage
First you need to create a session and use it for creating the client.
import "github.com/IBM-Cloud/power-go-client/ibmpisession"
func main(){
o := &ibmpisession.IBMPIOptions{
Authenticator: authenticator,
UserAccount: accountID,
Zone: zone,
URL: url,
}
s, err := ibmpisession.NewIBMPISession(o)
.....
}
authenticator: Please check https://github.com/IBM/go-sdk-core/blob/main/Authentication.md for different options available for authenticating API calls.
accountID: Account id of the Power Cloud Service Instance
zone: Zone of the Power Cloud Service Instance
url: Power Virtual Server host or URL endpoint. You can also set env variable IBMCLOUD_POWER_API_ENDPOINT.
Also you can refer to the examples directory for some resources that shows how to use the SDK.
Issues
If you encounter an issue with the project please report here..
Development
This section contains some steps required by the dev for contributing changes to the SDK.
Update the power directory
- Install the latest go-swagger version on your machine.
- Download the last released version of the service broker API definitions (
swagger.yaml).
- Remove existing files under
power directory rm -r ./power/models/ && rm -rf ./power/client/.
- Generate the client
swagger generate client -f swagger.yaml -t ./power/
- Remove the unused files
rm ./power/models/user_access.go && rm ./power/models/principal.go