1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/mgn/model/GetLaunchConfigurationResult.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8 #include <aws/core/AmazonWebServiceResult.h>
9 #include <aws/core/utils/StringUtils.h>
10 #include <aws/core/utils/UnreferencedParam.h>
11 
12 #include <utility>
13 
14 using namespace Aws::mgn::Model;
15 using namespace Aws::Utils::Json;
16 using namespace Aws::Utils;
17 using namespace Aws;
18 
GetLaunchConfigurationResult()19 GetLaunchConfigurationResult::GetLaunchConfigurationResult() :
20     m_copyPrivateIp(false),
21     m_copyTags(false),
22     m_launchDisposition(LaunchDisposition::NOT_SET),
23     m_targetInstanceTypeRightSizingMethod(TargetInstanceTypeRightSizingMethod::NOT_SET)
24 {
25 }
26 
GetLaunchConfigurationResult(const Aws::AmazonWebServiceResult<JsonValue> & result)27 GetLaunchConfigurationResult::GetLaunchConfigurationResult(const Aws::AmazonWebServiceResult<JsonValue>& result) :
28     m_copyPrivateIp(false),
29     m_copyTags(false),
30     m_launchDisposition(LaunchDisposition::NOT_SET),
31     m_targetInstanceTypeRightSizingMethod(TargetInstanceTypeRightSizingMethod::NOT_SET)
32 {
33   *this = result;
34 }
35 
operator =(const Aws::AmazonWebServiceResult<JsonValue> & result)36 GetLaunchConfigurationResult& GetLaunchConfigurationResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
37 {
38   JsonView jsonValue = result.GetPayload().View();
39   if(jsonValue.ValueExists("copyPrivateIp"))
40   {
41     m_copyPrivateIp = jsonValue.GetBool("copyPrivateIp");
42 
43   }
44 
45   if(jsonValue.ValueExists("copyTags"))
46   {
47     m_copyTags = jsonValue.GetBool("copyTags");
48 
49   }
50 
51   if(jsonValue.ValueExists("ec2LaunchTemplateID"))
52   {
53     m_ec2LaunchTemplateID = jsonValue.GetString("ec2LaunchTemplateID");
54 
55   }
56 
57   if(jsonValue.ValueExists("launchDisposition"))
58   {
59     m_launchDisposition = LaunchDispositionMapper::GetLaunchDispositionForName(jsonValue.GetString("launchDisposition"));
60 
61   }
62 
63   if(jsonValue.ValueExists("licensing"))
64   {
65     m_licensing = jsonValue.GetObject("licensing");
66 
67   }
68 
69   if(jsonValue.ValueExists("name"))
70   {
71     m_name = jsonValue.GetString("name");
72 
73   }
74 
75   if(jsonValue.ValueExists("sourceServerID"))
76   {
77     m_sourceServerID = jsonValue.GetString("sourceServerID");
78 
79   }
80 
81   if(jsonValue.ValueExists("targetInstanceTypeRightSizingMethod"))
82   {
83     m_targetInstanceTypeRightSizingMethod = TargetInstanceTypeRightSizingMethodMapper::GetTargetInstanceTypeRightSizingMethodForName(jsonValue.GetString("targetInstanceTypeRightSizingMethod"));
84 
85   }
86 
87 
88 
89   return *this;
90 }
91