How to access files in container in Object Storage Service in Bluemix?

谁说我不能喝 提交于 2019-12-23 05:10:06

问题


  1. How can I access files by url in Bluemix Object Storage?
  2. Is there a way to make the container public?
  3. How can I access the file in Object Storage just by typing the url in the browser?
  4. How can I retrieve an image by url to display it in html?

回答1:


You can create a temporary URLs using the swift command line to provide public access to your Object Storage files.

First you have to set the swift CLI, you can find steps on this link.

After you have swift cli configured for your environment you can run the following commands to create temporary URLs for your files:

swift stat

to locate your account field (starts with AUTH_)

swift post -m "Temp-URL-Key:<key>"

to set a secret key

 swift stat

to verify a secret key was created

swift tempurl GET <seconds> <path> <key>

to create the temporary URL

You can then access the file via the following URL:

https://<access point>/<API version>/AUTH_<project ID>/<container namespace>/<object namespace>

Complete details are available in the Object Storage documentation here.




回答2:


I wrote a comment on that here : Public URLs For Objects In Bluemix Object Storage Service BlueMix is still using swift but S3 API is the most reliable.

So to answere your questions :

How can I access files by url in Bluemix Object Storage?

after uploading an image ( for example), you have to use a tool that can access your image and make it public ( it will add a public acl in the properity of the object ). you can use Cloudberry for example or S3 Browser and use the functionality " make public ".

Is there a way to make the container public?

Your contenair will run in bluemix, but the service can create a public URL. yes.

How can I access the file in Object Storage just by typing the url in the browser?

here is an example of an image I made public on my object store : https://s3-api.dal-us-geo.objectstorage.softlayer.net/mourad-bucket-rasp-1/OBAMA.jpg You can do this using any browser after adding the acl to "public read" ( again, if you use python and boto3 sdk, see my post here : Public URLs For Objects In Bluemix Object Storage Service )

How can I retrieve an image by url to display it in html?

Several way to do that, since, it has now a public Url and the first part of the ul will not change, only name of your object will change, just call your URL using variable ( like bucket, names etc.. )

the complete API reference has been released and it is Here




回答3:


Finally these too commands saved the day

First use swift and change access control of container

swift post container-name --read-acl ".r:*,.rlistings"

Next Using Curl Configure Container to a particular Url for accessing Files

curl -X GET " https://<access point>/<version>/AUTH_projectID/container-name" -H "X-Auth-Token:<auth token>"     -H "X-Container-Read: .r:*,.rlistings"

And also very grateful for the help provided by Alex da Silva



来源:https://stackoverflow.com/questions/39679478/how-to-access-files-in-container-in-object-storage-service-in-bluemix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!