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/PartnerEventSourceAccount.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 EventBridge
17 {
18 namespace Model
19 {
20
PartnerEventSourceAccount()21 PartnerEventSourceAccount::PartnerEventSourceAccount() :
22 m_accountHasBeenSet(false),
23 m_creationTimeHasBeenSet(false),
24 m_expirationTimeHasBeenSet(false),
25 m_state(EventSourceState::NOT_SET),
26 m_stateHasBeenSet(false)
27 {
28 }
29
PartnerEventSourceAccount(JsonView jsonValue)30 PartnerEventSourceAccount::PartnerEventSourceAccount(JsonView jsonValue) :
31 m_accountHasBeenSet(false),
32 m_creationTimeHasBeenSet(false),
33 m_expirationTimeHasBeenSet(false),
34 m_state(EventSourceState::NOT_SET),
35 m_stateHasBeenSet(false)
36 {
37 *this = jsonValue;
38 }
39
operator =(JsonView jsonValue)40 PartnerEventSourceAccount& PartnerEventSourceAccount::operator =(JsonView jsonValue)
41 {
42 if(jsonValue.ValueExists("Account"))
43 {
44 m_account = jsonValue.GetString("Account");
45
46 m_accountHasBeenSet = true;
47 }
48
49 if(jsonValue.ValueExists("CreationTime"))
50 {
51 m_creationTime = jsonValue.GetDouble("CreationTime");
52
53 m_creationTimeHasBeenSet = true;
54 }
55
56 if(jsonValue.ValueExists("ExpirationTime"))
57 {
58 m_expirationTime = jsonValue.GetDouble("ExpirationTime");
59
60 m_expirationTimeHasBeenSet = true;
61 }
62
63 if(jsonValue.ValueExists("State"))
64 {
65 m_state = EventSourceStateMapper::GetEventSourceStateForName(jsonValue.GetString("State"));
66
67 m_stateHasBeenSet = true;
68 }
69
70 return *this;
71 }
72
Jsonize() const73 JsonValue PartnerEventSourceAccount::Jsonize() const
74 {
75 JsonValue payload;
76
77 if(m_accountHasBeenSet)
78 {
79 payload.WithString("Account", m_account);
80
81 }
82
83 if(m_creationTimeHasBeenSet)
84 {
85 payload.WithDouble("CreationTime", m_creationTime.SecondsWithMSPrecision());
86 }
87
88 if(m_expirationTimeHasBeenSet)
89 {
90 payload.WithDouble("ExpirationTime", m_expirationTime.SecondsWithMSPrecision());
91 }
92
93 if(m_stateHasBeenSet)
94 {
95 payload.WithString("State", EventSourceStateMapper::GetNameForEventSourceState(m_state));
96 }
97
98 return payload;
99 }
100
101 } // namespace Model
102 } // namespace EventBridge
103 } // namespace Aws
104