The power-go-client project provides the Go SDK for IBM® Power Systems™ Virtual Server.
- An IBM Cloud Account
- An IBM Cloud IAM API key or Token allow the SDK to access your account
- Go 1.20+
Install the SDK using the following methods.
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
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.
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
.
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,
}
s, err := ibmpisession.NewIBMPISession(o)
.....
}
Type IBMPIOptions
required fields:
Authenticator
: Please check https://github.com/IBM/go-sdk-core/blob/main/Authentication.md for different options available for authenticating API calls.UserAccount
: Account ID of the Power Cloud Service Instance.Zone
: Location of the Power Cloud Service Instance.
Other optional fields:
Debug
: Enable/Disable http transport debugging log.Region
: Region of the Power Cloud Service Instance. This is used for generating the default service URL. Deprecated: The region and endpoint is auto generated based onZone
.URL
: Power Virtual Server host or URL endpoint. By default it usespower-iaas.cloud.ibm.com
. In case of test environment you can set the value topower-iaas.test.cloud.ibm.com
. You can also use env variableIBMCLOUD_POWER_API_ENDPOINT
. Note that the region value is prepended to the host string if not present eg:<region>.power-iaas.cloud.ibm.com
.
Also you can refer to the examples directory for some resources that shows how to use the SDK.
If you encounter an issue with the project please report here..
This section contains some steps required by the dev for contributing changes to the SDK.
- Install the latest go-swagger version on your machine.
- Download the last released version of the service broker API definitions (
swagger.yaml
). - Run
./bin/update-swagger.sh
from the project root.