- 1.3 FDS简介
- 1.4 基本概念
- 1.5 使用场景
- 1.6 快速入门
- 1.6.1 帐号注册
- 1.6.2 创建Bucket
- 1.6.3 上传文件
- 1.6.4 生成文件预签名链接
- 1.6.5 为云服务密钥授权
- 1.6.6 通过SDK下载文件
- 1.7 请求认证
- 1.7.1 OAuth认证
- 1.7.2 签名认证
- 1.7.3 预签名认证
- 1.8 权限列表
- 1.9 Presigned URL
- 1.10 SDK
- 1.10.1 Service操作API的签名和示例
- 1.10.2 Bucket操作API的签名和示例
- 1.10.3 Object操作API的签名和示例
- 1.11 Service操作REST API
- 1.11.1 List Buckets
- 1.12 Bucket操作REST API
- 1.12.1 PUT Bucket
- 1.12.2 DELETE Bucket
- 1.12.3 HEAD Bucket
- 1.12.4 PUT Bucket ACL
- 1.12.5 GET Bucket META
- 1.12.6 GET Bucket ACL
- 1.12.7 List Objects
- 1.13 Object操作 REST API
- 1.13.1 Put Object
- 1.13.2 POST Object
- 1.13.3 GET Object
- 1.13.4 HEAD Object
- 1.13.5 Copy Object
- 1.13.6 PUT Object ACL
- 1.13.7 GET Object ACL
- 1.13.8 GET Object metadata
- 1.13.9 DELETE Object
- 1.13.10 Delete multiple Objects
- 1.13.11 DELETE Object ACL
- 1.13.12 Restore Object
- 1.13.13 Rename Object
- 1.13.14 Prefetch Object
- 1.13.15 Refresh Object
- 1.13.16 Init multipart upload
- 1.13.17 Upload part
- 1.13.18 Complete multipart-upload
- 1.13.19 Abort multipart upload
- 1.14 CDN使用
- 1.15 服务端加密
- 1.16 图像处理
- 1.17 计量计费
- 1.18 分片上传
- 1.19 误删数据恢复
- 1.20 TTL功能
- 1.21 跨域资源共享(CORS)
- 1.22 FDS命令行工具
- 1.23 FDS第三方迁移工具
- 1.24 FDS存量数据加密工具
- 1.25 FAQ
- 1.26 问题调查
- 1.27 问题反馈
- 1.28.1 abort-multipart-upload
- 1.28.2 complete-multipart-upload
- 1.28.3 delete-bucket
- 1.28.4 delete-multiple-objects
- 1.28.5 delete-object-acl
- 1.28.6 delete-object
- 1.28.7 delete-objects
- 1.28.8 get-bucket-acl
- 1.28.9 get-bucket-meta
- 1.28.10 get-endpoint
- 1.28.11 get-object-acl
- 1.28.12 get-object
- 1.28.13 copy-object
- 1.28.14 get-object-metadata
- 1.28.15 head-bucket
- 1.28.16 head-object
- 1.28.17 init-multipart-upload
- 1.28.18 list-bucket
- 1.28.19 list-objects
- 1.28.20 OAuth
- 1.28.21 post-object
- 1.28.22 prefetch-object
- 1.28.23 put-bucket-acl
- 1.28.24 put-bucket
- 1.28.25 put-object-acl
- 1.28.26 put-object
- 1.28.27 rename-object
- 1.28.28 refresh-object
- 1.28.29 restore-object
- 1.28.30 upload-part
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
1.10.2 Bucket操作API的签名和示例
PUT Bucket
函数签名
/**
* Creates a new fds bucket with the specified name.
*
* @param bucketName The name of the bucket to create
* @throws GalaxyFDSClientException
*/
public void createBucket(String bucketName) throws GalaxyFDSClientException;
示例
fdsClient.createBucket(BUCKET_NAME);
DELETE Bucket
函数签名
/**
* Deletes a fds bucket with the specified name.
*
* @param bucketName The name of the bucket to delete
* @throws GalaxyFDSClientException
*/
public void deleteBucket(String bucketName) throws GalaxyFDSClientException;
示例
fdsClient.deleteBucket(BUCKET_NAME);
HEAD Bucket
函数签名
/**
* Checks if the specified bucket exists.
*
* @param bucketName The name of the bucket to check
* @return The value true if the specified bucket exists, otherwise false
* @throws GalaxyFDSClientException
*/
public boolean doesBucketExist(String bucketName)
throws GalaxyFDSClientException;
示例
boolean exist = fdsClient.doesBucketExist(BUCKET_NAME);
PUT Bucket ACL
函数签名
/**
* Sets the AccessControlList(ACL) of the specified fds bucket.
*
* @param bucketName The name of the bucket whoses acl is being set
* @param acl The new AccessControlList for the specified bucket
* @throws GalaxyFDSClientException
*/
public void setBucketAcl(String bucketName, AccessControlList acl)
throws GalaxyFDSClientException;
示例
AccessControlList acl = new AccessControlList();
Grant grant = new Grant("12346", Permission.READ, GrantType.USER);
acl.addGrant(grant);
fdsClient.setBucketAcl(BUCKET_NAME, acl);
GET Bucket ACL
函数签名
/**
* Gets the AccessControlList(ACL) of the specified fds bucket.
*
* @param bucketName The name of the bucket whose ACL is being retrieved
* @return The AccessControlList for the specified bucket
* @throws GalaxyFDSClientException
*/
public AccessControlList getBucketAcl(String bucketName)
throws GalaxyFDSClientException;
示例
AccessControlList acl = fdsClient.getBucketAcl(BUCKET_NAME);
for (Grant grant : acl.getGrantList()) {
System.out.println("grantee: " + grant.getGranteeId() + ", permission: "
+ grant.getPermission() + ", type: " + grant.getType());
}
List Objects
函数签名
/**
* Returns a list of summary information about the objects in the specified
* fds bucket.
* <p/>
* Because buckets can contain a virtually unlimited number of keys, the
* complete results of a list query can be extremely large. To manage large
* result sets, galaxy fds uses pagination to split them into multiple
* responses. Always check the {@link #FDSObjectListing.isTruncated()} method
* to see if the returned listing is complete or if additional calls are
* needed to get more results. Alternatively, use the
* {@link #listNextBatchOfObjects(FDSObjectListing)} method as an easy way to
* get the next page of object listings.
*
* @param bucketName The name of the bucket to list
* @return A listing of the objects in the specified bucket
* @throws GalaxyFDSClientException
*/
public FDSObjectListing listObjects(String bucketName)
throws GalaxyFDSClientException;
/**
* Returns a list of summary information about the objects in the specified
* fds bucket.
*
* @param bucketName The name of the bucket to list
* @param prefix An optional parameter restricting the response to keys
* beginning with the specified prefix.
* @return A listing of the objects in the specified bucket
* @throws GalaxyFDSClientException
*/
public FDSObjectListing listObjects(String bucketName, String prefix)
throws GalaxyFDSClientException;
/**
* Returns a list of summary information about the objects in the specified
* fds bucket.
*
* @param bucketName The name of the bucket to list
* @param prefix An optional parameter restricting the response to keys
* beginning with the specified prefix.
* @param delimiter delimiter to separate path
* @return A listing of the objects in the specified bucket
* @throws GalaxyFDSClientException
*/
public FDSObjectListing listObjects(String bucketName, String prefix,
String delimiter) throws GalaxyFDSClientException;
/**
* Provides an easy way to continue a truncated object listing and retrieve
* the next page of results.
*
* @param previousObjectListing The previous truncated ObjectListing
* @return The next set of ObjectListing results, beginning immediately after
* the last result in the specified previous ObjectListing.
* @throws GalaxyFDSClientException
*/
public FDSObjectListing listNextBatchOfObjects(
FDSObjectListing previousObjectListing) throws GalaxyFDSClientException;
示例
FDSObjectListing listing = null;
do {
if (listing == null) {
listing = fdsClient.listObjects(bucketName, "", "/");
} else {
listing = fdsClient.listNextBatchOfObjects(listing);
}
if (listing != null) {
List<String> commonPrefixes = listing.getCommonPrefixes();
for (String commonPrefix : commonPrefixes) {
System.out.println(commonPrefix);
}
List<FDSObjectSummary> objectSummaries = listing.getObjectSummaries();
for (FDSObjectSummary objectSummary : objectSummaries) {
System.out.println(objectSummary.getObjectName());
}
}
}
while (listing != null && listing.isTruncated());
Note
更多例子,请参考List Objects REST API
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论