bluemix-go provides the Go implementation for operating the IBM Bluemix platform, which is based on the Cloud Foundry API.
- Install the SDK using the following command
go get github.com/IBM-Cloud/bluemix-go
- Update the SDK to the latest version using the following command
go get -u github.com/IBM-Cloud/bluemix-go
You must have a working Bluemix 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.
- IBMID - This is the IBM ID
- IBMID_PASSWORD - This is the password for the above ID
OR
- BM_API_KEY/BLUEMIX_API_KEY - This is the Bluemix API Key. Login to Bluemix to create one if you don't already have one. Follow Manage -> Account -> Users. Click on Bluemix API Keys
The default region is us_south. You can override it in the Config struct. You can also provide the value via environment variables; either via BM_REGION or BLUEMIX_REGION. Valid regions are -
- us-south
- eu-gb
- eu-de
- au-syd