/** * 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 Pipes { namespace Model { BatchContainerOverrides::BatchContainerOverrides() : m_commandHasBeenSet(false), m_environmentHasBeenSet(false), m_instanceTypeHasBeenSet(false), m_resourceRequirementsHasBeenSet(false) { } BatchContainerOverrides::BatchContainerOverrides(JsonView jsonValue) : m_commandHasBeenSet(false), m_environmentHasBeenSet(false), m_instanceTypeHasBeenSet(false), m_resourceRequirementsHasBeenSet(false) { *this = jsonValue; } BatchContainerOverrides& BatchContainerOverrides::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("Command")) { Aws::Utils::Array commandJsonList = jsonValue.GetArray("Command"); for(unsigned commandIndex = 0; commandIndex < commandJsonList.GetLength(); ++commandIndex) { m_command.push_back(commandJsonList[commandIndex].AsString()); } m_commandHasBeenSet = true; } if(jsonValue.ValueExists("Environment")) { Aws::Utils::Array environmentJsonList = jsonValue.GetArray("Environment"); for(unsigned environmentIndex = 0; environmentIndex < environmentJsonList.GetLength(); ++environmentIndex) { m_environment.push_back(environmentJsonList[environmentIndex].AsObject()); } m_environmentHasBeenSet = true; } if(jsonValue.ValueExists("InstanceType")) { m_instanceType = jsonValue.GetString("InstanceType"); m_instanceTypeHasBeenSet = true; } if(jsonValue.ValueExists("ResourceRequirements")) { Aws::Utils::Array resourceRequirementsJsonList = jsonValue.GetArray("ResourceRequirements"); for(unsigned resourceRequirementsIndex = 0; resourceRequirementsIndex < resourceRequirementsJsonList.GetLength(); ++resourceRequirementsIndex) { m_resourceRequirements.push_back(resourceRequirementsJsonList[resourceRequirementsIndex].AsObject()); } m_resourceRequirementsHasBeenSet = true; } return *this; } JsonValue BatchContainerOverrides::Jsonize() const { JsonValue payload; if(m_commandHasBeenSet) { Aws::Utils::Array commandJsonList(m_command.size()); for(unsigned commandIndex = 0; commandIndex < commandJsonList.GetLength(); ++commandIndex) { commandJsonList[commandIndex].AsString(m_command[commandIndex]); } payload.WithArray("Command", std::move(commandJsonList)); } if(m_environmentHasBeenSet) { Aws::Utils::Array environmentJsonList(m_environment.size()); for(unsigned environmentIndex = 0; environmentIndex < environmentJsonList.GetLength(); ++environmentIndex) { environmentJsonList[environmentIndex].AsObject(m_environment[environmentIndex].Jsonize()); } payload.WithArray("Environment", std::move(environmentJsonList)); } if(m_instanceTypeHasBeenSet) { payload.WithString("InstanceType", m_instanceType); } if(m_resourceRequirementsHasBeenSet) { Aws::Utils::Array resourceRequirementsJsonList(m_resourceRequirements.size()); for(unsigned resourceRequirementsIndex = 0; resourceRequirementsIndex < resourceRequirementsJsonList.GetLength(); ++resourceRequirementsIndex) { resourceRequirementsJsonList[resourceRequirementsIndex].AsObject(m_resourceRequirements[resourceRequirementsIndex].Jsonize()); } payload.WithArray("ResourceRequirements", std::move(resourceRequirementsJsonList)); } return payload; } } // namespace Model } // namespace Pipes } // namespace Aws