/** * 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 IoT { namespace Model { AuthInfo::AuthInfo() : m_actionType(ActionType::NOT_SET), m_actionTypeHasBeenSet(false), m_resourcesHasBeenSet(false) { } AuthInfo::AuthInfo(JsonView jsonValue) : m_actionType(ActionType::NOT_SET), m_actionTypeHasBeenSet(false), m_resourcesHasBeenSet(false) { *this = jsonValue; } AuthInfo& AuthInfo::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("actionType")) { m_actionType = ActionTypeMapper::GetActionTypeForName(jsonValue.GetString("actionType")); m_actionTypeHasBeenSet = true; } if(jsonValue.ValueExists("resources")) { Aws::Utils::Array resourcesJsonList = jsonValue.GetArray("resources"); for(unsigned resourcesIndex = 0; resourcesIndex < resourcesJsonList.GetLength(); ++resourcesIndex) { m_resources.push_back(resourcesJsonList[resourcesIndex].AsString()); } m_resourcesHasBeenSet = true; } return *this; } JsonValue AuthInfo::Jsonize() const { JsonValue payload; if(m_actionTypeHasBeenSet) { payload.WithString("actionType", ActionTypeMapper::GetNameForActionType(m_actionType)); } if(m_resourcesHasBeenSet) { Aws::Utils::Array resourcesJsonList(m_resources.size()); for(unsigned resourcesIndex = 0; resourcesIndex < resourcesJsonList.GetLength(); ++resourcesIndex) { resourcesJsonList[resourcesIndex].AsString(m_resources[resourcesIndex]); } payload.WithArray("resources", std::move(resourcesJsonList)); } return payload; } } // namespace Model } // namespace IoT } // namespace Aws