AWS SDK for C++  0.14.3
AWS SDK for C++
AmazonWebServiceResult.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 
19 #include <utility>
21 
22 namespace Aws
23 {
27  template <typename PAYLOAD_TYPE>
28  class AmazonWebServiceResult
29  {
30  public:
32 
36  AmazonWebServiceResult(const PAYLOAD_TYPE& payload, const Http::HeaderValueCollection& headers, Http::HttpResponseCode responseCode = Http::HttpResponseCode::OK) :
37  m_payload(payload),
38  m_responseHeaders(headers),
39  m_responseCode(responseCode)
40  {}
41 
46  m_payload(std::forward<PAYLOAD_TYPE>(payload)),
47  m_responseHeaders(std::forward<Http::HeaderValueCollection>(headers)),
48  m_responseCode(responseCode)
49  {}
50 
52  m_payload(result.m_payload),
53  m_responseHeaders(result.m_responseHeaders),
54  m_responseCode(result.m_responseCode)
55  {}
56 
58  m_payload(std::move(result.m_payload)),
59  m_responseHeaders(std::move(result.m_responseHeaders)),
60  m_responseCode(result.m_responseCode)
61  {}
62 
66  inline const PAYLOAD_TYPE& GetPayload() const { return m_payload; }
70  inline PAYLOAD_TYPE TakeOwnershipOfPayload() { return std::move(m_payload); }
74  inline const Http::HeaderValueCollection& GetHeaderValueCollection() const { return m_responseHeaders; }
78  inline Http::HttpResponseCode GetResponseCode() const { return m_responseCode; }
79 
80  private:
81  PAYLOAD_TYPE m_payload;
82  Http::HeaderValueCollection m_responseHeaders;
83  Http::HttpResponseCode m_responseCode;
84  };
85 
86 
87 }
AmazonWebServiceResult(AmazonWebServiceResult &&result)
STL namespace.
Aws::Map< Aws::String, Aws::String > HeaderValueCollection
Definition: HttpTypes.h:63
const Http::HeaderValueCollection & GetHeaderValueCollection() const
AmazonWebServiceResult(PAYLOAD_TYPE &&payload, Http::HeaderValueCollection &&headers, Http::HttpResponseCode responseCode=Http::HttpResponseCode::OK)
AmazonWebServiceResult(const AmazonWebServiceResult &result)
const PAYLOAD_TYPE & GetPayload() const
AmazonWebServiceResult(const PAYLOAD_TYPE &payload, const Http::HeaderValueCollection &headers, Http::HttpResponseCode responseCode=Http::HttpResponseCode::OK)
Http::HttpResponseCode GetResponseCode() const
JSON (JavaScript Object Notation).