/** * 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 FIS { namespace Model { ExperimentTemplate::ExperimentTemplate() : m_idHasBeenSet(false), m_descriptionHasBeenSet(false), m_targetsHasBeenSet(false), m_actionsHasBeenSet(false), m_stopConditionsHasBeenSet(false), m_creationTimeHasBeenSet(false), m_lastUpdateTimeHasBeenSet(false), m_roleArnHasBeenSet(false), m_tagsHasBeenSet(false), m_logConfigurationHasBeenSet(false) { } ExperimentTemplate::ExperimentTemplate(JsonView jsonValue) : m_idHasBeenSet(false), m_descriptionHasBeenSet(false), m_targetsHasBeenSet(false), m_actionsHasBeenSet(false), m_stopConditionsHasBeenSet(false), m_creationTimeHasBeenSet(false), m_lastUpdateTimeHasBeenSet(false), m_roleArnHasBeenSet(false), m_tagsHasBeenSet(false), m_logConfigurationHasBeenSet(false) { *this = jsonValue; } ExperimentTemplate& ExperimentTemplate::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("id")) { m_id = jsonValue.GetString("id"); m_idHasBeenSet = true; } if(jsonValue.ValueExists("description")) { m_description = jsonValue.GetString("description"); m_descriptionHasBeenSet = true; } if(jsonValue.ValueExists("targets")) { Aws::Map targetsJsonMap = jsonValue.GetObject("targets").GetAllObjects(); for(auto& targetsItem : targetsJsonMap) { m_targets[targetsItem.first] = targetsItem.second.AsObject(); } m_targetsHasBeenSet = true; } if(jsonValue.ValueExists("actions")) { Aws::Map actionsJsonMap = jsonValue.GetObject("actions").GetAllObjects(); for(auto& actionsItem : actionsJsonMap) { m_actions[actionsItem.first] = actionsItem.second.AsObject(); } m_actionsHasBeenSet = true; } if(jsonValue.ValueExists("stopConditions")) { Aws::Utils::Array stopConditionsJsonList = jsonValue.GetArray("stopConditions"); for(unsigned stopConditionsIndex = 0; stopConditionsIndex < stopConditionsJsonList.GetLength(); ++stopConditionsIndex) { m_stopConditions.push_back(stopConditionsJsonList[stopConditionsIndex].AsObject()); } m_stopConditionsHasBeenSet = true; } if(jsonValue.ValueExists("creationTime")) { m_creationTime = jsonValue.GetDouble("creationTime"); m_creationTimeHasBeenSet = true; } if(jsonValue.ValueExists("lastUpdateTime")) { m_lastUpdateTime = jsonValue.GetDouble("lastUpdateTime"); m_lastUpdateTimeHasBeenSet = true; } if(jsonValue.ValueExists("roleArn")) { m_roleArn = jsonValue.GetString("roleArn"); m_roleArnHasBeenSet = true; } if(jsonValue.ValueExists("tags")) { Aws::Map tagsJsonMap = jsonValue.GetObject("tags").GetAllObjects(); for(auto& tagsItem : tagsJsonMap) { m_tags[tagsItem.first] = tagsItem.second.AsString(); } m_tagsHasBeenSet = true; } if(jsonValue.ValueExists("logConfiguration")) { m_logConfiguration = jsonValue.GetObject("logConfiguration"); m_logConfigurationHasBeenSet = true; } return *this; } JsonValue ExperimentTemplate::Jsonize() const { JsonValue payload; if(m_idHasBeenSet) { payload.WithString("id", m_id); } if(m_descriptionHasBeenSet) { payload.WithString("description", m_description); } if(m_targetsHasBeenSet) { JsonValue targetsJsonMap; for(auto& targetsItem : m_targets) { targetsJsonMap.WithObject(targetsItem.first, targetsItem.second.Jsonize()); } payload.WithObject("targets", std::move(targetsJsonMap)); } if(m_actionsHasBeenSet) { JsonValue actionsJsonMap; for(auto& actionsItem : m_actions) { actionsJsonMap.WithObject(actionsItem.first, actionsItem.second.Jsonize()); } payload.WithObject("actions", std::move(actionsJsonMap)); } if(m_stopConditionsHasBeenSet) { Aws::Utils::Array stopConditionsJsonList(m_stopConditions.size()); for(unsigned stopConditionsIndex = 0; stopConditionsIndex < stopConditionsJsonList.GetLength(); ++stopConditionsIndex) { stopConditionsJsonList[stopConditionsIndex].AsObject(m_stopConditions[stopConditionsIndex].Jsonize()); } payload.WithArray("stopConditions", std::move(stopConditionsJsonList)); } if(m_creationTimeHasBeenSet) { payload.WithDouble("creationTime", m_creationTime.SecondsWithMSPrecision()); } if(m_lastUpdateTimeHasBeenSet) { payload.WithDouble("lastUpdateTime", m_lastUpdateTime.SecondsWithMSPrecision()); } if(m_roleArnHasBeenSet) { payload.WithString("roleArn", m_roleArn); } if(m_tagsHasBeenSet) { JsonValue tagsJsonMap; for(auto& tagsItem : m_tags) { tagsJsonMap.WithString(tagsItem.first, tagsItem.second); } payload.WithObject("tags", std::move(tagsJsonMap)); } if(m_logConfigurationHasBeenSet) { payload.WithObject("logConfiguration", m_logConfiguration.Jsonize()); } return payload; } } // namespace Model } // namespace FIS } // namespace Aws