1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/lookoutmetrics/model/MetricLevelImpact.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 LookoutMetrics
17 {
18 namespace Model
19 {
20 
MetricLevelImpact()21 MetricLevelImpact::MetricLevelImpact() :
22     m_metricNameHasBeenSet(false),
23     m_numTimeSeries(0),
24     m_numTimeSeriesHasBeenSet(false),
25     m_contributionMatrixHasBeenSet(false)
26 {
27 }
28 
MetricLevelImpact(JsonView jsonValue)29 MetricLevelImpact::MetricLevelImpact(JsonView jsonValue) :
30     m_metricNameHasBeenSet(false),
31     m_numTimeSeries(0),
32     m_numTimeSeriesHasBeenSet(false),
33     m_contributionMatrixHasBeenSet(false)
34 {
35   *this = jsonValue;
36 }
37 
operator =(JsonView jsonValue)38 MetricLevelImpact& MetricLevelImpact::operator =(JsonView jsonValue)
39 {
40   if(jsonValue.ValueExists("MetricName"))
41   {
42     m_metricName = jsonValue.GetString("MetricName");
43 
44     m_metricNameHasBeenSet = true;
45   }
46 
47   if(jsonValue.ValueExists("NumTimeSeries"))
48   {
49     m_numTimeSeries = jsonValue.GetInteger("NumTimeSeries");
50 
51     m_numTimeSeriesHasBeenSet = true;
52   }
53 
54   if(jsonValue.ValueExists("ContributionMatrix"))
55   {
56     m_contributionMatrix = jsonValue.GetObject("ContributionMatrix");
57 
58     m_contributionMatrixHasBeenSet = true;
59   }
60 
61   return *this;
62 }
63 
Jsonize() const64 JsonValue MetricLevelImpact::Jsonize() const
65 {
66   JsonValue payload;
67 
68   if(m_metricNameHasBeenSet)
69   {
70    payload.WithString("MetricName", m_metricName);
71 
72   }
73 
74   if(m_numTimeSeriesHasBeenSet)
75   {
76    payload.WithInteger("NumTimeSeries", m_numTimeSeries);
77 
78   }
79 
80   if(m_contributionMatrixHasBeenSet)
81   {
82    payload.WithObject("ContributionMatrix", m_contributionMatrix.Jsonize());
83 
84   }
85 
86   return payload;
87 }
88 
89 } // namespace Model
90 } // namespace LookoutMetrics
91 } // namespace Aws
92