Bluemix object storage - what's the difference

2019-08-01 02:56发布

问题:

I'm trying to figure out how to use the Bluemix Object Storage V2 service. I'm looking at the documentation at

https://www.ng.bluemix.net/docs/#services/ObjectStorageV2/index.html#gettingstarted

This documentation makes a fundamental distinction between an "unbound context" and a "bound context", without really explaining what this means. What does this mean? And why am I forced into choosing between one means of interaction vs the other?

As a followon question: For the "Unbound Context", the documentation states "To view the cloud credentials, go to the drop-down in the service dashboard."

What "drop down" in which "service dashboard"? Can you please be more specific?

回答1:

By 'unbound context' it means the details you need to connect to the ObjectStorage(v2) service if you are accessing it from a non Bluemix application or a Bluemix application that doesn't have the service bound to it. Conversely a 'bound context' is for when your Bluemix app is bound to that service.

When you are in the 'bound context' you will use the VCAP_SERVICES properties to look up a property called auth_url which, when called, will return the object storage credentials you need to access the service. These are the same credentials you would get if you were in the 'unbound context'.

The service dashboard it talks about is the dashboard you see on console.ng.bluemix.net (or console.eu-gb.bluemix.net) when you click on your provisioned service. Here is an example of mine:

If you are looking for an example of how to use the ObjectStorage (v2) service in a 'bound context' then have a look at my github project here https://github.com/whitfiea/bluemix-objectstorage-v2. For an 'unbound context', i.e., another app outside of Bluemix, you can use the code from this point onwards but you need to somehow provide your app with the credentials mentioned in the drop-down in the service dashboard (hardcoded or env properties etc)



标签: ibm-cloud