MCPcopy
hub / github.com/minio/minio-go / listObjectPartsQuery

Method listObjectPartsQuery

api-list.go:1095–1132  ·  view source on GitHub ↗

listObjectPartsQuery (List Parts query) - lists some or all (up to 1000) parts that have been uploaded for a specific multipart upload You can use the request parameters as selection criteria to return a subset of the uploads in a bucket, request parameters :- --------- ?part-number-marker - Specif

(ctx context.Context, bucketName, objectName, uploadID string, partNumberMarker, maxParts int)

Source from the content-addressed store, hash-verified

1093// begin.
1094// ?max-parts - Maximum parts to be listed per request.
1095func (c *Client) listObjectPartsQuery(ctx context.Context, bucketName, objectName, uploadID string, partNumberMarker, maxParts int) (ListObjectPartsResult, error) {
1096 // Get resources properly escaped and lined up before using them in http request.
1097 urlValues := make(url.Values)
1098 // Set part number marker.
1099 urlValues.Set("part-number-marker", fmt.Sprintf("%d", partNumberMarker))
1100 // Set upload id.
1101 urlValues.Set("uploadId", uploadID)
1102
1103 // maxParts should be 1000 or less.
1104 if maxParts > 0 {
1105 // Set max parts.
1106 urlValues.Set("max-parts", fmt.Sprintf("%d", maxParts))
1107 }
1108
1109 // Execute GET on objectName to get list of parts.
1110 resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{
1111 bucketName: bucketName,
1112 objectName: objectName,
1113 queryValues: urlValues,
1114 contentSHA256Hex: emptySHA256Hex,
1115 })
1116 defer closeResponse(resp)
1117 if err != nil {
1118 return ListObjectPartsResult{}, err
1119 }
1120 if resp != nil {
1121 if resp.StatusCode != http.StatusOK {
1122 return ListObjectPartsResult{}, httpRespToErrorResponse(resp, bucketName, objectName)
1123 }
1124 }
1125 // Decode list object parts XML.
1126 listObjectPartsResult := ListObjectPartsResult{}
1127 err = xmlDecoder(resp.Body, &listObjectPartsResult)
1128 if err != nil {
1129 return listObjectPartsResult, err
1130 }
1131 return listObjectPartsResult, nil
1132}
1133
1134// Decode an S3 object name according to the encoding type
1135func decodeS3Name(name, encodingType string) (string, error) {

Callers 2

listObjectPartsMethod · 0.95
ListObjectPartsMethod · 0.80

Calls 5

executeMethodMethod · 0.95
httpRespToErrorResponseFunction · 0.85
closeResponseFunction · 0.70
xmlDecoderFunction · 0.70
SetMethod · 0.45

Tested by

no test coverage detected