/** * 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; UpdateAssociationRequest::UpdateAssociationRequest() : m_associationIdHasBeenSet(false), m_parametersHasBeenSet(false), m_documentVersionHasBeenSet(false), m_scheduleExpressionHasBeenSet(false), m_outputLocationHasBeenSet(false), m_nameHasBeenSet(false), m_targetsHasBeenSet(false), m_associationNameHasBeenSet(false), m_associationVersionHasBeenSet(false), m_automationTargetParameterNameHasBeenSet(false), m_maxErrorsHasBeenSet(false), m_maxConcurrencyHasBeenSet(false), m_complianceSeverity(AssociationComplianceSeverity::NOT_SET), m_complianceSeverityHasBeenSet(false), m_syncCompliance(AssociationSyncCompliance::NOT_SET), m_syncComplianceHasBeenSet(false), m_applyOnlyAtCronInterval(false), m_applyOnlyAtCronIntervalHasBeenSet(false), m_calendarNamesHasBeenSet(false), m_targetLocationsHasBeenSet(false), m_scheduleOffset(0), m_scheduleOffsetHasBeenSet(false), m_targetMapsHasBeenSet(false), m_alarmConfigurationHasBeenSet(false) { } Aws::String UpdateAssociationRequest::SerializePayload() const { JsonValue payload; if(m_associationIdHasBeenSet) { payload.WithString("AssociationId", m_associationId); } if(m_parametersHasBeenSet) { JsonValue parametersJsonMap; for(auto& parametersItem : m_parameters) { Aws::Utils::Array parameterValueListJsonList(parametersItem.second.size()); for(unsigned parameterValueListIndex = 0; parameterValueListIndex < parameterValueListJsonList.GetLength(); ++parameterValueListIndex) { parameterValueListJsonList[parameterValueListIndex].AsString(parametersItem.second[parameterValueListIndex]); } parametersJsonMap.WithArray(parametersItem.first, std::move(parameterValueListJsonList)); } payload.WithObject("Parameters", std::move(parametersJsonMap)); } if(m_documentVersionHasBeenSet) { payload.WithString("DocumentVersion", m_documentVersion); } if(m_scheduleExpressionHasBeenSet) { payload.WithString("ScheduleExpression", m_scheduleExpression); } if(m_outputLocationHasBeenSet) { payload.WithObject("OutputLocation", m_outputLocation.Jsonize()); } if(m_nameHasBeenSet) { payload.WithString("Name", m_name); } 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_associationNameHasBeenSet) { payload.WithString("AssociationName", m_associationName); } if(m_associationVersionHasBeenSet) { payload.WithString("AssociationVersion", m_associationVersion); } if(m_automationTargetParameterNameHasBeenSet) { payload.WithString("AutomationTargetParameterName", m_automationTargetParameterName); } if(m_maxErrorsHasBeenSet) { payload.WithString("MaxErrors", m_maxErrors); } if(m_maxConcurrencyHasBeenSet) { payload.WithString("MaxConcurrency", m_maxConcurrency); } if(m_complianceSeverityHasBeenSet) { payload.WithString("ComplianceSeverity", AssociationComplianceSeverityMapper::GetNameForAssociationComplianceSeverity(m_complianceSeverity)); } if(m_syncComplianceHasBeenSet) { payload.WithString("SyncCompliance", AssociationSyncComplianceMapper::GetNameForAssociationSyncCompliance(m_syncCompliance)); } if(m_applyOnlyAtCronIntervalHasBeenSet) { payload.WithBool("ApplyOnlyAtCronInterval", m_applyOnlyAtCronInterval); } if(m_calendarNamesHasBeenSet) { Aws::Utils::Array calendarNamesJsonList(m_calendarNames.size()); for(unsigned calendarNamesIndex = 0; calendarNamesIndex < calendarNamesJsonList.GetLength(); ++calendarNamesIndex) { calendarNamesJsonList[calendarNamesIndex].AsString(m_calendarNames[calendarNamesIndex]); } payload.WithArray("CalendarNames", std::move(calendarNamesJsonList)); } 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_scheduleOffsetHasBeenSet) { payload.WithInteger("ScheduleOffset", m_scheduleOffset); } 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_alarmConfigurationHasBeenSet) { payload.WithObject("AlarmConfiguration", m_alarmConfiguration.Jsonize()); } return payload.View().WriteReadable(); } Aws::Http::HeaderValueCollection UpdateAssociationRequest::GetRequestSpecificHeaders() const { Aws::Http::HeaderValueCollection headers; headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AmazonSSM.UpdateAssociation")); return headers; }