Google app engine 使用Google存储Json Api(JAVA)的批处理请求
我试图在来自appengine(JAVA)的一个批处理请求中设置多个ACL。我不确定发出请求的URL应该是什么。状态为“/批”。还有其他例子吗?AFAIK无法从API资源管理器进行测试。使用库和存储JSON API,批处理请求如下所示:Google app engine 使用Google存储Json Api(JAVA)的批处理请求,google-app-engine,google-cloud-storage,Google App Engine,Google Cloud Storage,我试图在来自appengine(JAVA)的一个批处理请求中设置多个ACL。我不确定发出请求的URL应该是什么。状态为“/批”。还有其他例子吗?AFAIK无法从API资源管理器进行测试。使用库和存储JSON API,批处理请求如下所示: // Create the Storage service object Storage storage = new Storage(httpTransport, jsonFactory, credential); // Create a new batch
// 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();
请注意,您现在必须请求访问存储JSON API,因为它是有限的测试版
相关API文档如下:
有关Java客户端库中批处理请求的文档:
存储Java客户端库的JavaDoc:使用库和存储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();
请注意,您现在必须请求访问存储JSON API,因为它是有限的测试版
相关API文档如下:
有关Java客户端库中批处理请求的文档:
存储Java客户端库的JavaDoc:没错,API资源管理器目前不支持批处理请求,这使得尝试这一点有点困难。我建议使用Java客户端库进行云存储,它支持批处理请求您是对的,API资源管理器目前不支持批处理请求,这使得这一点更难尝试。我建议使用Java客户端库进行云存储,它支持批处理请求一个警告:如果您使用相同的资源(bucket或object)并对其发出多个批处理ACL编辑(insert/update)请求,则会导致该资源上的争用,因为批处理请求都是并行发生的。如果需要这样做,在我们解决该问题之前,您可以编辑资源本身的acl属性,即这些acl的列表。警告:如果您使用同一资源(bucket或object)并对其发出多个批处理acl编辑(insert/update)请求,您将导致该资源上的争用,因为批处理请求都是并行发生的。如果需要这样做,在我们能够解决该问题之前,您可以编辑资源本身的acl属性,即这些acl的列表。