/** * 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 SSM { namespace Model { Runbook::Runbook() : m_documentNameHasBeenSet(false), m_documentVersionHasBeenSet(false), m_parametersHasBeenSet(false), m_targetParameterNameHasBeenSet(false), m_targetsHasBeenSet(false), m_targetMapsHasBeenSet(false), m_maxConcurrencyHasBeenSet(false), m_maxErrorsHasBeenSet(false), m_targetLocationsHasBeenSet(false) { } Runbook::Runbook(JsonView jsonValue) : m_documentNameHasBeenSet(false), m_documentVersionHasBeenSet(false), m_parametersHasBeenSet(false), m_targetParameterNameHasBeenSet(false), m_targetsHasBeenSet(false), m_targetMapsHasBeenSet(false), m_maxConcurrencyHasBeenSet(false), m_maxErrorsHasBeenSet(false), m_targetLocationsHasBeenSet(false) { *this = jsonValue; } Runbook& Runbook::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("DocumentName")) { m_documentName = jsonValue.GetString("DocumentName"); m_documentNameHasBeenSet = true; } if(jsonValue.ValueExists("DocumentVersion")) { m_documentVersion = jsonValue.GetString("DocumentVersion"); m_documentVersionHasBeenSet = true; } if(jsonValue.ValueExists("Parameters")) { Aws::Map parametersJsonMap = jsonValue.GetObject("Parameters").GetAllObjects(); for(auto& parametersItem : parametersJsonMap) { Aws::Utils::Array automationParameterValueListJsonList = parametersItem.second.AsArray(); Aws::Vector automationParameterValueListList; automationParameterValueListList.reserve((size_t)automationParameterValueListJsonList.GetLength()); for(unsigned automationParameterValueListIndex = 0; automationParameterValueListIndex < automationParameterValueListJsonList.GetLength(); ++automationParameterValueListIndex) { automationParameterValueListList.push_back(automationParameterValueListJsonList[automationParameterValueListIndex].AsString()); } m_parameters[parametersItem.first] = std::move(automationParameterValueListList); } m_parametersHasBeenSet = true; } if(jsonValue.ValueExists("TargetParameterName")) { m_targetParameterName = jsonValue.GetString("TargetParameterName"); m_targetParameterNameHasBeenSet = true; } if(jsonValue.ValueExists("Targets")) { Aws::Utils::Array targetsJsonList = jsonValue.GetArray("Targets"); for(unsigned targetsIndex = 0; targetsIndex < targetsJsonList.GetLength(); ++targetsIndex) { m_targets.push_back(targetsJsonList[targetsIndex].AsObject()); } m_targetsHasBeenSet = true; } if(jsonValue.ValueExists("TargetMaps")) { Aws::Utils::Array targetMapsJsonList = jsonValue.GetArray("TargetMaps"); for(unsigned targetMapsIndex = 0; targetMapsIndex < targetMapsJsonList.GetLength(); ++targetMapsIndex) { Aws::Map targetMapJsonMap = targetMapsJsonList[targetMapsIndex].GetAllObjects(); Aws::Map> targetMapMap; for(auto& targetMapItem : targetMapJsonMap) { Aws::Utils::Array targetMapValueListJsonList = targetMapItem.second.AsArray(); Aws::Vector targetMapValueListList; targetMapValueListList.reserve((size_t)targetMapValueListJsonList.GetLength()); for(unsigned targetMapValueListIndex = 0; targetMapValueListIndex < targetMapValueListJsonList.GetLength(); ++targetMapValueListIndex) { targetMapValueListList.push_back(targetMapValueListJsonList[targetMapValueListIndex].AsString()); } targetMapMap[targetMapItem.first] = std::move(targetMapValueListList); } m_targetMaps.push_back(std::move(targetMapMap)); } m_targetMapsHasBeenSet = true; } if(jsonValue.ValueExists("MaxConcurrency")) { m_maxConcurrency = jsonValue.GetString("MaxConcurrency"); m_maxConcurrencyHasBeenSet = true; } if(jsonValue.ValueExists("MaxErrors")) { m_maxErrors = jsonValue.GetString("MaxErrors"); m_maxErrorsHasBeenSet = true; } if(jsonValue.ValueExists("TargetLocations")) { Aws::Utils::Array targetLocationsJsonList = jsonValue.GetArray("TargetLocations"); for(unsigned targetLocationsIndex = 0; targetLocationsIndex < targetLocationsJsonList.GetLength(); ++targetLocationsIndex) { m_targetLocations.push_back(targetLocationsJsonList[targetLocationsIndex].AsObject()); } m_targetLocationsHasBeenSet = true; } return *this; } JsonValue Runbook::Jsonize() const { JsonValue payload; if(m_documentNameHasBeenSet) { payload.WithString("DocumentName", m_documentName); } if(m_documentVersionHasBeenSet) { payload.WithString("DocumentVersion", m_documentVersion); } if(m_parametersHasBeenSet) { JsonValue parametersJsonMap; for(auto& parametersItem : m_parameters) { Aws::Utils::Array automationParameterValueListJsonList(parametersItem.second.size()); for(unsigned automationParameterValueListIndex = 0; automationParameterValueListIndex < automationParameterValueListJsonList.GetLength(); ++automationParameterValueListIndex) { automationParameterValueListJsonList[automationParameterValueListIndex].AsString(parametersItem.second[automationParameterValueListIndex]); } parametersJsonMap.WithArray(parametersItem.first, std::move(automationParameterValueListJsonList)); } payload.WithObject("Parameters", std::move(parametersJsonMap)); } if(m_targetParameterNameHasBeenSet) { payload.WithString("TargetParameterName", m_targetParameterName); } if(m_targetsHasBeenSet) { Aws::Utils::Array targetsJsonList(m_targets.size()); for(unsigned targetsIndex = 0; targetsIndex < targetsJsonList.GetLength(); ++targetsIndex) { targetsJsonList[targetsIndex].AsObject(m_targets[targetsIndex].Jsonize()); } payload.WithArray("Targets", std::move(targetsJsonList)); } if(m_targetMapsHasBeenSet) { Aws::Utils::Array targetMapsJsonList(m_targetMaps.size()); for(unsigned targetMapsIndex = 0; targetMapsIndex < targetMapsJsonList.GetLength(); ++targetMapsIndex) { JsonValue targetMapJsonMap; for(auto& targetMapItem : m_targetMaps[targetMapsIndex]) { Aws::Utils::Array targetMapValueListJsonList(targetMapItem.second.size()); for(unsigned targetMapValueListIndex = 0; targetMapValueListIndex < targetMapValueListJsonList.GetLength(); ++targetMapValueListIndex) { targetMapValueListJsonList[targetMapValueListIndex].AsString(targetMapItem.second[targetMapValueListIndex]); } targetMapJsonMap.WithArray(targetMapItem.first, std::move(targetMapValueListJsonList)); } targetMapsJsonList[targetMapsIndex].AsObject(std::move(targetMapJsonMap)); } payload.WithArray("TargetMaps", std::move(targetMapsJsonList)); } if(m_maxConcurrencyHasBeenSet) { payload.WithString("MaxConcurrency", m_maxConcurrency); } if(m_maxErrorsHasBeenSet) { payload.WithString("MaxErrors", m_maxErrors); } if(m_targetLocationsHasBeenSet) { Aws::Utils::Array targetLocationsJsonList(m_targetLocations.size()); for(unsigned targetLocationsIndex = 0; targetLocationsIndex < targetLocationsJsonList.GetLength(); ++targetLocationsIndex) { targetLocationsJsonList[targetLocationsIndex].AsObject(m_targetLocations[targetLocationsIndex].Jsonize()); } payload.WithArray("TargetLocations", std::move(targetLocationsJsonList)); } return payload; } } // namespace Model } // namespace SSM } // namespace Aws