AWS SDK for C++  1.9.19
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 
25  class AmazonWebServiceRequest;
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;
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 
Aws::AmazonWebServiceRequest
Definition: AmazonWebServiceRequest.h:37
Aws::AmazonWebServiceRequest::IsEventStreamRequest
virtual bool IsEventStreamRequest() const
Definition: AmazonWebServiceRequest.h:72
Aws::Http::URI
Definition: URI.h:32
Aws::AmazonWebServiceRequest::DumpBodyToUrl
virtual void DumpBodyToUrl(Aws::Http::URI &uri) const
Definition: AmazonWebServiceRequest.h:160
AWS_CORE_API
#define AWS_CORE_API
Definition: Core_EXPORTS.h:25
Aws::AmazonWebServiceRequest::IsStreaming
virtual bool IsStreaming() const
Definition: AmazonWebServiceRequest.h:67
Aws::Http::HeaderValueCollection
Aws::Map< Aws::String, Aws::String > HeaderValueCollection
Definition: HttpTypes.h:53
Aws::Http::HttpRequest
Definition: HttpRequest.h:73
Aws::AmazonWebServiceRequest::GetDataReceivedEventHandler
virtual const Aws::Http::DataReceivedEventHandler & GetDataReceivedEventHandler() const
Definition: AmazonWebServiceRequest.h:135
Aws::AmazonWebServiceRequest::SetDataSentEventHandler
virtual void SetDataSentEventHandler(const Aws::Http::DataSentEventHandler &dataSentEventHandler)
Definition: AmazonWebServiceRequest.h:107
Aws::AmazonWebServiceRequest::AddQueryStringParameters
virtual void AddQueryStringParameters(Aws::Http::URI &uri) const
Definition: AmazonWebServiceRequest.h:56
Aws::AmazonWebServiceRequest::ShouldComputeContentMd5
virtual bool ShouldComputeContentMd5() const
Definition: AmazonWebServiceRequest.h:151
Aws::AmazonWebServiceRequest::SetResponseStreamFactory
void SetResponseStreamFactory(const Aws::IOStreamFactory &factory)
Definition: AmazonWebServiceRequest.h:99
AWSStreamFwd.h
HttpRequest.h
Aws::AmazonWebServiceRequest::GetRequestRetryHandler
virtual const RequestRetryHandler & GetRequestRetryHandler() const
Definition: AmazonWebServiceRequest.h:147
Aws::AmazonWebServiceRequest::SetContinueRequestHandler
virtual void SetContinueRequestHandler(const Aws::Http::ContinueRequestHandler &continueRequestHandler)
Definition: AmazonWebServiceRequest.h:111
Aws::RequestSignedHandler
std::function< void(const Aws::Http::HttpRequest &)> RequestSignedHandler
Definition: AmazonWebServiceRequest.h:31
Aws::AmazonWebServiceRequest::PutToPresignedUrl
virtual void PutToPresignedUrl(Aws::Http::URI &uri) const
Definition: AmazonWebServiceRequest.h:62
Aws::Http::DataSentEventHandler
std::function< void(const HttpRequest *, long long)> DataSentEventHandler
Definition: HttpRequest.h:63
Aws::AmazonWebServiceRequest::GetServiceRequestName
virtual const char * GetServiceRequestName() const =0
Aws::AmazonWebServiceRequest::~AmazonWebServiceRequest
virtual ~AmazonWebServiceRequest()=default
Aws::AmazonWebServiceRequest::SignBody
virtual bool SignBody() const
Definition: AmazonWebServiceRequest.h:76
Aws::AmazonWebServiceRequest::GetHeaders
virtual Aws::Http::HeaderValueCollection GetHeaders() const =0
Aws::AmazonWebServiceRequest::GetBody
virtual std::shared_ptr< Aws::IOStream > GetBody() const =0
Aws::AmazonWebServiceRequest::SetDataSentEventHandler
virtual void SetDataSentEventHandler(Aws::Http::DataSentEventHandler &&dataSentEventHandler)
Definition: AmazonWebServiceRequest.h:119
AWSString.h
AWSAuthSigner.h
Aws::AmazonWebServiceRequest::GetRequestSignedHandler
virtual const RequestSignedHandler & GetRequestSignedHandler() const
Definition: AmazonWebServiceRequest.h:90
AWS_UNREFERENCED_PARAM
#define AWS_UNREFERENCED_PARAM(x)
Definition: UnreferencedParam.h:16
Aws::AmazonWebServiceRequest::SetDataReceivedEventHandler
virtual void SetDataReceivedEventHandler(const Aws::Http::DataReceivedEventHandler &dataReceivedEventHandler)
Definition: AmazonWebServiceRequest.h:103
Core_EXPORTS.h
Aws::AmazonWebServiceRequest::GetResponseStreamFactory
const Aws::IOStreamFactory & GetResponseStreamFactory() const
Definition: AmazonWebServiceRequest.h:95
Aws::AmazonWebServiceRequest::SetRequestSignedHandler
virtual void SetRequestSignedHandler(const RequestSignedHandler &handler)
Definition: AmazonWebServiceRequest.h:86
Aws
Definition: AccessManagementClient.h:15
Aws::IOStreamFactory
std::function< Aws::IOStream *(void) > IOStreamFactory
Definition: AWSStreamFwd.h:25
HttpTypes.h
Aws::AmazonWebServiceRequest::GetDataSentEventHandler
virtual const Aws::Http::DataSentEventHandler & GetDataSentEventHandler() const
Definition: AmazonWebServiceRequest.h:139
Aws::AmazonWebServiceRequest::SetContinueRequestHandler
virtual void SetContinueRequestHandler(Aws::Http::ContinueRequestHandler &&continueRequestHandler)
Definition: AmazonWebServiceRequest.h:123
Aws::AmazonWebServiceRequest::GetContinueRequestHandler
virtual const Aws::Http::ContinueRequestHandler & GetContinueRequestHandler() const
Definition: AmazonWebServiceRequest.h:143
Aws::Http::DataReceivedEventHandler
std::function< void(const HttpRequest *, HttpResponse *, long long)> DataReceivedEventHandler
Definition: HttpRequest.h:54
Aws::AmazonWebServiceRequest::SetDataReceivedEventHandler
virtual void SetDataReceivedEventHandler(Aws::Http::DataReceivedEventHandler &&dataReceivedEventHandler)
Definition: AmazonWebServiceRequest.h:115
Aws::AmazonWebServiceRequest::SetRequestRetryHandler
virtual void SetRequestRetryHandler(RequestRetryHandler &&handler)
Definition: AmazonWebServiceRequest.h:131
UnreferencedParam.h
Aws::AmazonWebServiceRequest::AmazonWebServiceRequest
AmazonWebServiceRequest()
Aws::Http::ContinueRequestHandler
std::function< bool(const HttpRequest *)> ContinueRequestHandler
Definition: HttpRequest.h:67
ResponseStream.h
Aws::RequestRetryHandler
std::function< void(const AmazonWebServiceRequest &)> RequestRetryHandler
Definition: AmazonWebServiceRequest.h:25
Aws::AmazonWebServiceRequest::SetRequestRetryHandler
virtual void SetRequestRetryHandler(const RequestRetryHandler &handler)
Definition: AmazonWebServiceRequest.h:127
Aws::AmazonWebServiceRequest::IsChunked
virtual bool IsChunked() const
Definition: AmazonWebServiceRequest.h:81