This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
pxz-hos-client-cpp-module/support/aws-sdk-cpp-master/aws-cpp-sdk-ssm/source/model/DocumentIdentifier.cpp

236 lines
5.8 KiB
C++

/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/ssm/model/DocumentIdentifier.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace SSM
{
namespace Model
{
DocumentIdentifier::DocumentIdentifier() :
m_nameHasBeenSet(false),
m_ownerHasBeenSet(false),
m_versionNameHasBeenSet(false),
m_platformTypesHasBeenSet(false),
m_documentVersionHasBeenSet(false),
m_documentType(DocumentType::NOT_SET),
m_documentTypeHasBeenSet(false),
m_schemaVersionHasBeenSet(false),
m_documentFormat(DocumentFormat::NOT_SET),
m_documentFormatHasBeenSet(false),
m_targetTypeHasBeenSet(false),
m_tagsHasBeenSet(false),
m_requiresHasBeenSet(false)
{
}
DocumentIdentifier::DocumentIdentifier(JsonView jsonValue) :
m_nameHasBeenSet(false),
m_ownerHasBeenSet(false),
m_versionNameHasBeenSet(false),
m_platformTypesHasBeenSet(false),
m_documentVersionHasBeenSet(false),
m_documentType(DocumentType::NOT_SET),
m_documentTypeHasBeenSet(false),
m_schemaVersionHasBeenSet(false),
m_documentFormat(DocumentFormat::NOT_SET),
m_documentFormatHasBeenSet(false),
m_targetTypeHasBeenSet(false),
m_tagsHasBeenSet(false),
m_requiresHasBeenSet(false)
{
*this = jsonValue;
}
DocumentIdentifier& DocumentIdentifier::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("Name"))
{
m_name = jsonValue.GetString("Name");
m_nameHasBeenSet = true;
}
if(jsonValue.ValueExists("Owner"))
{
m_owner = jsonValue.GetString("Owner");
m_ownerHasBeenSet = true;
}
if(jsonValue.ValueExists("VersionName"))
{
m_versionName = jsonValue.GetString("VersionName");
m_versionNameHasBeenSet = true;
}
if(jsonValue.ValueExists("PlatformTypes"))
{
Array<JsonView> platformTypesJsonList = jsonValue.GetArray("PlatformTypes");
for(unsigned platformTypesIndex = 0; platformTypesIndex < platformTypesJsonList.GetLength(); ++platformTypesIndex)
{
m_platformTypes.push_back(PlatformTypeMapper::GetPlatformTypeForName(platformTypesJsonList[platformTypesIndex].AsString()));
}
m_platformTypesHasBeenSet = true;
}
if(jsonValue.ValueExists("DocumentVersion"))
{
m_documentVersion = jsonValue.GetString("DocumentVersion");
m_documentVersionHasBeenSet = true;
}
if(jsonValue.ValueExists("DocumentType"))
{
m_documentType = DocumentTypeMapper::GetDocumentTypeForName(jsonValue.GetString("DocumentType"));
m_documentTypeHasBeenSet = true;
}
if(jsonValue.ValueExists("SchemaVersion"))
{
m_schemaVersion = jsonValue.GetString("SchemaVersion");
m_schemaVersionHasBeenSet = true;
}
if(jsonValue.ValueExists("DocumentFormat"))
{
m_documentFormat = DocumentFormatMapper::GetDocumentFormatForName(jsonValue.GetString("DocumentFormat"));
m_documentFormatHasBeenSet = true;
}
if(jsonValue.ValueExists("TargetType"))
{
m_targetType = jsonValue.GetString("TargetType");
m_targetTypeHasBeenSet = true;
}
if(jsonValue.ValueExists("Tags"))
{
Array<JsonView> tagsJsonList = jsonValue.GetArray("Tags");
for(unsigned tagsIndex = 0; tagsIndex < tagsJsonList.GetLength(); ++tagsIndex)
{
m_tags.push_back(tagsJsonList[tagsIndex].AsObject());
}
m_tagsHasBeenSet = true;
}
if(jsonValue.ValueExists("Requires"))
{
Array<JsonView> requiresJsonList = jsonValue.GetArray("Requires");
for(unsigned requiresIndex = 0; requiresIndex < requiresJsonList.GetLength(); ++requiresIndex)
{
m_requires.push_back(requiresJsonList[requiresIndex].AsObject());
}
m_requiresHasBeenSet = true;
}
return *this;
}
JsonValue DocumentIdentifier::Jsonize() const
{
JsonValue payload;
if(m_nameHasBeenSet)
{
payload.WithString("Name", m_name);
}
if(m_ownerHasBeenSet)
{
payload.WithString("Owner", m_owner);
}
if(m_versionNameHasBeenSet)
{
payload.WithString("VersionName", m_versionName);
}
if(m_platformTypesHasBeenSet)
{
Array<JsonValue> platformTypesJsonList(m_platformTypes.size());
for(unsigned platformTypesIndex = 0; platformTypesIndex < platformTypesJsonList.GetLength(); ++platformTypesIndex)
{
platformTypesJsonList[platformTypesIndex].AsString(PlatformTypeMapper::GetNameForPlatformType(m_platformTypes[platformTypesIndex]));
}
payload.WithArray("PlatformTypes", std::move(platformTypesJsonList));
}
if(m_documentVersionHasBeenSet)
{
payload.WithString("DocumentVersion", m_documentVersion);
}
if(m_documentTypeHasBeenSet)
{
payload.WithString("DocumentType", DocumentTypeMapper::GetNameForDocumentType(m_documentType));
}
if(m_schemaVersionHasBeenSet)
{
payload.WithString("SchemaVersion", m_schemaVersion);
}
if(m_documentFormatHasBeenSet)
{
payload.WithString("DocumentFormat", DocumentFormatMapper::GetNameForDocumentFormat(m_documentFormat));
}
if(m_targetTypeHasBeenSet)
{
payload.WithString("TargetType", m_targetType);
}
if(m_tagsHasBeenSet)
{
Array<JsonValue> tagsJsonList(m_tags.size());
for(unsigned tagsIndex = 0; tagsIndex < tagsJsonList.GetLength(); ++tagsIndex)
{
tagsJsonList[tagsIndex].AsObject(m_tags[tagsIndex].Jsonize());
}
payload.WithArray("Tags", std::move(tagsJsonList));
}
if(m_requiresHasBeenSet)
{
Array<JsonValue> requiresJsonList(m_requires.size());
for(unsigned requiresIndex = 0; requiresIndex < requiresJsonList.GetLength(); ++requiresIndex)
{
requiresJsonList[requiresIndex].AsObject(m_requires[requiresIndex].Jsonize());
}
payload.WithArray("Requires", std::move(requiresJsonList));
}
return payload;
}
} // namespace Model
} // namespace SSM
} // namespace Aws