1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/rekognition/model/HumanLoopDataAttributes.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8 
9 #include <utility>
10 
11 using namespace Aws::Utils::Json;
12 using namespace Aws::Utils;
13 
14 namespace Aws
15 {
16 namespace Rekognition
17 {
18 namespace Model
19 {
20 
HumanLoopDataAttributes()21 HumanLoopDataAttributes::HumanLoopDataAttributes() :
22     m_contentClassifiersHasBeenSet(false)
23 {
24 }
25 
HumanLoopDataAttributes(JsonView jsonValue)26 HumanLoopDataAttributes::HumanLoopDataAttributes(JsonView jsonValue) :
27     m_contentClassifiersHasBeenSet(false)
28 {
29   *this = jsonValue;
30 }
31 
operator =(JsonView jsonValue)32 HumanLoopDataAttributes& HumanLoopDataAttributes::operator =(JsonView jsonValue)
33 {
34   if(jsonValue.ValueExists("ContentClassifiers"))
35   {
36     Array<JsonView> contentClassifiersJsonList = jsonValue.GetArray("ContentClassifiers");
37     for(unsigned contentClassifiersIndex = 0; contentClassifiersIndex < contentClassifiersJsonList.GetLength(); ++contentClassifiersIndex)
38     {
39       m_contentClassifiers.push_back(ContentClassifierMapper::GetContentClassifierForName(contentClassifiersJsonList[contentClassifiersIndex].AsString()));
40     }
41     m_contentClassifiersHasBeenSet = true;
42   }
43 
44   return *this;
45 }
46 
Jsonize() const47 JsonValue HumanLoopDataAttributes::Jsonize() const
48 {
49   JsonValue payload;
50 
51   if(m_contentClassifiersHasBeenSet)
52   {
53    Array<JsonValue> contentClassifiersJsonList(m_contentClassifiers.size());
54    for(unsigned contentClassifiersIndex = 0; contentClassifiersIndex < contentClassifiersJsonList.GetLength(); ++contentClassifiersIndex)
55    {
56      contentClassifiersJsonList[contentClassifiersIndex].AsString(ContentClassifierMapper::GetNameForContentClassifier(m_contentClassifiers[contentClassifiersIndex]));
57    }
58    payload.WithArray("ContentClassifiers", std::move(contentClassifiersJsonList));
59 
60   }
61 
62   return payload;
63 }
64 
65 } // namespace Model
66 } // namespace Rekognition
67 } // namespace Aws
68