Generating temporary URLs for Bluemix Object Storage
How to use Swift client to generate temporary URL for GET and PUT to Bluemix
Add Object Storage Service
Setup Swift Client
Swift requires some environment variables set to use. You can get the values
by looking at the Environment section of your provisioned Object Storage
Service VCAP_SERVICES variable for userid, password, and project ID.
Create a Container
Upload via Temporary URL
Instead of using swift upload mycontainer myfile to upload you can create a
temporary URL to give someone to upload without giving out the user ID and
password. It is temporary access to upload (PUT) or download (GET).
First we need to set a Temp-URL-Key for the account:
Here I created a script to demonstrate how to use a generate PUT tempurl.
Save as tmpput.sh
Download via Temporary URL
Same as upload we generate a temporary URL for the GET with an expiration time
Save snippet as tmpget.sh
You should see the contents from mycontainer/tmpurl.sh displayed on the screen.