Pat*_*ick 1 google-app-engine google-cloud-storage
我正在尝试从appengine(JAVA)的一个批处理请求中设置多个ACL.我不确定提出请求的URL应该是什么.该文件指出,"/批".还有其他例子吗?AFAIK无法从API资源管理器进行测试.
使用google-api-java-client库和Storage JSON API,批处理请求如下所示:
// Create the Storage service object
Storage storage = new Storage(httpTransport, jsonFactory, credential);
// Create a new batch request
BatchRequest batch = storage.batch();
// Add some requests to the batch request
storage.objectAccessControls().insert("bucket-name", "object-key1",
new ObjectAccessControl().setEntity("user-123423423").setRole("READER"))
.queue(batch, callback);
storage.objectAccessControls().insert("bucket-name", "object-key2",
new ObjectAccessControl().setEntity("user-guy@example.com").setRole("READER"))
.queue(batch, callback);
storage.objectAccessControls().insert("bucket-name", "object-key3",
new ObjectAccessControl().setEntity("group-foo@googlegroups.com").setRole("OWNER"))
.queue(batch, callback);
// Execute the batch request. The individual callbacks will be called when requests finish.
batch.execute();
Run Code Online (Sandbox Code Playgroud)
请注意,您目前必须请求访问Storage JSON API,因为它处于有限测试阶段.
相关API文档位于:https://developers.google.com/storage/docs/json_api/v1/objectAccessControls
有关Java客户端库中批处理请求的文档:https://code.google.com/p/google-api-java-client/wiki/Batch
存储Java客户端库的JavaDoc:https://google-api-client-libraries.appspot.com/documentation/storage/v1beta1/java/latest/index.html
归档时间: |
|
查看次数: |
1580 次 |
最近记录: |