1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/codeguru-reviewer/model/RepositoryAssociationSummary.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8 
9 #include <utility>
10 
11 using namespace Aws::Utils::Json;
12 using namespace Aws::Utils;
13 
14 namespace Aws
15 {
16 namespace CodeGuruReviewer
17 {
18 namespace Model
19 {
20 
RepositoryAssociationSummary()21 RepositoryAssociationSummary::RepositoryAssociationSummary() :
22     m_associationArnHasBeenSet(false),
23     m_connectionArnHasBeenSet(false),
24     m_lastUpdatedTimeStampHasBeenSet(false),
25     m_associationIdHasBeenSet(false),
26     m_nameHasBeenSet(false),
27     m_ownerHasBeenSet(false),
28     m_providerType(ProviderType::NOT_SET),
29     m_providerTypeHasBeenSet(false),
30     m_state(RepositoryAssociationState::NOT_SET),
31     m_stateHasBeenSet(false)
32 {
33 }
34 
RepositoryAssociationSummary(JsonView jsonValue)35 RepositoryAssociationSummary::RepositoryAssociationSummary(JsonView jsonValue) :
36     m_associationArnHasBeenSet(false),
37     m_connectionArnHasBeenSet(false),
38     m_lastUpdatedTimeStampHasBeenSet(false),
39     m_associationIdHasBeenSet(false),
40     m_nameHasBeenSet(false),
41     m_ownerHasBeenSet(false),
42     m_providerType(ProviderType::NOT_SET),
43     m_providerTypeHasBeenSet(false),
44     m_state(RepositoryAssociationState::NOT_SET),
45     m_stateHasBeenSet(false)
46 {
47   *this = jsonValue;
48 }
49 
operator =(JsonView jsonValue)50 RepositoryAssociationSummary& RepositoryAssociationSummary::operator =(JsonView jsonValue)
51 {
52   if(jsonValue.ValueExists("AssociationArn"))
53   {
54     m_associationArn = jsonValue.GetString("AssociationArn");
55 
56     m_associationArnHasBeenSet = true;
57   }
58 
59   if(jsonValue.ValueExists("ConnectionArn"))
60   {
61     m_connectionArn = jsonValue.GetString("ConnectionArn");
62 
63     m_connectionArnHasBeenSet = true;
64   }
65 
66   if(jsonValue.ValueExists("LastUpdatedTimeStamp"))
67   {
68     m_lastUpdatedTimeStamp = jsonValue.GetDouble("LastUpdatedTimeStamp");
69 
70     m_lastUpdatedTimeStampHasBeenSet = true;
71   }
72 
73   if(jsonValue.ValueExists("AssociationId"))
74   {
75     m_associationId = jsonValue.GetString("AssociationId");
76 
77     m_associationIdHasBeenSet = true;
78   }
79 
80   if(jsonValue.ValueExists("Name"))
81   {
82     m_name = jsonValue.GetString("Name");
83 
84     m_nameHasBeenSet = true;
85   }
86 
87   if(jsonValue.ValueExists("Owner"))
88   {
89     m_owner = jsonValue.GetString("Owner");
90 
91     m_ownerHasBeenSet = true;
92   }
93 
94   if(jsonValue.ValueExists("ProviderType"))
95   {
96     m_providerType = ProviderTypeMapper::GetProviderTypeForName(jsonValue.GetString("ProviderType"));
97 
98     m_providerTypeHasBeenSet = true;
99   }
100 
101   if(jsonValue.ValueExists("State"))
102   {
103     m_state = RepositoryAssociationStateMapper::GetRepositoryAssociationStateForName(jsonValue.GetString("State"));
104 
105     m_stateHasBeenSet = true;
106   }
107 
108   return *this;
109 }
110 
Jsonize() const111 JsonValue RepositoryAssociationSummary::Jsonize() const
112 {
113   JsonValue payload;
114 
115   if(m_associationArnHasBeenSet)
116   {
117    payload.WithString("AssociationArn", m_associationArn);
118 
119   }
120 
121   if(m_connectionArnHasBeenSet)
122   {
123    payload.WithString("ConnectionArn", m_connectionArn);
124 
125   }
126 
127   if(m_lastUpdatedTimeStampHasBeenSet)
128   {
129    payload.WithDouble("LastUpdatedTimeStamp", m_lastUpdatedTimeStamp.SecondsWithMSPrecision());
130   }
131 
132   if(m_associationIdHasBeenSet)
133   {
134    payload.WithString("AssociationId", m_associationId);
135 
136   }
137 
138   if(m_nameHasBeenSet)
139   {
140    payload.WithString("Name", m_name);
141 
142   }
143 
144   if(m_ownerHasBeenSet)
145   {
146    payload.WithString("Owner", m_owner);
147 
148   }
149 
150   if(m_providerTypeHasBeenSet)
151   {
152    payload.WithString("ProviderType", ProviderTypeMapper::GetNameForProviderType(m_providerType));
153   }
154 
155   if(m_stateHasBeenSet)
156   {
157    payload.WithString("State", RepositoryAssociationStateMapper::GetNameForRepositoryAssociationState(m_state));
158   }
159 
160   return payload;
161 }
162 
163 } // namespace Model
164 } // namespace CodeGuruReviewer
165 } // namespace Aws
166