AWS SDK for C++  0.14.3
AWS SDK for C++
HttpClient.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 
20 #include <memory>
21 #include <atomic>
22 #include <mutex>
23 #include <condition_variable>
24 
25 namespace Aws
26 {
27  namespace Utils
28  {
29  namespace RateLimits
30  {
31  class RateLimiterInterface;
32  } // namespace RateLimits
33  } // namespace Utils
34 
35  namespace Http
36  {
37  class HttpRequest;
38  class HttpResponse;
39 
44  {
45  public:
46  HttpClient();
47  virtual ~HttpClient() {}
48 
49  /*
50  * Takes an http request, makes it, and returns the newly allocated HttpResponse
51  */
52  virtual std::shared_ptr<HttpResponse> MakeRequest(HttpRequest& request,
53  Aws::Utils::RateLimits::RateLimiterInterface* readLimiter = nullptr,
54  Aws::Utils::RateLimits::RateLimiterInterface* writeLimiter = nullptr) const = 0;
55 
59  void DisableRequestProcessing();
63  void EnableRequestProcessing();
67  bool IsRequestProcessingEnabled() const;
71  void RetryRequestSleep(std::chrono::milliseconds sleepTime);
72 
73  private:
74 
75  std::atomic< bool > m_disableRequestProcessing;
76 
77  std::mutex m_requestProcessingSignalLock;
78  std::condition_variable m_requestProcessingSignal;
79  };
80 
81  } // namespace Http
82 } // namespace Aws
83 
84 
virtual ~HttpClient()
Definition: HttpClient.h:47
#define AWS_CORE_API
Definition: Core_EXPORTS.h:35
JSON (JavaScript Object Notation).