列举桶内分段上传任务
功能说明
列举指定桶中所有的初始化后还未合并或还未取消的分段上传任务。
方法定义
ObsClient.listMultipartUploads
请求参数
字段名 | 类型 | 约束 | 说明 |
|---|---|---|---|
Bucket | String | 必选 | 桶名。 |
RequestDate | String 或 Date | 可选 | 指定请求时间。 说明: 当为String类型时,必须符合ISO8601或RFC822规范。 |
Delimiter | String | 可选 | 用于对分段上传任务中的对象名进行分组的字符。对于对象名中包含Delimiter的任务,其对象名(如果请求中指定了Prefix,则此处的对象名需要去掉Prefix)中从首字符至第一个Delimiter之间的字符串将作为一个分组并作为CommonPrefix返回。 |
Prefix | String | 可选 | 限定返回的分段上传任务中的对象名必须带有Prefix前缀。 |
MaxUploads | Number | 可选 | 列举分段上传任务的最大数目,取值范围为1~1000,当超出范围时,按照默认的1000进行处理。 |
KeyMarker | String | 可选 | 表示列举时返回指定的KeyMarker之后的分段上传任务。 |
UploadIdMarker | String | 可选 | 只有与KeyMarker参数一起使用时才有意义,用于指定返回结果的起始位置,即列举时返回指定KeyMarker的UploadIdMarker之后的分段上传任务。 |
返回结果(InterfaceResult)
字段名 | 类型 | 说明 | ||
|---|---|---|---|---|
RequestId | String | OBS服务端返回的请求ID。 | ||
Bucket | String | 桶名。 | ||
KeyMarker | String | 列举分段上传任务的起始位置,与请求中的该参数对应。 | ||
UploadIdMarker | String | 列举分段上传任务的起始位置(UploadId标识),与请求中的该参数对应。 | ||
NextKeyMarker | String | 下次列举分段上传任务请求的起始位置。 | ||
NextUploadIdMarker | String | 下次列举分段上传任务请求的起始位置(UploadId标识),与NextKeyMarker配合使用。 | ||
Delimiter | String | 用于对分段上传任务中的对象名进行分组的字符,与请求中的该参数对应。 | ||
Prefix | String | 分段上传任务中的对象名前缀,与请求中的该参数对应。 | ||
MaxUploads | String | 列举分段上传任务的最大数目,与请求中的该参数对应。 | ||
IsTruncated | String | 表明本次请求是否返回了全部结果,“true”表示没有返回全部结果;“false”表示已返回了全部结果。 | ||
Uploads | Array | 分段上传任务列表。 | ||
- | Key | String | 分段上传任务的对象名。 | |
UploadId | String | 分段上传任务的ID。 | ||
Initiator | Object | 分段上传任务的创建者。 | ||
- | ID | String | 创建者的DomainId。 | |
Owner | Object | 和Initiator相同,代表分段上传任务的创建者。 | ||
- | ID | String | 创建者的DomainId。 | |
Initiated | String | 分段上传任务的初始化时间。 | ||
- | StorageClass | String | 分段上传对象的存储类型。 | |
CommonPrefixes | Array | 当请求中设置了Delimiter分组字符时,返回按Delimiter分组后的对象名称前缀列表。 | ||
- | Prefix | String | 按Delimiter分组后的对象名称前缀。 | |
代码样例
obsClient.listMultipartUploads ({
Bucket : 'bucketname',
Prefix : 'prefix',
MaxUploads : 100
},function (err, result) {
if(err){
console.error('Error-->' + err);
}else{
if(result.CommonMsg.Status < 300){
console.log('RequestId-->' + result.InterfaceResult.RequestId);
console.log('Bucket-->' + result.InterfaceResult.Bucket);
for(var i=0;i<result.InterfaceResult.Uploads.length;i++){
console.log('Uploads[' + i + ']');
console.log('UploadId-->' + result.InterfaceResult.Uploads[i]['UploadId']);
console.log('Key-->' + result.InterfaceResult.Uploads[i]['Key']);
console.log('Initiated-->' + result.InterfaceResult.Uploads[i]['Initiated']);
console.log('StorageClass-->' + result.InterfaceResult.Uploads[i]['StorageClass']);
console.log('Owner[ID]-->' + result.InterfaceResult.Uploads[i]['Owner']['ID']);
console.log('Initiator[ID]-->' + result.InterfaceResult.Uploads[i]['Initiator']['ID']);
}
}else{
console.log('Code-->' + result.CommonMsg.Code);
console.log('Message-->' + result.CommonMsg.Message);
}
}
}); 
