/** * 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::Inspector2::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; GetSbomExportResult::GetSbomExportResult() : m_errorCode(ReportingErrorCode::NOT_SET), m_format(SbomReportFormat::NOT_SET), m_status(ExternalReportStatus::NOT_SET) { } GetSbomExportResult::GetSbomExportResult(const Aws::AmazonWebServiceResult& result) : m_errorCode(ReportingErrorCode::NOT_SET), m_format(SbomReportFormat::NOT_SET), m_status(ExternalReportStatus::NOT_SET) { *this = result; } GetSbomExportResult& GetSbomExportResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("errorCode")) { m_errorCode = ReportingErrorCodeMapper::GetReportingErrorCodeForName(jsonValue.GetString("errorCode")); } if(jsonValue.ValueExists("errorMessage")) { m_errorMessage = jsonValue.GetString("errorMessage"); } if(jsonValue.ValueExists("filterCriteria")) { m_filterCriteria = jsonValue.GetObject("filterCriteria"); } if(jsonValue.ValueExists("format")) { m_format = SbomReportFormatMapper::GetSbomReportFormatForName(jsonValue.GetString("format")); } if(jsonValue.ValueExists("reportId")) { m_reportId = jsonValue.GetString("reportId"); } if(jsonValue.ValueExists("s3Destination")) { m_s3Destination = jsonValue.GetObject("s3Destination"); } if(jsonValue.ValueExists("status")) { m_status = ExternalReportStatusMapper::GetExternalReportStatusForName(jsonValue.GetString("status")); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }