/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/ecr/model/ImageScanFinding.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace ECR { namespace Model { ImageScanFinding::ImageScanFinding() : m_nameHasBeenSet(false), m_descriptionHasBeenSet(false), m_uriHasBeenSet(false), m_severity(FindingSeverity::NOT_SET), m_severityHasBeenSet(false), m_attributesHasBeenSet(false) { } ImageScanFinding::ImageScanFinding(JsonView jsonValue) : m_nameHasBeenSet(false), m_descriptionHasBeenSet(false), m_uriHasBeenSet(false), m_severity(FindingSeverity::NOT_SET), m_severityHasBeenSet(false), m_attributesHasBeenSet(false) { *this = jsonValue; } ImageScanFinding& ImageScanFinding::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("name")) { m_name = jsonValue.GetString("name"); m_nameHasBeenSet = true; } if(jsonValue.ValueExists("description")) { m_description = jsonValue.GetString("description"); m_descriptionHasBeenSet = true; } if(jsonValue.ValueExists("uri")) { m_uri = jsonValue.GetString("uri"); m_uriHasBeenSet = true; } if(jsonValue.ValueExists("severity")) { m_severity = FindingSeverityMapper::GetFindingSeverityForName(jsonValue.GetString("severity")); m_severityHasBeenSet = true; } if(jsonValue.ValueExists("attributes")) { Aws::Utils::Array<JsonView> attributesJsonList = jsonValue.GetArray("attributes"); for(unsigned attributesIndex = 0; attributesIndex < attributesJsonList.GetLength(); ++attributesIndex) { m_attributes.push_back(attributesJsonList[attributesIndex].AsObject()); } m_attributesHasBeenSet = true; } return *this; } JsonValue ImageScanFinding::Jsonize() const { JsonValue payload; if(m_nameHasBeenSet) { payload.WithString("name", m_name); } if(m_descriptionHasBeenSet) { payload.WithString("description", m_description); } if(m_uriHasBeenSet) { payload.WithString("uri", m_uri); } if(m_severityHasBeenSet) { payload.WithString("severity", FindingSeverityMapper::GetNameForFindingSeverity(m_severity)); } if(m_attributesHasBeenSet) { Aws::Utils::Array<JsonValue> attributesJsonList(m_attributes.size()); for(unsigned attributesIndex = 0; attributesIndex < attributesJsonList.GetLength(); ++attributesIndex) { attributesJsonList[attributesIndex].AsObject(m_attributes[attributesIndex].Jsonize()); } payload.WithArray("attributes", std::move(attributesJsonList)); } return payload; } } // namespace Model } // namespace ECR } // namespace Aws