GetObjectRequest.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #pragma once
  17. #include <alibabacloud/oss/Export.h>
  18. #include <alibabacloud/oss/OssRequest.h>
  19. #include <alibabacloud/oss/Types.h>
  20. #include <vector>
  21. #include <map>
  22. namespace AlibabaCloud
  23. {
  24. namespace OSS
  25. {
  26. class ALIBABACLOUD_OSS_EXPORT GetObjectRequest: public OssObjectRequest
  27. {
  28. public:
  29. GetObjectRequest(const std::string& bucket, const std::string& key);
  30. GetObjectRequest(const std::string& bucket, const std::string& key,
  31. const std::string& process);
  32. GetObjectRequest(const std::string &bucket, const std::string &key,
  33. const std::string &modifiedSince, const std::string &unmodifiedSince,
  34. const std::vector<std::string> &matchingETags, const std::vector<std::string> &nonmatchingETags,
  35. const std::map<std::string, std::string> &responseHeaderParameters_);
  36. void setRange(int64_t start, int64_t end);
  37. void setRange(int64_t start, int64_t end, bool standard);
  38. void setModifiedSinceConstraint(const std::string& gmt);
  39. void setUnmodifiedSinceConstraint(const std::string& gmt);
  40. void setMatchingETagConstraints(const std::vector<std::string>& match);
  41. void addMatchingETagConstraint(const std::string& match);
  42. void setNonmatchingETagConstraints(const std::vector<std::string>& match);
  43. void addNonmatchingETagConstraint(const std::string& match);
  44. void setProcess(const std::string& process);
  45. void addResponseHeaders(RequestResponseHeader header, const std::string& value);
  46. void setTrafficLimit(uint64_t value);
  47. void setUserAgent(const std::string& ua);
  48. std::pair<int64_t, int64_t> Range() const;
  49. protected:
  50. virtual HeaderCollection specialHeaders() const ;
  51. virtual ParameterCollection specialParameters() const;
  52. virtual int validate() const;
  53. private:
  54. int64_t range_[2];
  55. bool rangeIsSet_;
  56. std::string modifiedSince_;
  57. std::string unmodifiedSince_;
  58. std::vector<std::string> matchingETags_;
  59. std::vector<std::string> nonmatchingETags_;
  60. std::string process_;
  61. std::map<std::string, std::string> responseHeaderParameters_;
  62. uint64_t trafficLimit_;
  63. bool rangeIsStandardMode_;
  64. std::string userAgent_;
  65. };
  66. }
  67. }