1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/eventbridge/model/DescribeConnectionResult.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::EventBridge::Model;
15 using namespace Aws::Utils::Json;
16 using namespace Aws::Utils;
17 using namespace Aws;
18 
DescribeConnectionResult()19 DescribeConnectionResult::DescribeConnectionResult() :
20     m_connectionState(ConnectionState::NOT_SET),
21     m_authorizationType(ConnectionAuthorizationType::NOT_SET)
22 {
23 }
24 
DescribeConnectionResult(const Aws::AmazonWebServiceResult<JsonValue> & result)25 DescribeConnectionResult::DescribeConnectionResult(const Aws::AmazonWebServiceResult<JsonValue>& result) :
26     m_connectionState(ConnectionState::NOT_SET),
27     m_authorizationType(ConnectionAuthorizationType::NOT_SET)
28 {
29   *this = result;
30 }
31 
operator =(const Aws::AmazonWebServiceResult<JsonValue> & result)32 DescribeConnectionResult& DescribeConnectionResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
33 {
34   JsonView jsonValue = result.GetPayload().View();
35   if(jsonValue.ValueExists("ConnectionArn"))
36   {
37     m_connectionArn = jsonValue.GetString("ConnectionArn");
38 
39   }
40 
41   if(jsonValue.ValueExists("Name"))
42   {
43     m_name = jsonValue.GetString("Name");
44 
45   }
46 
47   if(jsonValue.ValueExists("Description"))
48   {
49     m_description = jsonValue.GetString("Description");
50 
51   }
52 
53   if(jsonValue.ValueExists("ConnectionState"))
54   {
55     m_connectionState = ConnectionStateMapper::GetConnectionStateForName(jsonValue.GetString("ConnectionState"));
56 
57   }
58 
59   if(jsonValue.ValueExists("StateReason"))
60   {
61     m_stateReason = jsonValue.GetString("StateReason");
62 
63   }
64 
65   if(jsonValue.ValueExists("AuthorizationType"))
66   {
67     m_authorizationType = ConnectionAuthorizationTypeMapper::GetConnectionAuthorizationTypeForName(jsonValue.GetString("AuthorizationType"));
68 
69   }
70 
71   if(jsonValue.ValueExists("SecretArn"))
72   {
73     m_secretArn = jsonValue.GetString("SecretArn");
74 
75   }
76 
77   if(jsonValue.ValueExists("AuthParameters"))
78   {
79     m_authParameters = jsonValue.GetObject("AuthParameters");
80 
81   }
82 
83   if(jsonValue.ValueExists("CreationTime"))
84   {
85     m_creationTime = jsonValue.GetDouble("CreationTime");
86 
87   }
88 
89   if(jsonValue.ValueExists("LastModifiedTime"))
90   {
91     m_lastModifiedTime = jsonValue.GetDouble("LastModifiedTime");
92 
93   }
94 
95   if(jsonValue.ValueExists("LastAuthorizedTime"))
96   {
97     m_lastAuthorizedTime = jsonValue.GetDouble("LastAuthorizedTime");
98 
99   }
100 
101 
102 
103   return *this;
104 }
105