You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.9 KiB

  1. package cos
  2. import (
  3. "context"
  4. "encoding/xml"
  5. "net/http"
  6. )
  7. // ListMultipartUploadsResult is the result of ListMultipartUploads
  8. type ListMultipartUploadsResult struct {
  9. XMLName xml.Name `xml:"ListMultipartUploadsResult"`
  10. Bucket string `xml:"Bucket"`
  11. EncodingType string `xml:"Encoding-Type"`
  12. KeyMarker string
  13. UploadIDMarker string `xml:"UploadIdMarker"`
  14. NextKeyMarker string
  15. NextUploadIDMarker string `xml:"NextUploadIdMarker"`
  16. MaxUploads int
  17. IsTruncated bool
  18. Uploads []struct {
  19. Key string
  20. UploadID string `xml:"UploadId"`
  21. StorageClass string
  22. Initiator *Initiator
  23. Owner *Owner
  24. Initiated string
  25. } `xml:"Upload,omitempty"`
  26. Prefix string
  27. Delimiter string `xml:"delimiter,omitempty"`
  28. CommonPrefixes []string `xml:"CommonPrefixs>Prefix,omitempty"`
  29. }
  30. // ListMultipartUploadsOptions is the option of ListMultipartUploads
  31. type ListMultipartUploadsOptions struct {
  32. Delimiter string `url:"delimiter,omitempty"`
  33. EncodingType string `url:"encoding-type,omitempty"`
  34. Prefix string `url:"prefix,omitempty"`
  35. MaxUploads int `url:"max-uploads,omitempty"`
  36. KeyMarker string `url:"key-marker,omitempty"`
  37. UploadIDMarker string `url:"upload-id-marker,omitempty"`
  38. }
  39. // ListMultipartUploads 用来查询正在进行中的分块上传。单次最多列出1000个正在进行中的分块上传。
  40. //
  41. // https://www.qcloud.com/document/product/436/7736
  42. func (s *BucketService) ListMultipartUploads(ctx context.Context, opt *ListMultipartUploadsOptions) (*ListMultipartUploadsResult, *Response, error) {
  43. var res ListMultipartUploadsResult
  44. sendOpt := sendOptions{
  45. baseURL: s.client.BaseURL.BucketURL,
  46. uri: "/?uploads",
  47. method: http.MethodGet,
  48. result: &res,
  49. optQuery: opt,
  50. }
  51. resp, err := s.client.send(ctx, &sendOpt)
  52. return &res, resp, err
  53. }