ClientConfiguration.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 <memory>
  18. #include <string>
  19. #include <alibabacloud/oss/Types.h>
  20. #include <alibabacloud/oss/auth/CredentialsProvider.h>
  21. #include <alibabacloud/oss/http/HttpClient.h>
  22. #include <alibabacloud/oss/http/HttpInterceptor.h>
  23. #include <alibabacloud/oss/utils/Executor.h>
  24. namespace AlibabaCloud
  25. {
  26. namespace OSS
  27. {
  28. class RetryStrategy;
  29. class RateLimiter;
  30. class ALIBABACLOUD_OSS_EXPORT ClientConfiguration
  31. {
  32. public:
  33. ClientConfiguration();
  34. ~ClientConfiguration() = default;
  35. public:
  36. /**
  37. * User Agent string user for http calls.
  38. */
  39. std::string userAgent;
  40. /**
  41. * Http scheme to use. E.g. Http or Https.
  42. */
  43. Http::Scheme scheme;
  44. /**
  45. * Max concurrent tcp connections for a single http client to use.
  46. */
  47. unsigned maxConnections;
  48. /**
  49. * Socket read timeouts. Default 3000 ms.
  50. */
  51. long requestTimeoutMs;
  52. /**
  53. * Socket connect timeout.
  54. */
  55. long connectTimeoutMs;
  56. /**
  57. * Strategy to use in case of failed requests.
  58. */
  59. std::shared_ptr<RetryStrategy> retryStrategy;
  60. /**
  61. * The proxy scheme. Default HTTP
  62. */
  63. Http::Scheme proxyScheme;
  64. /**
  65. * The proxy host.
  66. */
  67. std::string proxyHost;
  68. /**
  69. * The proxy port.
  70. */
  71. unsigned int proxyPort;
  72. /**
  73. * The proxy username.
  74. */
  75. std::string proxyUserName;
  76. /**
  77. * The proxy password
  78. */
  79. std::string proxyPassword;
  80. /**
  81. * set false to bypass SSL check.
  82. */
  83. bool verifySSL;
  84. /**
  85. * your Certificate Authority path.
  86. */
  87. std::string caPath;
  88. /**
  89. * your certificate file.
  90. */
  91. std::string caFile;
  92. /**
  93. * enable or disable cname, default is false.
  94. */
  95. bool isCname;
  96. /**
  97. * enable or disable crc64 check.
  98. */
  99. bool enableCrc64;
  100. /**
  101. * enable or disable auto correct http request date.
  102. */
  103. bool enableDateSkewAdjustment;
  104. /**
  105. * Rate limit data upload speed.
  106. */
  107. std::shared_ptr<RateLimiter> sendRateLimiter;
  108. /**
  109. * Rate limit data download speed.
  110. */
  111. std::shared_ptr<RateLimiter> recvRateLimiter;
  112. /**
  113. * The interface for outgoing traffic. E.g. eth0 in linux
  114. */
  115. std::string networkInterface;
  116. /**
  117. * Your executor's implement
  118. */
  119. std::shared_ptr<Executor> executor;
  120. /**
  121. * Your http client' implement
  122. */
  123. std::shared_ptr<HttpClient> httpClient;
  124. /**
  125. * enable or disable path style, default is false.
  126. */
  127. bool isPathStyle;
  128. /**
  129. * enable or disable verify object name strictly. defualt is true
  130. */
  131. bool isVerifyObjectStrict;
  132. /**
  133. * signature version. default is V1.
  134. */
  135. SignatureVersionType signatureVersion;
  136. /**
  137. * Your http interceptor implement
  138. */
  139. std::shared_ptr<HttpInterceptor> httpInterceptor;
  140. };
  141. }
  142. }