1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/greengrassv2/model/LambdaDeviceMount.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 GreengrassV2
17 {
18 namespace Model
19 {
20
LambdaDeviceMount()21 LambdaDeviceMount::LambdaDeviceMount() :
22 m_pathHasBeenSet(false),
23 m_permission(LambdaFilesystemPermission::NOT_SET),
24 m_permissionHasBeenSet(false),
25 m_addGroupOwner(false),
26 m_addGroupOwnerHasBeenSet(false)
27 {
28 }
29
LambdaDeviceMount(JsonView jsonValue)30 LambdaDeviceMount::LambdaDeviceMount(JsonView jsonValue) :
31 m_pathHasBeenSet(false),
32 m_permission(LambdaFilesystemPermission::NOT_SET),
33 m_permissionHasBeenSet(false),
34 m_addGroupOwner(false),
35 m_addGroupOwnerHasBeenSet(false)
36 {
37 *this = jsonValue;
38 }
39
operator =(JsonView jsonValue)40 LambdaDeviceMount& LambdaDeviceMount::operator =(JsonView jsonValue)
41 {
42 if(jsonValue.ValueExists("path"))
43 {
44 m_path = jsonValue.GetString("path");
45
46 m_pathHasBeenSet = true;
47 }
48
49 if(jsonValue.ValueExists("permission"))
50 {
51 m_permission = LambdaFilesystemPermissionMapper::GetLambdaFilesystemPermissionForName(jsonValue.GetString("permission"));
52
53 m_permissionHasBeenSet = true;
54 }
55
56 if(jsonValue.ValueExists("addGroupOwner"))
57 {
58 m_addGroupOwner = jsonValue.GetBool("addGroupOwner");
59
60 m_addGroupOwnerHasBeenSet = true;
61 }
62
63 return *this;
64 }
65
Jsonize() const66 JsonValue LambdaDeviceMount::Jsonize() const
67 {
68 JsonValue payload;
69
70 if(m_pathHasBeenSet)
71 {
72 payload.WithString("path", m_path);
73
74 }
75
76 if(m_permissionHasBeenSet)
77 {
78 payload.WithString("permission", LambdaFilesystemPermissionMapper::GetNameForLambdaFilesystemPermission(m_permission));
79 }
80
81 if(m_addGroupOwnerHasBeenSet)
82 {
83 payload.WithBool("addGroupOwner", m_addGroupOwner);
84
85 }
86
87 return payload;
88 }
89
90 } // namespace Model
91 } // namespace GreengrassV2
92 } // namespace Aws
93