1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/batch/model/Tmpfs.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 Batch
17 {
18 namespace Model
19 {
20 
Tmpfs()21 Tmpfs::Tmpfs() :
22     m_containerPathHasBeenSet(false),
23     m_size(0),
24     m_sizeHasBeenSet(false),
25     m_mountOptionsHasBeenSet(false)
26 {
27 }
28 
Tmpfs(JsonView jsonValue)29 Tmpfs::Tmpfs(JsonView jsonValue) :
30     m_containerPathHasBeenSet(false),
31     m_size(0),
32     m_sizeHasBeenSet(false),
33     m_mountOptionsHasBeenSet(false)
34 {
35   *this = jsonValue;
36 }
37 
operator =(JsonView jsonValue)38 Tmpfs& Tmpfs::operator =(JsonView jsonValue)
39 {
40   if(jsonValue.ValueExists("containerPath"))
41   {
42     m_containerPath = jsonValue.GetString("containerPath");
43 
44     m_containerPathHasBeenSet = true;
45   }
46 
47   if(jsonValue.ValueExists("size"))
48   {
49     m_size = jsonValue.GetInteger("size");
50 
51     m_sizeHasBeenSet = true;
52   }
53 
54   if(jsonValue.ValueExists("mountOptions"))
55   {
56     Array<JsonView> mountOptionsJsonList = jsonValue.GetArray("mountOptions");
57     for(unsigned mountOptionsIndex = 0; mountOptionsIndex < mountOptionsJsonList.GetLength(); ++mountOptionsIndex)
58     {
59       m_mountOptions.push_back(mountOptionsJsonList[mountOptionsIndex].AsString());
60     }
61     m_mountOptionsHasBeenSet = true;
62   }
63 
64   return *this;
65 }
66 
Jsonize() const67 JsonValue Tmpfs::Jsonize() const
68 {
69   JsonValue payload;
70 
71   if(m_containerPathHasBeenSet)
72   {
73    payload.WithString("containerPath", m_containerPath);
74 
75   }
76 
77   if(m_sizeHasBeenSet)
78   {
79    payload.WithInteger("size", m_size);
80 
81   }
82 
83   if(m_mountOptionsHasBeenSet)
84   {
85    Array<JsonValue> mountOptionsJsonList(m_mountOptions.size());
86    for(unsigned mountOptionsIndex = 0; mountOptionsIndex < mountOptionsJsonList.GetLength(); ++mountOptionsIndex)
87    {
88      mountOptionsJsonList[mountOptionsIndex].AsString(m_mountOptions[mountOptionsIndex]);
89    }
90    payload.WithArray("mountOptions", std::move(mountOptionsJsonList));
91 
92   }
93 
94   return payload;
95 }
96 
97 } // namespace Model
98 } // namespace Batch
99 } // namespace Aws
100