/** * 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::CodeCommit::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; CreateCommitResult::CreateCommitResult() { } CreateCommitResult::CreateCommitResult(const Aws::AmazonWebServiceResult& result) { *this = result; } CreateCommitResult& CreateCommitResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("commitId")) { m_commitId = jsonValue.GetString("commitId"); } if(jsonValue.ValueExists("treeId")) { m_treeId = jsonValue.GetString("treeId"); } if(jsonValue.ValueExists("filesAdded")) { Aws::Utils::Array filesAddedJsonList = jsonValue.GetArray("filesAdded"); for(unsigned filesAddedIndex = 0; filesAddedIndex < filesAddedJsonList.GetLength(); ++filesAddedIndex) { m_filesAdded.push_back(filesAddedJsonList[filesAddedIndex].AsObject()); } } if(jsonValue.ValueExists("filesUpdated")) { Aws::Utils::Array filesUpdatedJsonList = jsonValue.GetArray("filesUpdated"); for(unsigned filesUpdatedIndex = 0; filesUpdatedIndex < filesUpdatedJsonList.GetLength(); ++filesUpdatedIndex) { m_filesUpdated.push_back(filesUpdatedJsonList[filesUpdatedIndex].AsObject()); } } if(jsonValue.ValueExists("filesDeleted")) { Aws::Utils::Array filesDeletedJsonList = jsonValue.GetArray("filesDeleted"); for(unsigned filesDeletedIndex = 0; filesDeletedIndex < filesDeletedJsonList.GetLength(); ++filesDeletedIndex) { m_filesDeleted.push_back(filesDeletedJsonList[filesDeletedIndex].AsObject()); } } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }