211 lines
4.2 KiB
C++
211 lines
4.2 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/apigateway/model/ApiKey.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace APIGateway
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
ApiKey::ApiKey() :
|
|
m_idHasBeenSet(false),
|
|
m_valueHasBeenSet(false),
|
|
m_nameHasBeenSet(false),
|
|
m_customerIdHasBeenSet(false),
|
|
m_descriptionHasBeenSet(false),
|
|
m_enabled(false),
|
|
m_enabledHasBeenSet(false),
|
|
m_createdDateHasBeenSet(false),
|
|
m_lastUpdatedDateHasBeenSet(false),
|
|
m_stageKeysHasBeenSet(false),
|
|
m_tagsHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
ApiKey::ApiKey(JsonView jsonValue) :
|
|
m_idHasBeenSet(false),
|
|
m_valueHasBeenSet(false),
|
|
m_nameHasBeenSet(false),
|
|
m_customerIdHasBeenSet(false),
|
|
m_descriptionHasBeenSet(false),
|
|
m_enabled(false),
|
|
m_enabledHasBeenSet(false),
|
|
m_createdDateHasBeenSet(false),
|
|
m_lastUpdatedDateHasBeenSet(false),
|
|
m_stageKeysHasBeenSet(false),
|
|
m_tagsHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
ApiKey& ApiKey::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("id"))
|
|
{
|
|
m_id = jsonValue.GetString("id");
|
|
|
|
m_idHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("value"))
|
|
{
|
|
m_value = jsonValue.GetString("value");
|
|
|
|
m_valueHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("name"))
|
|
{
|
|
m_name = jsonValue.GetString("name");
|
|
|
|
m_nameHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("customerId"))
|
|
{
|
|
m_customerId = jsonValue.GetString("customerId");
|
|
|
|
m_customerIdHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("description"))
|
|
{
|
|
m_description = jsonValue.GetString("description");
|
|
|
|
m_descriptionHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("enabled"))
|
|
{
|
|
m_enabled = jsonValue.GetBool("enabled");
|
|
|
|
m_enabledHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("createdDate"))
|
|
{
|
|
m_createdDate = jsonValue.GetDouble("createdDate");
|
|
|
|
m_createdDateHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("lastUpdatedDate"))
|
|
{
|
|
m_lastUpdatedDate = jsonValue.GetDouble("lastUpdatedDate");
|
|
|
|
m_lastUpdatedDateHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("stageKeys"))
|
|
{
|
|
Array<JsonView> stageKeysJsonList = jsonValue.GetArray("stageKeys");
|
|
for(unsigned stageKeysIndex = 0; stageKeysIndex < stageKeysJsonList.GetLength(); ++stageKeysIndex)
|
|
{
|
|
m_stageKeys.push_back(stageKeysJsonList[stageKeysIndex].AsString());
|
|
}
|
|
m_stageKeysHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("tags"))
|
|
{
|
|
Aws::Map<Aws::String, JsonView> tagsJsonMap = jsonValue.GetObject("tags").GetAllObjects();
|
|
for(auto& tagsItem : tagsJsonMap)
|
|
{
|
|
m_tags[tagsItem.first] = tagsItem.second.AsString();
|
|
}
|
|
m_tagsHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue ApiKey::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_idHasBeenSet)
|
|
{
|
|
payload.WithString("id", m_id);
|
|
|
|
}
|
|
|
|
if(m_valueHasBeenSet)
|
|
{
|
|
payload.WithString("value", m_value);
|
|
|
|
}
|
|
|
|
if(m_nameHasBeenSet)
|
|
{
|
|
payload.WithString("name", m_name);
|
|
|
|
}
|
|
|
|
if(m_customerIdHasBeenSet)
|
|
{
|
|
payload.WithString("customerId", m_customerId);
|
|
|
|
}
|
|
|
|
if(m_descriptionHasBeenSet)
|
|
{
|
|
payload.WithString("description", m_description);
|
|
|
|
}
|
|
|
|
if(m_enabledHasBeenSet)
|
|
{
|
|
payload.WithBool("enabled", m_enabled);
|
|
|
|
}
|
|
|
|
if(m_createdDateHasBeenSet)
|
|
{
|
|
payload.WithDouble("createdDate", m_createdDate.SecondsWithMSPrecision());
|
|
}
|
|
|
|
if(m_lastUpdatedDateHasBeenSet)
|
|
{
|
|
payload.WithDouble("lastUpdatedDate", m_lastUpdatedDate.SecondsWithMSPrecision());
|
|
}
|
|
|
|
if(m_stageKeysHasBeenSet)
|
|
{
|
|
Array<JsonValue> stageKeysJsonList(m_stageKeys.size());
|
|
for(unsigned stageKeysIndex = 0; stageKeysIndex < stageKeysJsonList.GetLength(); ++stageKeysIndex)
|
|
{
|
|
stageKeysJsonList[stageKeysIndex].AsString(m_stageKeys[stageKeysIndex]);
|
|
}
|
|
payload.WithArray("stageKeys", std::move(stageKeysJsonList));
|
|
|
|
}
|
|
|
|
if(m_tagsHasBeenSet)
|
|
{
|
|
JsonValue tagsJsonMap;
|
|
for(auto& tagsItem : m_tags)
|
|
{
|
|
tagsJsonMap.WithString(tagsItem.first, tagsItem.second);
|
|
}
|
|
payload.WithObject("tags", std::move(tagsJsonMap));
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace APIGateway
|
|
} // namespace Aws
|