如何设置公共Google Cloud Storage存储桶 [英] How do I setup a public Google Cloud Storage bucket

查看:127
本文介绍了如何设置公共Google Cloud Storage存储桶的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将文件上传到Google Cloud Storage上的存储桶中,但是我在弄清楚如何对其进行设置以使其可公开写入和读取时遇到了麻烦.换句话说,我不需要非要经过用户身份验证才能上传到存储桶.有人知道要进行设置的步骤吗?

I am trying to upload files to a bucket on Google Cloud Storage, but I am having trouble figuring out how to set it up so that it is publicly writable and readable. In other words, I don't want to have to require authentication from the user in order to upload to the bucket. Does anybody know the steps to follow in order to set this up?

我还想知道我需要添加到请求标头中以便将文件上传到此存储桶.我正在使用iOS API客户端,但是如果有人知道原始标头是什么,我可能可以从那里弄清楚如何在iOS中进行操作.目前,我仅包含以下附加标头: x-goog-project-id

I would also like to know what I need to append to my request headers in order to upload files to this bucket. I am using the iOS API client, but if anybody knows what the raw headers are, I can probably figure out from there how to do it in iOS. At the moment, I am only including the following additional header: x-goog-project-id

推荐答案

对于第一个问题,您可以使用使用

For your first question, you can make your public your new uploaded objects with the following command that uses the gsutil acl syntax:

gsutil defacl ch -u allUsers:R gs://<bucket>

现在,您需要使用以下命令将访问该存储桶的权限授予所有人:

Now you need to give access to write to that bucket to everybody using the command:

gsutil acl ch -u allUsers:O gs://<bucket>

关于您的其他问题,我对iOS不熟悉,但是您可以转到

Regarding your other question, I'm not familiar with iOS but you can go to the bottom of this page and upload an object and you'll see the HTTP request that you can use in your code.

此外,还有用于Objetive-C的Google API客户端库并且似乎可以使用该库来管理Google Cloud Storage

Also, there is Google API Client Library for Objetive-C and it seems that with that library you can manage Google Cloud Storage as per these files.

希望对您有帮助.

这篇关于如何设置公共Google Cloud Storage存储桶的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆