ClientConfiguration.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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/auth/CredentialsProvider.h>
  20. #include <alibabacloud/oss/http/HttpType.h>
  21. namespace AlibabaCloud
  22. {
  23. namespace OSS
  24. {
  25. class RetryStrategy;
  26. class RateLimiter;
  27. class ALIBABACLOUD_OSS_EXPORT ClientConfiguration
  28. {
  29. public:
  30. ClientConfiguration();
  31. ~ClientConfiguration() = default;
  32. public:
  33. /**
  34. * User Agent string user for http calls.
  35. */
  36. std::string userAgent;
  37. /**
  38. * Http scheme to use. E.g. Http or Https.
  39. */
  40. Http::Scheme scheme;
  41. /**
  42. * Max concurrent tcp connections for a single http client to use.
  43. */
  44. unsigned maxConnections;
  45. /**
  46. * Socket read timeouts. Default 3000 ms.
  47. */
  48. long requestTimeoutMs;
  49. /**
  50. * Socket connect timeout.
  51. */
  52. long connectTimeoutMs;
  53. /**
  54. * Strategy to use in case of failed requests.
  55. */
  56. std::shared_ptr<RetryStrategy> retryStrategy;
  57. /**
  58. * The proxy scheme. Default HTTP
  59. */
  60. Http::Scheme proxyScheme;
  61. /**
  62. * The proxy host.
  63. */
  64. std::string proxyHost;
  65. /**
  66. * The proxy port.
  67. */
  68. unsigned int proxyPort;
  69. /**
  70. * The proxy username.
  71. */
  72. std::string proxyUserName;
  73. /**
  74. * The proxy password
  75. */
  76. std::string proxyPassword;
  77. /**
  78. * set false to bypass SSL check.
  79. */
  80. bool verifySSL;
  81. /**
  82. * your Certificate Authority path.
  83. */
  84. std::string caPath;
  85. /**
  86. * your certificate file.
  87. */
  88. std::string caFile;
  89. /**
  90. * your certificate file.
  91. */
  92. bool isCname;
  93. /**
  94. * enable or disable crc64 check.
  95. */
  96. bool enableCrc64;
  97. /**
  98. * enable or disable auto correct http request date.
  99. */
  100. bool enableDateSkewAdjustment;
  101. /**
  102. * Rate limit data upload speed.
  103. */
  104. std::shared_ptr<RateLimiter> sendRateLimiter;
  105. /**
  106. * Rate limit data download speed.
  107. */
  108. std::shared_ptr<RateLimiter> recvRateLimiter;
  109. /**
  110. * The interface for outgoing traffic. E.g. eth0 in linux
  111. */
  112. std::string networkInterface;
  113. };
  114. }
  115. }