/** * 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 Snowball { namespace Model { Notification::Notification() : m_snsTopicARNHasBeenSet(false), m_jobStatesToNotifyHasBeenSet(false), m_notifyAll(false), m_notifyAllHasBeenSet(false), m_devicePickupSnsTopicARNHasBeenSet(false) { } Notification::Notification(JsonView jsonValue) : m_snsTopicARNHasBeenSet(false), m_jobStatesToNotifyHasBeenSet(false), m_notifyAll(false), m_notifyAllHasBeenSet(false), m_devicePickupSnsTopicARNHasBeenSet(false) { *this = jsonValue; } Notification& Notification::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("SnsTopicARN")) { m_snsTopicARN = jsonValue.GetString("SnsTopicARN"); m_snsTopicARNHasBeenSet = true; } if(jsonValue.ValueExists("JobStatesToNotify")) { Aws::Utils::Array jobStatesToNotifyJsonList = jsonValue.GetArray("JobStatesToNotify"); for(unsigned jobStatesToNotifyIndex = 0; jobStatesToNotifyIndex < jobStatesToNotifyJsonList.GetLength(); ++jobStatesToNotifyIndex) { m_jobStatesToNotify.push_back(JobStateMapper::GetJobStateForName(jobStatesToNotifyJsonList[jobStatesToNotifyIndex].AsString())); } m_jobStatesToNotifyHasBeenSet = true; } if(jsonValue.ValueExists("NotifyAll")) { m_notifyAll = jsonValue.GetBool("NotifyAll"); m_notifyAllHasBeenSet = true; } if(jsonValue.ValueExists("DevicePickupSnsTopicARN")) { m_devicePickupSnsTopicARN = jsonValue.GetString("DevicePickupSnsTopicARN"); m_devicePickupSnsTopicARNHasBeenSet = true; } return *this; } JsonValue Notification::Jsonize() const { JsonValue payload; if(m_snsTopicARNHasBeenSet) { payload.WithString("SnsTopicARN", m_snsTopicARN); } if(m_jobStatesToNotifyHasBeenSet) { Aws::Utils::Array jobStatesToNotifyJsonList(m_jobStatesToNotify.size()); for(unsigned jobStatesToNotifyIndex = 0; jobStatesToNotifyIndex < jobStatesToNotifyJsonList.GetLength(); ++jobStatesToNotifyIndex) { jobStatesToNotifyJsonList[jobStatesToNotifyIndex].AsString(JobStateMapper::GetNameForJobState(m_jobStatesToNotify[jobStatesToNotifyIndex])); } payload.WithArray("JobStatesToNotify", std::move(jobStatesToNotifyJsonList)); } if(m_notifyAllHasBeenSet) { payload.WithBool("NotifyAll", m_notifyAll); } if(m_devicePickupSnsTopicARNHasBeenSet) { payload.WithString("DevicePickupSnsTopicARN", m_devicePickupSnsTopicARN); } return payload; } } // namespace Model } // namespace Snowball } // namespace Aws