bluemix-go provides the Go implementation for operating the IBM Cloud platform, which is based on the Cloud Foundry API.
go get github.com/IBM-Cloud/bluemix-go
go get -u github.com/IBM-Cloud/bluemix-go
You must have a working IBM Cloud account to use the APIs. Sign up if you don't have one.
The SDK has examples
folder which cites few examples on how to use the SDK.
First you need to create a session.
import "github.com/IBM-Cloud/bluemix-go/session"
func main(){
s := session.New()
.....
}
Creating session in this way creates a default configuration which reads the value from the environment variables. You must export the following environment variables.
OR
The default region is _ussouth. You can override it in the Config struct. You can also provide the value via environment variables; either via _ICREGION or _IBMCLOUDREGION. Valid regions are -
The maximum retries is 3. You can override it in the Config struct. You can also provide the value via environment variable; via MAX_RETRIES
First, navigate to the IBM Cloud console and use the Manage toolbar to access IAM.
On the left, click "IBM Cloud API Keys"
Press "Create API Key"
Pick a name and description for your key
You have created a key! Press the eyeball to show the key. Copy or save it because keys can't be displayed or downloaded twice.