/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace PI { namespace Model { MetricDimensionGroups::MetricDimensionGroups() : m_metricHasBeenSet(false), m_groupsHasBeenSet(false) { } MetricDimensionGroups::MetricDimensionGroups(JsonView jsonValue) : m_metricHasBeenSet(false), m_groupsHasBeenSet(false) { *this = jsonValue; } MetricDimensionGroups& MetricDimensionGroups::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("Metric")) { m_metric = jsonValue.GetString("Metric"); m_metricHasBeenSet = true; } if(jsonValue.ValueExists("Groups")) { Aws::Utils::Array groupsJsonList = jsonValue.GetArray("Groups"); for(unsigned groupsIndex = 0; groupsIndex < groupsJsonList.GetLength(); ++groupsIndex) { m_groups.push_back(groupsJsonList[groupsIndex].AsObject()); } m_groupsHasBeenSet = true; } return *this; } JsonValue MetricDimensionGroups::Jsonize() const { JsonValue payload; if(m_metricHasBeenSet) { payload.WithString("Metric", m_metric); } if(m_groupsHasBeenSet) { Aws::Utils::Array groupsJsonList(m_groups.size()); for(unsigned groupsIndex = 0; groupsIndex < groupsJsonList.GetLength(); ++groupsIndex) { groupsJsonList[groupsIndex].AsObject(m_groups[groupsIndex].Jsonize()); } payload.WithArray("Groups", std::move(groupsJsonList)); } return payload; } } // namespace Model } // namespace PI } // namespace Aws