1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/amplifybackend/model/CreateBackendAuthResourceConfig.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 AmplifyBackend
17 {
18 namespace Model
19 {
20
CreateBackendAuthResourceConfig()21 CreateBackendAuthResourceConfig::CreateBackendAuthResourceConfig() :
22 m_authResources(AuthResources::NOT_SET),
23 m_authResourcesHasBeenSet(false),
24 m_identityPoolConfigsHasBeenSet(false),
25 m_service(Service::NOT_SET),
26 m_serviceHasBeenSet(false),
27 m_userPoolConfigsHasBeenSet(false)
28 {
29 }
30
CreateBackendAuthResourceConfig(JsonView jsonValue)31 CreateBackendAuthResourceConfig::CreateBackendAuthResourceConfig(JsonView jsonValue) :
32 m_authResources(AuthResources::NOT_SET),
33 m_authResourcesHasBeenSet(false),
34 m_identityPoolConfigsHasBeenSet(false),
35 m_service(Service::NOT_SET),
36 m_serviceHasBeenSet(false),
37 m_userPoolConfigsHasBeenSet(false)
38 {
39 *this = jsonValue;
40 }
41
operator =(JsonView jsonValue)42 CreateBackendAuthResourceConfig& CreateBackendAuthResourceConfig::operator =(JsonView jsonValue)
43 {
44 if(jsonValue.ValueExists("authResources"))
45 {
46 m_authResources = AuthResourcesMapper::GetAuthResourcesForName(jsonValue.GetString("authResources"));
47
48 m_authResourcesHasBeenSet = true;
49 }
50
51 if(jsonValue.ValueExists("identityPoolConfigs"))
52 {
53 m_identityPoolConfigs = jsonValue.GetObject("identityPoolConfigs");
54
55 m_identityPoolConfigsHasBeenSet = true;
56 }
57
58 if(jsonValue.ValueExists("service"))
59 {
60 m_service = ServiceMapper::GetServiceForName(jsonValue.GetString("service"));
61
62 m_serviceHasBeenSet = true;
63 }
64
65 if(jsonValue.ValueExists("userPoolConfigs"))
66 {
67 m_userPoolConfigs = jsonValue.GetObject("userPoolConfigs");
68
69 m_userPoolConfigsHasBeenSet = true;
70 }
71
72 return *this;
73 }
74
Jsonize() const75 JsonValue CreateBackendAuthResourceConfig::Jsonize() const
76 {
77 JsonValue payload;
78
79 if(m_authResourcesHasBeenSet)
80 {
81 payload.WithString("authResources", AuthResourcesMapper::GetNameForAuthResources(m_authResources));
82 }
83
84 if(m_identityPoolConfigsHasBeenSet)
85 {
86 payload.WithObject("identityPoolConfigs", m_identityPoolConfigs.Jsonize());
87
88 }
89
90 if(m_serviceHasBeenSet)
91 {
92 payload.WithString("service", ServiceMapper::GetNameForService(m_service));
93 }
94
95 if(m_userPoolConfigsHasBeenSet)
96 {
97 payload.WithObject("userPoolConfigs", m_userPoolConfigs.Jsonize());
98
99 }
100
101 return payload;
102 }
103
104 } // namespace Model
105 } // namespace AmplifyBackend
106 } // namespace Aws
107