1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/sagemaker/model/DeviceStats.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 SageMaker
17 {
18 namespace Model
19 {
20 
DeviceStats()21 DeviceStats::DeviceStats() :
22     m_connectedDeviceCount(0),
23     m_connectedDeviceCountHasBeenSet(false),
24     m_registeredDeviceCount(0),
25     m_registeredDeviceCountHasBeenSet(false)
26 {
27 }
28 
DeviceStats(JsonView jsonValue)29 DeviceStats::DeviceStats(JsonView jsonValue) :
30     m_connectedDeviceCount(0),
31     m_connectedDeviceCountHasBeenSet(false),
32     m_registeredDeviceCount(0),
33     m_registeredDeviceCountHasBeenSet(false)
34 {
35   *this = jsonValue;
36 }
37 
operator =(JsonView jsonValue)38 DeviceStats& DeviceStats::operator =(JsonView jsonValue)
39 {
40   if(jsonValue.ValueExists("ConnectedDeviceCount"))
41   {
42     m_connectedDeviceCount = jsonValue.GetInt64("ConnectedDeviceCount");
43 
44     m_connectedDeviceCountHasBeenSet = true;
45   }
46 
47   if(jsonValue.ValueExists("RegisteredDeviceCount"))
48   {
49     m_registeredDeviceCount = jsonValue.GetInt64("RegisteredDeviceCount");
50 
51     m_registeredDeviceCountHasBeenSet = true;
52   }
53 
54   return *this;
55 }
56 
Jsonize() const57 JsonValue DeviceStats::Jsonize() const
58 {
59   JsonValue payload;
60 
61   if(m_connectedDeviceCountHasBeenSet)
62   {
63    payload.WithInt64("ConnectedDeviceCount", m_connectedDeviceCount);
64 
65   }
66 
67   if(m_registeredDeviceCountHasBeenSet)
68   {
69    payload.WithInt64("RegisteredDeviceCount", m_registeredDeviceCount);
70 
71   }
72 
73   return payload;
74 }
75 
76 } // namespace Model
77 } // namespace SageMaker
78 } // namespace Aws
79