1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/workdocs/model/EntityNotExistsException.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 WorkDocs
17 {
18 namespace Model
19 {
20 
EntityNotExistsException()21 EntityNotExistsException::EntityNotExistsException() :
22     m_messageHasBeenSet(false),
23     m_entityIdsHasBeenSet(false)
24 {
25 }
26 
EntityNotExistsException(JsonView jsonValue)27 EntityNotExistsException::EntityNotExistsException(JsonView jsonValue) :
28     m_messageHasBeenSet(false),
29     m_entityIdsHasBeenSet(false)
30 {
31   *this = jsonValue;
32 }
33 
operator =(JsonView jsonValue)34 EntityNotExistsException& EntityNotExistsException::operator =(JsonView jsonValue)
35 {
36   if(jsonValue.ValueExists("Message"))
37   {
38     m_message = jsonValue.GetString("Message");
39 
40     m_messageHasBeenSet = true;
41   }
42 
43   if(jsonValue.ValueExists("EntityIds"))
44   {
45     Array<JsonView> entityIdsJsonList = jsonValue.GetArray("EntityIds");
46     for(unsigned entityIdsIndex = 0; entityIdsIndex < entityIdsJsonList.GetLength(); ++entityIdsIndex)
47     {
48       m_entityIds.push_back(entityIdsJsonList[entityIdsIndex].AsString());
49     }
50     m_entityIdsHasBeenSet = true;
51   }
52 
53   return *this;
54 }
55 
Jsonize() const56 JsonValue EntityNotExistsException::Jsonize() const
57 {
58   JsonValue payload;
59 
60   if(m_messageHasBeenSet)
61   {
62    payload.WithString("Message", m_message);
63 
64   }
65 
66   if(m_entityIdsHasBeenSet)
67   {
68    Array<JsonValue> entityIdsJsonList(m_entityIds.size());
69    for(unsigned entityIdsIndex = 0; entityIdsIndex < entityIdsJsonList.GetLength(); ++entityIdsIndex)
70    {
71      entityIdsJsonList[entityIdsIndex].AsString(m_entityIds[entityIdsIndex]);
72    }
73    payload.WithArray("EntityIds", std::move(entityIdsJsonList));
74 
75   }
76 
77   return payload;
78 }
79 
80 } // namespace Model
81 } // namespace WorkDocs
82 } // namespace Aws
83