/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace Inspector2 { namespace Model { Resource::Resource() : m_detailsHasBeenSet(false), m_idHasBeenSet(false), m_partitionHasBeenSet(false), m_regionHasBeenSet(false), m_tagsHasBeenSet(false), m_type(ResourceType::NOT_SET), m_typeHasBeenSet(false) { } Resource::Resource(JsonView jsonValue) : m_detailsHasBeenSet(false), m_idHasBeenSet(false), m_partitionHasBeenSet(false), m_regionHasBeenSet(false), m_tagsHasBeenSet(false), m_type(ResourceType::NOT_SET), m_typeHasBeenSet(false) { *this = jsonValue; } Resource& Resource::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("details")) { m_details = jsonValue.GetObject("details"); m_detailsHasBeenSet = true; } if(jsonValue.ValueExists("id")) { m_id = jsonValue.GetString("id"); m_idHasBeenSet = true; } if(jsonValue.ValueExists("partition")) { m_partition = jsonValue.GetString("partition"); m_partitionHasBeenSet = true; } if(jsonValue.ValueExists("region")) { m_region = jsonValue.GetString("region"); m_regionHasBeenSet = true; } if(jsonValue.ValueExists("tags")) { Aws::Map tagsJsonMap = jsonValue.GetObject("tags").GetAllObjects(); for(auto& tagsItem : tagsJsonMap) { m_tags[tagsItem.first] = tagsItem.second.AsString(); } m_tagsHasBeenSet = true; } if(jsonValue.ValueExists("type")) { m_type = ResourceTypeMapper::GetResourceTypeForName(jsonValue.GetString("type")); m_typeHasBeenSet = true; } return *this; } JsonValue Resource::Jsonize() const { JsonValue payload; if(m_detailsHasBeenSet) { payload.WithObject("details", m_details.Jsonize()); } if(m_idHasBeenSet) { payload.WithString("id", m_id); } if(m_partitionHasBeenSet) { payload.WithString("partition", m_partition); } if(m_regionHasBeenSet) { payload.WithString("region", m_region); } if(m_tagsHasBeenSet) { JsonValue tagsJsonMap; for(auto& tagsItem : m_tags) { tagsJsonMap.WithString(tagsItem.first, tagsItem.second); } payload.WithObject("tags", std::move(tagsJsonMap)); } if(m_typeHasBeenSet) { payload.WithString("type", ResourceTypeMapper::GetNameForResourceType(m_type)); } return payload; } } // namespace Model } // namespace Inspector2 } // namespace Aws