/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include using namespace Aws::CodeStarNotifications::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; DescribeNotificationRuleResult::DescribeNotificationRuleResult() : m_detailType(DetailType::NOT_SET), m_status(NotificationRuleStatus::NOT_SET) { } DescribeNotificationRuleResult::DescribeNotificationRuleResult(const Aws::AmazonWebServiceResult& result) : m_detailType(DetailType::NOT_SET), m_status(NotificationRuleStatus::NOT_SET) { *this = result; } DescribeNotificationRuleResult& DescribeNotificationRuleResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("Arn")) { m_arn = jsonValue.GetString("Arn"); } if(jsonValue.ValueExists("Name")) { m_name = jsonValue.GetString("Name"); } if(jsonValue.ValueExists("EventTypes")) { Array eventTypesJsonList = jsonValue.GetArray("EventTypes"); for(unsigned eventTypesIndex = 0; eventTypesIndex < eventTypesJsonList.GetLength(); ++eventTypesIndex) { m_eventTypes.push_back(eventTypesJsonList[eventTypesIndex].AsObject()); } } if(jsonValue.ValueExists("Resource")) { m_resource = jsonValue.GetString("Resource"); } if(jsonValue.ValueExists("Targets")) { Array targetsJsonList = jsonValue.GetArray("Targets"); for(unsigned targetsIndex = 0; targetsIndex < targetsJsonList.GetLength(); ++targetsIndex) { m_targets.push_back(targetsJsonList[targetsIndex].AsObject()); } } if(jsonValue.ValueExists("DetailType")) { m_detailType = DetailTypeMapper::GetDetailTypeForName(jsonValue.GetString("DetailType")); } if(jsonValue.ValueExists("CreatedBy")) { m_createdBy = jsonValue.GetString("CreatedBy"); } if(jsonValue.ValueExists("Status")) { m_status = NotificationRuleStatusMapper::GetNotificationRuleStatusForName(jsonValue.GetString("Status")); } if(jsonValue.ValueExists("CreatedTimestamp")) { m_createdTimestamp = jsonValue.GetDouble("CreatedTimestamp"); } if(jsonValue.ValueExists("LastModifiedTimestamp")) { m_lastModifiedTimestamp = jsonValue.GetDouble("LastModifiedTimestamp"); } if(jsonValue.ValueExists("Tags")) { Aws::Map tagsJsonMap = jsonValue.GetObject("Tags").GetAllObjects(); for(auto& tagsItem : tagsJsonMap) { m_tags[tagsItem.first] = tagsItem.second.AsString(); } } return *this; }