/** * 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::RecycleBin::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; GetRuleResult::GetRuleResult() : m_resourceType(ResourceType::NOT_SET), m_status(RuleStatus::NOT_SET), m_lockState(LockState::NOT_SET) { } GetRuleResult::GetRuleResult(const Aws::AmazonWebServiceResult& result) : m_resourceType(ResourceType::NOT_SET), m_status(RuleStatus::NOT_SET), m_lockState(LockState::NOT_SET) { *this = result; } GetRuleResult& GetRuleResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("Identifier")) { m_identifier = jsonValue.GetString("Identifier"); } if(jsonValue.ValueExists("Description")) { m_description = jsonValue.GetString("Description"); } if(jsonValue.ValueExists("ResourceType")) { m_resourceType = ResourceTypeMapper::GetResourceTypeForName(jsonValue.GetString("ResourceType")); } if(jsonValue.ValueExists("RetentionPeriod")) { m_retentionPeriod = jsonValue.GetObject("RetentionPeriod"); } if(jsonValue.ValueExists("ResourceTags")) { Aws::Utils::Array resourceTagsJsonList = jsonValue.GetArray("ResourceTags"); for(unsigned resourceTagsIndex = 0; resourceTagsIndex < resourceTagsJsonList.GetLength(); ++resourceTagsIndex) { m_resourceTags.push_back(resourceTagsJsonList[resourceTagsIndex].AsObject()); } } if(jsonValue.ValueExists("Status")) { m_status = RuleStatusMapper::GetRuleStatusForName(jsonValue.GetString("Status")); } if(jsonValue.ValueExists("LockConfiguration")) { m_lockConfiguration = jsonValue.GetObject("LockConfiguration"); } if(jsonValue.ValueExists("LockState")) { m_lockState = LockStateMapper::GetLockStateForName(jsonValue.GetString("LockState")); } if(jsonValue.ValueExists("LockEndTime")) { m_lockEndTime = jsonValue.GetDouble("LockEndTime"); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }