1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/appconfig/model/GetHostedConfigurationVersionResult.h>
7 #include <aws/core/AmazonWebServiceResult.h>
8 #include <aws/core/utils/StringUtils.h>
9 #include <aws/core/utils/memory/stl/AWSStringStream.h>
10 #include <aws/core/utils/HashingUtils.h>
11 
12 #include <utility>
13 
14 using namespace Aws::AppConfig::Model;
15 using namespace Aws::Utils::Stream;
16 using namespace Aws::Utils;
17 using namespace Aws;
18 
GetHostedConfigurationVersionResult()19 GetHostedConfigurationVersionResult::GetHostedConfigurationVersionResult() :
20     m_versionNumber(0)
21 {
22 }
23 
GetHostedConfigurationVersionResult(GetHostedConfigurationVersionResult && toMove)24 GetHostedConfigurationVersionResult::GetHostedConfigurationVersionResult(GetHostedConfigurationVersionResult&& toMove) :
25     m_applicationId(std::move(toMove.m_applicationId)),
26     m_configurationProfileId(std::move(toMove.m_configurationProfileId)),
27     m_versionNumber(toMove.m_versionNumber),
28     m_description(std::move(toMove.m_description)),
29     m_content(std::move(toMove.m_content)),
30     m_contentType(std::move(toMove.m_contentType))
31 {
32 }
33 
operator =(GetHostedConfigurationVersionResult && toMove)34 GetHostedConfigurationVersionResult& GetHostedConfigurationVersionResult::operator=(GetHostedConfigurationVersionResult&& toMove)
35 {
36    if(this == &toMove)
37    {
38       return *this;
39    }
40 
41    m_applicationId = std::move(toMove.m_applicationId);
42    m_configurationProfileId = std::move(toMove.m_configurationProfileId);
43    m_versionNumber = toMove.m_versionNumber;
44    m_description = std::move(toMove.m_description);
45    m_content = std::move(toMove.m_content);
46    m_contentType = std::move(toMove.m_contentType);
47 
48    return *this;
49 }
50 
GetHostedConfigurationVersionResult(Aws::AmazonWebServiceResult<ResponseStream> && result)51 GetHostedConfigurationVersionResult::GetHostedConfigurationVersionResult(Aws::AmazonWebServiceResult<ResponseStream>&& result) :
52     m_versionNumber(0)
53 {
54   *this = std::move(result);
55 }
56 
operator =(Aws::AmazonWebServiceResult<ResponseStream> && result)57 GetHostedConfigurationVersionResult& GetHostedConfigurationVersionResult::operator =(Aws::AmazonWebServiceResult<ResponseStream>&& result)
58 {
59   m_content = result.TakeOwnershipOfPayload();
60 
61   const auto& headers = result.GetHeaderValueCollection();
62   const auto& applicationIdIter = headers.find("application-id");
63   if(applicationIdIter != headers.end())
64   {
65     m_applicationId = applicationIdIter->second;
66   }
67 
68   const auto& configurationProfileIdIter = headers.find("configuration-profile-id");
69   if(configurationProfileIdIter != headers.end())
70   {
71     m_configurationProfileId = configurationProfileIdIter->second;
72   }
73 
74   const auto& versionNumberIter = headers.find("version-number");
75   if(versionNumberIter != headers.end())
76   {
77      m_versionNumber = StringUtils::ConvertToInt32(versionNumberIter->second.c_str());
78   }
79 
80   const auto& descriptionIter = headers.find("description");
81   if(descriptionIter != headers.end())
82   {
83     m_description = descriptionIter->second;
84   }
85 
86   const auto& contentTypeIter = headers.find("content-type");
87   if(contentTypeIter != headers.end())
88   {
89     m_contentType = contentTypeIter->second;
90   }
91 
92    return *this;
93 }
94