AWS SDK for C++  0.14.3
AWS SDK for C++
AmazonWebServiceRequest.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 
27 
28 namespace Aws
29 {
30  namespace Http
31  {
32  class URI;
33  } // namespace Http
34 
39  {
40  public:
45  virtual ~AmazonWebServiceRequest() = default;
46 
50  virtual std::shared_ptr<Aws::IOStream> GetBody() const = 0;
54  virtual Aws::Http::HeaderValueCollection GetHeaders() const = 0;
62  const Aws::IOStreamFactory& GetResponseStreamFactory() const { return m_responseStreamFactory; }
66  void SetResponseStreamFactory(const Aws::IOStreamFactory& factory) { m_responseStreamFactory = AWS_BUILD_FUNCTION(factory); }
70  inline virtual void SetDataReceivedEventHandler(const Aws::Http::DataReceivedEventHandler& dataReceivedEventHandler) { m_onDataReceived = dataReceivedEventHandler; }
74  inline virtual void SetDataSentEventHandler(const Aws::Http::DataSentEventHandler& dataSentEventHandler) { m_onDataSent = dataSentEventHandler; }
78  inline virtual void SetDataReceivedEventHandler(Aws::Http::DataReceivedEventHandler&& dataReceivedEventHandler) { m_onDataReceived = dataReceivedEventHandler; }
82  inline virtual void SetDataSentEventHandler(Aws::Http::DataSentEventHandler&& dataSentEventHandler) { m_onDataSent = dataSentEventHandler; }
86  inline virtual const Aws::Http::DataReceivedEventHandler& GetDataReceivedEventHandler() const { return m_onDataReceived; }
90  inline virtual const Aws::Http::DataSentEventHandler& GetDataSentEventHandler() const { return m_onDataSent; }
94  inline virtual bool ShouldComputeContentMd5() const { return false; }
95 
96 
97  private:
98 
99  Aws::IOStreamFactory m_responseStreamFactory;
100 
101  Aws::Http::DataReceivedEventHandler m_onDataReceived;
102  Aws::Http::DataSentEventHandler m_onDataSent;
103  };
104 
105 } // namespace Aws
106 
virtual bool ShouldComputeContentMd5() const
void SetResponseStreamFactory(const Aws::IOStreamFactory &factory)
virtual const Aws::Http::DataReceivedEventHandler & GetDataReceivedEventHandler() const
virtual void AddQueryStringParameters(Aws::Http::URI &uri) const
virtual void SetDataSentEventHandler(const Aws::Http::DataSentEventHandler &dataSentEventHandler)
Aws::Map< Aws::String, Aws::String > HeaderValueCollection
Definition: HttpTypes.h:63
std::function< void(const HttpRequest *, long long)> DataSentEventHandler
Definition: HttpRequest.h:60
virtual void SetDataReceivedEventHandler(const Aws::Http::DataReceivedEventHandler &dataReceivedEventHandler)
virtual void SetDataReceivedEventHandler(Aws::Http::DataReceivedEventHandler &&dataReceivedEventHandler)
const Aws::IOStreamFactory & GetResponseStreamFactory() const
#define AWS_UNREFERENCED_PARAM(x)
#define AWS_BUILD_FUNCTION(func)
Definition: AWSFunction.h:79
virtual const Aws::Http::DataSentEventHandler & GetDataSentEventHandler() const
virtual void SetDataSentEventHandler(Aws::Http::DataSentEventHandler &&dataSentEventHandler)
#define AWS_CORE_API
Definition: Core_EXPORTS.h:35
std::function< Aws::IOStream *(void) > IOStreamFactory
Definition: AWSStreamFwd.h:35
std::function< void(const HttpRequest *, HttpResponse *, long long)> DataReceivedEventHandler
Definition: HttpRequest.h:51
JSON (JavaScript Object Notation).