1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/groundstation/model/SatelliteListItem.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 GroundStation
17 {
18 namespace Model
19 {
20 
SatelliteListItem()21 SatelliteListItem::SatelliteListItem() :
22     m_groundStationsHasBeenSet(false),
23     m_noradSatelliteID(0),
24     m_noradSatelliteIDHasBeenSet(false),
25     m_satelliteArnHasBeenSet(false),
26     m_satelliteIdHasBeenSet(false)
27 {
28 }
29 
SatelliteListItem(JsonView jsonValue)30 SatelliteListItem::SatelliteListItem(JsonView jsonValue) :
31     m_groundStationsHasBeenSet(false),
32     m_noradSatelliteID(0),
33     m_noradSatelliteIDHasBeenSet(false),
34     m_satelliteArnHasBeenSet(false),
35     m_satelliteIdHasBeenSet(false)
36 {
37   *this = jsonValue;
38 }
39 
operator =(JsonView jsonValue)40 SatelliteListItem& SatelliteListItem::operator =(JsonView jsonValue)
41 {
42   if(jsonValue.ValueExists("groundStations"))
43   {
44     Array<JsonView> groundStationsJsonList = jsonValue.GetArray("groundStations");
45     for(unsigned groundStationsIndex = 0; groundStationsIndex < groundStationsJsonList.GetLength(); ++groundStationsIndex)
46     {
47       m_groundStations.push_back(groundStationsJsonList[groundStationsIndex].AsString());
48     }
49     m_groundStationsHasBeenSet = true;
50   }
51 
52   if(jsonValue.ValueExists("noradSatelliteID"))
53   {
54     m_noradSatelliteID = jsonValue.GetInteger("noradSatelliteID");
55 
56     m_noradSatelliteIDHasBeenSet = true;
57   }
58 
59   if(jsonValue.ValueExists("satelliteArn"))
60   {
61     m_satelliteArn = jsonValue.GetString("satelliteArn");
62 
63     m_satelliteArnHasBeenSet = true;
64   }
65 
66   if(jsonValue.ValueExists("satelliteId"))
67   {
68     m_satelliteId = jsonValue.GetString("satelliteId");
69 
70     m_satelliteIdHasBeenSet = true;
71   }
72 
73   return *this;
74 }
75 
Jsonize() const76 JsonValue SatelliteListItem::Jsonize() const
77 {
78   JsonValue payload;
79 
80   if(m_groundStationsHasBeenSet)
81   {
82    Array<JsonValue> groundStationsJsonList(m_groundStations.size());
83    for(unsigned groundStationsIndex = 0; groundStationsIndex < groundStationsJsonList.GetLength(); ++groundStationsIndex)
84    {
85      groundStationsJsonList[groundStationsIndex].AsString(m_groundStations[groundStationsIndex]);
86    }
87    payload.WithArray("groundStations", std::move(groundStationsJsonList));
88 
89   }
90 
91   if(m_noradSatelliteIDHasBeenSet)
92   {
93    payload.WithInteger("noradSatelliteID", m_noradSatelliteID);
94 
95   }
96 
97   if(m_satelliteArnHasBeenSet)
98   {
99    payload.WithString("satelliteArn", m_satelliteArn);
100 
101   }
102 
103   if(m_satelliteIdHasBeenSet)
104   {
105    payload.WithString("satelliteId", m_satelliteId);
106 
107   }
108 
109   return payload;
110 }
111 
112 } // namespace Model
113 } // namespace GroundStation
114 } // namespace Aws
115