AWS SDK for C++  0.14.3
AWS SDK for C++
HttpClientFactory.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. 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  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #pragma once
17 
18 #include <aws/core/Core_EXPORTS.h>
19 
22 
23 namespace Aws
24 {
25  namespace Client
26  {
27  struct ClientConfiguration;
28  } // namespace Client
29  namespace Http
30  {
31  class URI;
32  class HttpClient;
33  class HttpRequest;
34 
39  {
40  public:
41  virtual ~HttpClientFactory() {}
42 
46  virtual std::shared_ptr<HttpClient> CreateHttpClient(const Aws::Client::ClientConfiguration& clientConfiguration) const = 0;
50  virtual std::shared_ptr<HttpRequest> CreateHttpRequest(const Aws::String& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory) const = 0;
54  virtual std::shared_ptr<HttpRequest> CreateHttpRequest(const URI& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory) const = 0;
55 
56  virtual void InitStaticState() {}
57  virtual void CleanupStaticState() {}
58  };
59 
64  AWS_CORE_API void SetInitCleanupCurlFlag(bool initCleanupFlag);
65  AWS_CORE_API void InitHttp();
67  AWS_CORE_API void SetHttpClientFactory(const std::shared_ptr<HttpClientFactory>& factory);
68  AWS_CORE_API std::shared_ptr<HttpClient> CreateHttpClient(const Aws::Client::ClientConfiguration& clientConfiguration);
69  AWS_CORE_API std::shared_ptr<HttpRequest> CreateHttpRequest(const Aws::String& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory);
70  AWS_CORE_API std::shared_ptr<HttpRequest> CreateHttpRequest(const URI& uri, HttpMethod method, const Aws::IOStreamFactory& streamFactory);
71 
72  } // namespace Http
73 } // namespace Aws
74 
AWS_CORE_API std::shared_ptr< HttpClient > CreateHttpClient(const Aws::Client::ClientConfiguration &clientConfiguration)
AWS_CORE_API void InitHttp()
AWS_CORE_API void CleanupHttp()
AWS_CORE_API void SetInitCleanupCurlFlag(bool initCleanupFlag)
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition: AWSString.h:97
AWS_CORE_API void SetHttpClientFactory(const std::shared_ptr< HttpClientFactory > &factory)
AWS_CORE_API std::shared_ptr< HttpRequest > CreateHttpRequest(const URI &uri, HttpMethod method, const Aws::IOStreamFactory &streamFactory)
#define AWS_CORE_API
Definition: Core_EXPORTS.h:35
std::function< Aws::IOStream *(void) > IOStreamFactory
Definition: AWSStreamFwd.h:35
JSON (JavaScript Object Notation).