
# 列举桶内分段上传任务
#### 功能说明
列举指定桶中所有的初始化后还未合并或还未取消的分段上传任务。
#### 方法定义
```
1. ObsClient->listMultipartUploads(array $parameter)
2. ObsClient->listMultipartUploadsAsync(array $parameter, callable $callback)
```
#### 请求参数
| **字段名**        | **类型**  | **约束** | **说明**                                                                                                                             |
|:---|:---|:---|:---|
| Bucket         | string  | 必选     | 桶名。                                                                                                                                |
| Delimiter      | string  | 可选     | 用于对分段上传任务中的对象名进行分组的字符。对于对象名中包含Delimiter的任务，其对象名（如果请求中指定了Prefix，则此处的对象名需要去掉Prefix）中从首字符至第一个Delimiter之间的字符串将作为一个分组并作为CommonPrefix返回。 |
| Prefix         | string  | 可选     | 限定返回的分段上传任务中的对象名必须带有Prefix前缀。                                                                                                      |
| MaxUploads     | integer | 可选     | 列举分段上传任务的最大数目，取值范围为1\~1000，当超出范围时，按照默认的1000进行处理。                                                                                   |
| KeyMarker      | string  | 可选     | 表示列举时返回指定的KeyMarker之后的分段上传任务。                                                                                                      |
| UploadIdMarker | string  | 可选     | 只有与KeyMarker参数一起使用时才有意义，用于指定返回结果的起始位置，即列举时返回指定KeyMarker的UploadIdMarker之后的分段上传任务。                                                   |
   
#### 返回结果
| **字段名**  ||| **类型**            | **说明**                                              |
|:--|---|---|:---|:---|
| HttpStatusCode ||| integer           | HTTP状态码。                                            |
| Reason   ||| string            | HTTP文本描述。                                           |
| RequestId ||| string            | OBS服务端返回的请求ID。                                      |
| Bucket   ||| string            | 桶名。                                                 |
| KeyMarker ||| string            | 列举分段上传任务的起始位置，与请求中的该参数对应。                           |
| UploadIdMarker ||| string            | 列举分段上传任务的起始位置（UploadId标识），与请求中的该参数对应。               |
| NextKeyMarker ||| string            | 下次列举分段上传任务请求的起始位置。                                  |
| NextUploadIdMarker ||| string            | 下次列举分段上传任务请求的起始位置（UploadId标识），与NextKeyMarker配合使用。   |
| Delimiter ||| string            | 用于对分段上传任务中的对象名进行分组的字符，与请求中的该参数对应。                   |
| Prefix   ||| string            | 分段上传任务中的对象名前缀，与请求中的该参数对应。                           |
| MaxUploads ||| integer           | 列举分段上传任务的最大数目，与请求中的该参数对应。                           |
| IsTruncated ||| boolean           | 表明本次请求是否返回了全部结果，"true"表示没有返回全部结果；"false"表示已返回了全部结果。 |
| Uploads  ||| indexed array     | 分段上传任务列表。                                           |
| - | Key   || string            | 分段上传任务的对象名。                                         |
| - | UploadId || string            | 分段上传任务的ID。                                          |
| - | Initiator || associative array | 分段上传任务的创建者。                                         |
| - | - | ID | string            | 创建者的DomainId。                                       |
| - | Owner || associative array | 和Initiator相同，代表分段上传任务的创建者。                          |
| - | - | ID | string            | 创建者的DomainId。                                       |
| - | Initiated || string            | 分段上传任务的初始化时间。                                       |
| - | StorageClass || string            | 分段上传对象的存储类型。                                        |
| CommonPrefixes ||| indexed array     | 当请求中设置了Delimiter分组字符时，返回按Delimiter分组后的对象名称前缀列表。     |
| - | Prefix || string            | 按Delimiter分组后的对象名称前缀。                               |
   
#### 代码样例
```
try{
       $resp = $obsClient -> listMultipartUploads([
              'Bucket' => 'bucketname',
              'Prefix' => 'prefix',
              'MaxUploads' => 100
       ]);
       printf("RequestId:%s\n", $resp['RequestId']);
       foreach ($resp['Uploads'] as $index => $upload){
              printf("Versions[%d]\n", $index + 1);
              printf("UploadId:%s\n", $upload['UploadId']);
              printf("Initiated:%s\n", $upload['Initiated']);
              printf("StorageClass:%s\n", $upload['StorageClass']);
              printf("Key:%s\n", $upload['Key']);
              printf("Initiator[ID]:%s\n", $upload['Initiator']['ID']);
              printf("Initiator[DisplayName]:%s\n", $upload['Initiator']['DisplayName']);
              printf("Owner[ID]:%s\n", $upload['Owner']['ID']);
              printf("Owner[DisplayName]:%s\n", $upload['Owner']['DisplayName']);
       }
}catch (Obs\Common\ObsException $obsException){
       printf("ExceptionCode:%s\n", $obsException->getExceptionCode());              
       printf("ExceptionMessage:%s\n", $obsException->getExceptionMessage());
}
```
