/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include #include using namespace Aws::PinpointSMSVoiceV2::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; UpdatePhoneNumberResult::UpdatePhoneNumberResult() : m_status(NumberStatus::NOT_SET), m_messageType(MessageType::NOT_SET), m_numberType(NumberType::NOT_SET), m_twoWayEnabled(false), m_selfManagedOptOutsEnabled(false), m_deletionProtectionEnabled(false) { } UpdatePhoneNumberResult::UpdatePhoneNumberResult(const Aws::AmazonWebServiceResult& result) : m_status(NumberStatus::NOT_SET), m_messageType(MessageType::NOT_SET), m_numberType(NumberType::NOT_SET), m_twoWayEnabled(false), m_selfManagedOptOutsEnabled(false), m_deletionProtectionEnabled(false) { *this = result; } UpdatePhoneNumberResult& UpdatePhoneNumberResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("PhoneNumberArn")) { m_phoneNumberArn = jsonValue.GetString("PhoneNumberArn"); } if(jsonValue.ValueExists("PhoneNumberId")) { m_phoneNumberId = jsonValue.GetString("PhoneNumberId"); } if(jsonValue.ValueExists("PhoneNumber")) { m_phoneNumber = jsonValue.GetString("PhoneNumber"); } if(jsonValue.ValueExists("Status")) { m_status = NumberStatusMapper::GetNumberStatusForName(jsonValue.GetString("Status")); } if(jsonValue.ValueExists("IsoCountryCode")) { m_isoCountryCode = jsonValue.GetString("IsoCountryCode"); } if(jsonValue.ValueExists("MessageType")) { m_messageType = MessageTypeMapper::GetMessageTypeForName(jsonValue.GetString("MessageType")); } if(jsonValue.ValueExists("NumberCapabilities")) { Aws::Utils::Array numberCapabilitiesJsonList = jsonValue.GetArray("NumberCapabilities"); for(unsigned numberCapabilitiesIndex = 0; numberCapabilitiesIndex < numberCapabilitiesJsonList.GetLength(); ++numberCapabilitiesIndex) { m_numberCapabilities.push_back(NumberCapabilityMapper::GetNumberCapabilityForName(numberCapabilitiesJsonList[numberCapabilitiesIndex].AsString())); } } if(jsonValue.ValueExists("NumberType")) { m_numberType = NumberTypeMapper::GetNumberTypeForName(jsonValue.GetString("NumberType")); } if(jsonValue.ValueExists("MonthlyLeasingPrice")) { m_monthlyLeasingPrice = jsonValue.GetString("MonthlyLeasingPrice"); } if(jsonValue.ValueExists("TwoWayEnabled")) { m_twoWayEnabled = jsonValue.GetBool("TwoWayEnabled"); } if(jsonValue.ValueExists("TwoWayChannelArn")) { m_twoWayChannelArn = jsonValue.GetString("TwoWayChannelArn"); } if(jsonValue.ValueExists("SelfManagedOptOutsEnabled")) { m_selfManagedOptOutsEnabled = jsonValue.GetBool("SelfManagedOptOutsEnabled"); } if(jsonValue.ValueExists("OptOutListName")) { m_optOutListName = jsonValue.GetString("OptOutListName"); } if(jsonValue.ValueExists("DeletionProtectionEnabled")) { m_deletionProtectionEnabled = jsonValue.GetBool("DeletionProtectionEnabled"); } if(jsonValue.ValueExists("CreatedTimestamp")) { m_createdTimestamp = jsonValue.GetDouble("CreatedTimestamp"); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }