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

Method listMultipartUploadsQuery

api-list.go:958–1034  ·  view source on GitHub ↗

listMultipartUploadsQuery - (List Multipart Uploads). - Lists some or all (up to 1000) in-progress multipart uploads in a bucket. You can use the request parameters as selection criteria to return a subset of the uploads in a bucket. request parameters. :- --------- ?key-marker - Specifies the mult

(ctx context.Context, bucketName, keyMarker, uploadIDMarker, prefix, delimiter string, maxUploads int)

Source from the content-addressed store, hash-verified

956// ?prefix - Limits the response to keys that begin with the specified prefix.
957// ?max-uploads - Sets the maximum number of multipart uploads returned in the response body.
958func (c *Client) listMultipartUploadsQuery(ctx context.Context, bucketName, keyMarker, uploadIDMarker, prefix, delimiter string, maxUploads int) (ListMultipartUploadsResult, error) {
959 // Get resources properly escaped and lined up before using them in http request.
960 urlValues := make(url.Values)
961 // Set uploads.
962 urlValues.Set("uploads", "")
963 // Set object key marker.
964 if keyMarker != "" {
965 urlValues.Set("key-marker", keyMarker)
966 }
967 // Set upload id marker.
968 if uploadIDMarker != "" {
969 urlValues.Set("upload-id-marker", uploadIDMarker)
970 }
971
972 // Set object prefix, prefix value to be set to empty is okay.
973 urlValues.Set("prefix", prefix)
974
975 // Set delimiter, delimiter value to be set to empty is okay.
976 urlValues.Set("delimiter", delimiter)
977
978 // Always set encoding-type
979 urlValues.Set("encoding-type", "url")
980
981 // maxUploads should be 1000 or less.
982 if maxUploads > 0 {
983 // Set max-uploads.
984 urlValues.Set("max-uploads", fmt.Sprintf("%d", maxUploads))
985 }
986
987 // Execute GET on bucketName to list multipart uploads.
988 resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{
989 bucketName: bucketName,
990 queryValues: urlValues,
991 contentSHA256Hex: emptySHA256Hex,
992 })
993 defer closeResponse(resp)
994 if err != nil {
995 return ListMultipartUploadsResult{}, err
996 }
997 if resp != nil {
998 if resp.StatusCode != http.StatusOK {
999 return ListMultipartUploadsResult{}, httpRespToErrorResponse(resp, bucketName, "")
1000 }
1001 }
1002 // Decode response body.
1003 listMultipartUploadsResult := ListMultipartUploadsResult{}
1004 err = xmlDecoder(resp.Body, &listMultipartUploadsResult)
1005 if err != nil {
1006 return listMultipartUploadsResult, err
1007 }
1008
1009 listMultipartUploadsResult.NextKeyMarker, err = decodeS3Name(listMultipartUploadsResult.NextKeyMarker, listMultipartUploadsResult.EncodingType)
1010 if err != nil {
1011 return listMultipartUploadsResult, err
1012 }
1013
1014 listMultipartUploadsResult.NextUploadIDMarker, err = decodeS3Name(listMultipartUploadsResult.NextUploadIDMarker, listMultipartUploadsResult.EncodingType)
1015 if err != nil {

Callers 2

listIncompleteUploadsMethod · 0.95
ListMultipartUploadsMethod · 0.80

Calls 6

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

Tested by

no test coverage detected