/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::SSM::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; StartAutomationExecutionRequest::StartAutomationExecutionRequest() : m_documentNameHasBeenSet(false), m_documentVersionHasBeenSet(false), m_parametersHasBeenSet(false), m_clientTokenHasBeenSet(false), m_mode(ExecutionMode::NOT_SET), m_modeHasBeenSet(false), m_targetParameterNameHasBeenSet(false), m_targetsHasBeenSet(false), m_targetMapsHasBeenSet(false), m_maxConcurrencyHasBeenSet(false), m_maxErrorsHasBeenSet(false), m_targetLocationsHasBeenSet(false), m_tagsHasBeenSet(false), m_alarmConfigurationHasBeenSet(false) { } Aws::String StartAutomationExecutionRequest::SerializePayload() 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_clientTokenHasBeenSet) { payload.WithString("ClientToken", m_clientToken); } if(m_modeHasBeenSet) { payload.WithString("Mode", ExecutionModeMapper::GetNameForExecutionMode(m_mode)); } 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)); } if(m_tagsHasBeenSet) { Aws::Utils::Array tagsJsonList(m_tags.size()); for(unsigned tagsIndex = 0; tagsIndex < tagsJsonList.GetLength(); ++tagsIndex) { tagsJsonList[tagsIndex].AsObject(m_tags[tagsIndex].Jsonize()); } payload.WithArray("Tags", std::move(tagsJsonList)); } if(m_alarmConfigurationHasBeenSet) { payload.WithObject("AlarmConfiguration", m_alarmConfiguration.Jsonize()); } return payload.View().WriteReadable(); } Aws::Http::HeaderValueCollection StartAutomationExecutionRequest::GetRequestSpecificHeaders() const { Aws::Http::HeaderValueCollection headers; headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AmazonSSM.StartAutomationExecution")); return headers; }