1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/apigateway/model/CreateStageResult.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::APIGateway::Model;
15 using namespace Aws::Utils::Json;
16 using namespace Aws::Utils;
17 using namespace Aws;
18 
CreateStageResult()19 CreateStageResult::CreateStageResult() :
20     m_cacheClusterEnabled(false),
21     m_cacheClusterSize(CacheClusterSize::NOT_SET),
22     m_cacheClusterStatus(CacheClusterStatus::NOT_SET),
23     m_tracingEnabled(false)
24 {
25 }
26 
CreateStageResult(const Aws::AmazonWebServiceResult<JsonValue> & result)27 CreateStageResult::CreateStageResult(const Aws::AmazonWebServiceResult<JsonValue>& result) :
28     m_cacheClusterEnabled(false),
29     m_cacheClusterSize(CacheClusterSize::NOT_SET),
30     m_cacheClusterStatus(CacheClusterStatus::NOT_SET),
31     m_tracingEnabled(false)
32 {
33   *this = result;
34 }
35 
operator =(const Aws::AmazonWebServiceResult<JsonValue> & result)36 CreateStageResult& CreateStageResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
37 {
38   JsonView jsonValue = result.GetPayload().View();
39   if(jsonValue.ValueExists("deploymentId"))
40   {
41     m_deploymentId = jsonValue.GetString("deploymentId");
42 
43   }
44 
45   if(jsonValue.ValueExists("clientCertificateId"))
46   {
47     m_clientCertificateId = jsonValue.GetString("clientCertificateId");
48 
49   }
50 
51   if(jsonValue.ValueExists("stageName"))
52   {
53     m_stageName = jsonValue.GetString("stageName");
54 
55   }
56 
57   if(jsonValue.ValueExists("description"))
58   {
59     m_description = jsonValue.GetString("description");
60 
61   }
62 
63   if(jsonValue.ValueExists("cacheClusterEnabled"))
64   {
65     m_cacheClusterEnabled = jsonValue.GetBool("cacheClusterEnabled");
66 
67   }
68 
69   if(jsonValue.ValueExists("cacheClusterSize"))
70   {
71     m_cacheClusterSize = CacheClusterSizeMapper::GetCacheClusterSizeForName(jsonValue.GetString("cacheClusterSize"));
72 
73   }
74 
75   if(jsonValue.ValueExists("cacheClusterStatus"))
76   {
77     m_cacheClusterStatus = CacheClusterStatusMapper::GetCacheClusterStatusForName(jsonValue.GetString("cacheClusterStatus"));
78 
79   }
80 
81   if(jsonValue.ValueExists("methodSettings"))
82   {
83     Aws::Map<Aws::String, JsonView> methodSettingsJsonMap = jsonValue.GetObject("methodSettings").GetAllObjects();
84     for(auto& methodSettingsItem : methodSettingsJsonMap)
85     {
86       m_methodSettings[methodSettingsItem.first] = methodSettingsItem.second.AsObject();
87     }
88   }
89 
90   if(jsonValue.ValueExists("variables"))
91   {
92     Aws::Map<Aws::String, JsonView> variablesJsonMap = jsonValue.GetObject("variables").GetAllObjects();
93     for(auto& variablesItem : variablesJsonMap)
94     {
95       m_variables[variablesItem.first] = variablesItem.second.AsString();
96     }
97   }
98 
99   if(jsonValue.ValueExists("documentationVersion"))
100   {
101     m_documentationVersion = jsonValue.GetString("documentationVersion");
102 
103   }
104 
105   if(jsonValue.ValueExists("accessLogSettings"))
106   {
107     m_accessLogSettings = jsonValue.GetObject("accessLogSettings");
108 
109   }
110 
111   if(jsonValue.ValueExists("canarySettings"))
112   {
113     m_canarySettings = jsonValue.GetObject("canarySettings");
114 
115   }
116 
117   if(jsonValue.ValueExists("tracingEnabled"))
118   {
119     m_tracingEnabled = jsonValue.GetBool("tracingEnabled");
120 
121   }
122 
123   if(jsonValue.ValueExists("webAclArn"))
124   {
125     m_webAclArn = jsonValue.GetString("webAclArn");
126 
127   }
128 
129   if(jsonValue.ValueExists("tags"))
130   {
131     Aws::Map<Aws::String, JsonView> tagsJsonMap = jsonValue.GetObject("tags").GetAllObjects();
132     for(auto& tagsItem : tagsJsonMap)
133     {
134       m_tags[tagsItem.first] = tagsItem.second.AsString();
135     }
136   }
137 
138   if(jsonValue.ValueExists("createdDate"))
139   {
140     m_createdDate = jsonValue.GetDouble("createdDate");
141 
142   }
143 
144   if(jsonValue.ValueExists("lastUpdatedDate"))
145   {
146     m_lastUpdatedDate = jsonValue.GetDouble("lastUpdatedDate");
147 
148   }
149 
150 
151 
152   return *this;
153 }
154