github.com/IBM-Cloud/bluemix-go@v0.0.0-20240423071914-9e96525baef4/README.md (about) 1 # IBM Cloud SDK for Go 2 3 [](https://travis-ci.org/IBM-Cloud/bluemix-go) [](https://godoc.org/github.com/IBM-Cloud/bluemix-go) 4 5 bluemix-go provides the Go implementation for operating the IBM Cloud platform, which is based on the [Cloud Foundry API][cloudfoundry_api]. 6 7 ## Installing 8 9 1. Install the SDK using the following command 10 11 ```bash 12 go get github.com/IBM-Cloud/bluemix-go 13 ``` 14 15 2. Update the SDK to the latest version using the following command 16 17 ```bash 18 go get -u github.com/IBM-Cloud/bluemix-go 19 ``` 20 21 22 ## Using the SDK 23 24 You must have a working IBM Cloud account to use the APIs. [Sign up][ibmcloud_signup] if you don't have one. 25 26 The SDK has ```examples``` folder which cites few examples on how to use the SDK. 27 First you need to create a session. 28 29 ```go 30 import "github.com/IBM-Cloud/bluemix-go/session" 31 32 func main(){ 33 34 s := session.New() 35 ..... 36 } 37 ``` 38 39 Creating session in this way creates a default configuration which reads the value from the environment variables. 40 You must export the following environment variables. 41 * IBMID - This is the IBM ID 42 * IBMID_PASSWORD - This is the password for the above ID 43 44 OR 45 46 * IC_API_KEY/IBMCLOUD_API_KEY - This is the Bluemix API Key. Login to [IBMCloud][ibmcloud_login] to create one if you don't already have one. See instructions below for creating an API Key. 47 48 The default region is _us_south_. You can override it in the [Config struct][ibmcloud_go_config]. You can also provide the value via environment variables; either via _IC_REGION_ or _IBMCLOUD_REGION_. Valid regions are - 49 * us-south 50 * us-east 51 * eu-gb 52 * eu-de 53 * au-syd 54 * jp-tok 55 56 The maximum retries is 3. You can override it in the [Config struct][ibmcloud_go_config]. You can also provide the value via environment variable; via MAX_RETRIES 57 58 ## Creating an IBM Cloud API Key 59 60 First, navigate to the IBM Cloud console and use the Manage toolbar to access IAM. 61 62  63 64 On the left, click "IBM Cloud API Keys" 65 66  67 68 Press "Create API Key" 69 70  71 72 Pick a name and description for your key 73 74  75 76 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. 77 78  79 80 81 [ibmcloud_signup]: https://console.ng.bluemix.net/registration/?target=%2Fdashboard%2Fapps 82 [ibmcloud_login]: https://console.ng.bluemix.net 83 [ibmcloud_go_config]: https://godoc.org/github.com/IBM-Cloud/bluemix-go#Config 84 [cloudfoundry_api]: https://apidocs.cloudfoundry.org/264/