AWS SDK for C++  1.8.54
AWS SDK for C++
AmazonWebServiceRequest.h
Go to the documentation of this file.
1 
6 #pragma once
7 
9 
17 
18 namespace Aws
19 {
20  namespace Http
21  {
22  class URI;
23  } // namespace Http
24 
26 
30  typedef std::function<void(const AmazonWebServiceRequest&)> RequestRetryHandler;
31  typedef std::function<void(const Aws::Http::HttpRequest&)> RequestSignedHandler;
32 
37  {
38  public:
43  virtual ~AmazonWebServiceRequest() = default;
44 
48  virtual std::shared_ptr<Aws::IOStream> GetBody() const = 0;
52  virtual Aws::Http::HeaderValueCollection GetHeaders() const = 0;
57 
62  virtual void PutToPresignedUrl(Aws::Http::URI& uri) const { DumpBodyToUrl(uri); AddQueryStringParameters(uri); }
63 
67  virtual bool IsStreaming() const { return false; }
68 
72  inline virtual bool IsEventStreamRequest() const { return false; }
76  virtual bool SignBody() const { return true; }
77 
81  virtual bool IsChunked() const { return false; }
82 
86  inline virtual void SetRequestSignedHandler(const RequestSignedHandler& handler) { m_onRequestSigned = handler; }
90  inline virtual const RequestSignedHandler& GetRequestSignedHandler() const { return m_onRequestSigned; }
91 
95  const Aws::IOStreamFactory& GetResponseStreamFactory() const { return m_responseStreamFactory; }
99  void SetResponseStreamFactory(const Aws::IOStreamFactory& factory) { m_responseStreamFactory = factory; }
103  inline virtual void SetDataReceivedEventHandler(const Aws::Http::DataReceivedEventHandler& dataReceivedEventHandler) { m_onDataReceived = dataReceivedEventHandler; }
107  inline virtual void SetDataSentEventHandler(const Aws::Http::DataSentEventHandler& dataSentEventHandler) { m_onDataSent = dataSentEventHandler; }
111  inline virtual void SetContinueRequestHandler(const Aws::Http::ContinueRequestHandler& continueRequestHandler) { m_continueRequest = continueRequestHandler; }
115  inline virtual void SetDataReceivedEventHandler(Aws::Http::DataReceivedEventHandler&& dataReceivedEventHandler) { m_onDataReceived = std::move(dataReceivedEventHandler); }
119  inline virtual void SetDataSentEventHandler(Aws::Http::DataSentEventHandler&& dataSentEventHandler) { m_onDataSent = std::move(dataSentEventHandler); }
123  inline virtual void SetContinueRequestHandler(Aws::Http::ContinueRequestHandler&& continueRequestHandler) { m_continueRequest = std::move(continueRequestHandler); }
127  inline virtual void SetRequestRetryHandler(const RequestRetryHandler& handler) { m_requestRetryHandler = handler; }
131  inline virtual void SetRequestRetryHandler(RequestRetryHandler&& handler) { m_requestRetryHandler = std::move(handler); }
135  inline virtual const Aws::Http::DataReceivedEventHandler& GetDataReceivedEventHandler() const { return m_onDataReceived; }
139  inline virtual const Aws::Http::DataSentEventHandler& GetDataSentEventHandler() const { return m_onDataSent; }
143  inline virtual const Aws::Http::ContinueRequestHandler& GetContinueRequestHandler() const { return m_continueRequest; }
147  inline virtual const RequestRetryHandler& GetRequestRetryHandler() const { return m_requestRetryHandler; }
151  inline virtual bool ShouldComputeContentMd5() const { return false; }
152 
153  virtual const char* GetServiceRequestName() const = 0;
154 
155  protected:
160  virtual void DumpBodyToUrl(Aws::Http::URI& uri) const { AWS_UNREFERENCED_PARAM(uri); }
161 
162  private:
163  Aws::IOStreamFactory m_responseStreamFactory;
164 
165  Aws::Http::DataReceivedEventHandler m_onDataReceived;
166  Aws::Http::DataSentEventHandler m_onDataSent;
167  Aws::Http::ContinueRequestHandler m_continueRequest;
168  RequestSignedHandler m_onRequestSigned;
169  RequestRetryHandler m_requestRetryHandler;
170  };
171 
172 } // namespace Aws
173 
std::function< bool(const HttpRequest *)> ContinueRequestHandler
Definition: HttpRequest.h:60
void SetResponseStreamFactory(const Aws::IOStreamFactory &factory)
virtual const Aws::Http::ContinueRequestHandler & GetContinueRequestHandler() const
virtual void DumpBodyToUrl(Aws::Http::URI &uri) const
std::function< void(const Aws::Http::HttpRequest &)> RequestSignedHandler
virtual const RequestRetryHandler & GetRequestRetryHandler() const
virtual void SetDataSentEventHandler(const Aws::Http::DataSentEventHandler &dataSentEventHandler)
Aws::Map< Aws::String, Aws::String > HeaderValueCollection
Definition: HttpTypes.h:53
virtual void SetRequestRetryHandler(const RequestRetryHandler &handler)
virtual void SetContinueRequestHandler(Aws::Http::ContinueRequestHandler &&continueRequestHandler)
std::function< void(const HttpRequest *, long long)> DataSentEventHandler
Definition: HttpRequest.h:56
virtual void SetDataReceivedEventHandler(const Aws::Http::DataReceivedEventHandler &dataReceivedEventHandler)
virtual void SetDataReceivedEventHandler(Aws::Http::DataReceivedEventHandler &&dataReceivedEventHandler)
virtual const Aws::Http::DataSentEventHandler & GetDataSentEventHandler() const
virtual void SetRequestRetryHandler(RequestRetryHandler &&handler)
virtual void AddQueryStringParameters(Aws::Http::URI &uri) const
#define AWS_UNREFERENCED_PARAM(x)
virtual void SetContinueRequestHandler(const Aws::Http::ContinueRequestHandler &continueRequestHandler)
std::function< void(const AmazonWebServiceRequest &)> RequestRetryHandler
virtual void PutToPresignedUrl(Aws::Http::URI &uri) const
virtual const Aws::Http::DataReceivedEventHandler & GetDataReceivedEventHandler() const
const Aws::IOStreamFactory & GetResponseStreamFactory() const
virtual void SetRequestSignedHandler(const RequestSignedHandler &handler)
virtual bool ShouldComputeContentMd5() const
virtual bool IsEventStreamRequest() const
virtual void SetDataSentEventHandler(Aws::Http::DataSentEventHandler &&dataSentEventHandler)
#define AWS_CORE_API
Definition: Core_EXPORTS.h:25
virtual const RequestSignedHandler & GetRequestSignedHandler() const
std::function< Aws::IOStream *(void) > IOStreamFactory
Definition: AWSStreamFwd.h:25
std::function< void(const HttpRequest *, HttpResponse *, long long)> DataReceivedEventHandler
Definition: HttpRequest.h:47