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 17 #pragma once 18 #include <memory> 19 #include <string> 20 #include <alibabacloud/oss/auth/CredentialsProvider.h> 21 #include <alibabacloud/oss/http/HttpClient.h> 22 #include <alibabacloud/oss/utils/Executor.h> 23 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 * your certificate file. 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 } 126 } 127