2012-12-13 11 views
1

我在谷歌云存储中创建的对象的文件夹内蒙山以下OptionsBuilder对象在谷歌云存储文件夹的ACL工作:问题与

GSFileOptionsBuilder optionsBuilder = new GSFileOptionsBuilder() 
    .setBucket("bucket") 
    .setKey("folder/obj.csv") 
    .setMimeType("text/csv"); 

制作一个结构:

桶>>文件夹>> obj.csv

当我运行gsutil命令来获取“桶”和“obj.csv”的ACL工作正常,但是当我执行“文件夹”时抛出此异常: GSResponseError :status = 404,code = NoSuchKey,reas on =未找到。

我运行的确切命令是:gsutil会则getacl GS://桶/文件夹/> acl.txt

我怎样才能得到一个文件夹上设置权限?

回答

5

您只能检索对象或存储区的ACL。在GCS中没有“文件夹”这样的东西,所以你不能设置或获取文件夹的ACL。我建议您仔细阅读开发指南的Concepts and Terminology部分。特别是关于对象名称的部分:

Object names

An object name is just metadata to Google Cloud Storage. Object names can contain any combination of Unicode characters (UTF-8 encoded) less than 1024 bytes in length. A common character to include in file names is a slash (/). By using slashes in an object name, you can make objects appear as though they're stored in a hierarchical structure. For example, you could name one object /europe/france/paris.jpg and another object /europe/france/cannes.jpg. When you list these objects they appear to be in a hierarchical directory structure based on location; however, Google Cloud Storage sees the objects as independent objects with no hierarchical relationship whatsoever.

+0

非常感谢jrerrace。 –