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.

37 lines
970 B

  1. package cos
  2. import (
  3. "context"
  4. "encoding/xml"
  5. "net/http"
  6. )
  7. type BucketPutAccelerateOptions struct {
  8. XMLName xml.Name `xml:"AccelerateConfiguration"`
  9. Status string `xml:"Status,omitempty"`
  10. Type string `xml:"Type,omitempty"`
  11. }
  12. type BucketGetAccelerateResult BucketPutAccelerateOptions
  13. func (s *BucketService) PutAccelerate(ctx context.Context, opt *BucketPutAccelerateOptions) (*Response, error) {
  14. sendOpt := &sendOptions{
  15. baseURL: s.client.BaseURL.BucketURL,
  16. uri: "/?accelerate",
  17. method: http.MethodPut,
  18. body: opt,
  19. }
  20. resp, err := s.client.doRetry(ctx, sendOpt)
  21. return resp, err
  22. }
  23. func (s *BucketService) GetAccelerate(ctx context.Context) (*BucketGetAccelerateResult, *Response, error) {
  24. var res BucketGetAccelerateResult
  25. sendOpt := &sendOptions{
  26. baseURL: s.client.BaseURL.BucketURL,
  27. uri: "/?accelerate",
  28. method: http.MethodGet,
  29. result: &res,
  30. }
  31. resp, err := s.client.doRetry(ctx, sendOpt)
  32. return &res, resp, err
  33. }