/** * 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 DeviceFarm { namespace Model { Offering::Offering() : m_idHasBeenSet(false), m_descriptionHasBeenSet(false), m_type(OfferingType::NOT_SET), m_typeHasBeenSet(false), m_platform(DevicePlatform::NOT_SET), m_platformHasBeenSet(false), m_recurringChargesHasBeenSet(false) { } Offering::Offering(JsonView jsonValue) : m_idHasBeenSet(false), m_descriptionHasBeenSet(false), m_type(OfferingType::NOT_SET), m_typeHasBeenSet(false), m_platform(DevicePlatform::NOT_SET), m_platformHasBeenSet(false), m_recurringChargesHasBeenSet(false) { *this = jsonValue; } Offering& Offering::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("type")) { m_type = OfferingTypeMapper::GetOfferingTypeForName(jsonValue.GetString("type")); m_typeHasBeenSet = true; } if(jsonValue.ValueExists("platform")) { m_platform = DevicePlatformMapper::GetDevicePlatformForName(jsonValue.GetString("platform")); m_platformHasBeenSet = true; } if(jsonValue.ValueExists("recurringCharges")) { Aws::Utils::Array recurringChargesJsonList = jsonValue.GetArray("recurringCharges"); for(unsigned recurringChargesIndex = 0; recurringChargesIndex < recurringChargesJsonList.GetLength(); ++recurringChargesIndex) { m_recurringCharges.push_back(recurringChargesJsonList[recurringChargesIndex].AsObject()); } m_recurringChargesHasBeenSet = true; } return *this; } JsonValue Offering::Jsonize() const { JsonValue payload; if(m_idHasBeenSet) { payload.WithString("id", m_id); } if(m_descriptionHasBeenSet) { payload.WithString("description", m_description); } if(m_typeHasBeenSet) { payload.WithString("type", OfferingTypeMapper::GetNameForOfferingType(m_type)); } if(m_platformHasBeenSet) { payload.WithString("platform", DevicePlatformMapper::GetNameForDevicePlatform(m_platform)); } if(m_recurringChargesHasBeenSet) { Aws::Utils::Array recurringChargesJsonList(m_recurringCharges.size()); for(unsigned recurringChargesIndex = 0; recurringChargesIndex < recurringChargesJsonList.GetLength(); ++recurringChargesIndex) { recurringChargesJsonList[recurringChargesIndex].AsObject(m_recurringCharges[recurringChargesIndex].Jsonize()); } payload.WithArray("recurringCharges", std::move(recurringChargesJsonList)); } return payload; } } // namespace Model } // namespace DeviceFarm } // namespace Aws