74 lines
1.3 KiB
C++
74 lines
1.3 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/rekognition/model/Image.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
#include <aws/core/utils/HashingUtils.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace Rekognition
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
Image::Image() :
|
|
m_bytesHasBeenSet(false),
|
|
m_s3ObjectHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
Image::Image(JsonView jsonValue) :
|
|
m_bytesHasBeenSet(false),
|
|
m_s3ObjectHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
Image& Image::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("Bytes"))
|
|
{
|
|
m_bytes = HashingUtils::Base64Decode(jsonValue.GetString("Bytes"));
|
|
m_bytesHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("S3Object"))
|
|
{
|
|
m_s3Object = jsonValue.GetObject("S3Object");
|
|
|
|
m_s3ObjectHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue Image::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_bytesHasBeenSet)
|
|
{
|
|
payload.WithString("Bytes", HashingUtils::Base64Encode(m_bytes));
|
|
}
|
|
|
|
if(m_s3ObjectHasBeenSet)
|
|
{
|
|
payload.WithObject("S3Object", m_s3Object.Jsonize());
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace Rekognition
|
|
} // namespace Aws
|