1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/es/model/DomainEndpointOptions.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 ElasticsearchService
17 {
18 namespace Model
19 {
20 
DomainEndpointOptions()21 DomainEndpointOptions::DomainEndpointOptions() :
22     m_enforceHTTPS(false),
23     m_enforceHTTPSHasBeenSet(false),
24     m_tLSSecurityPolicy(TLSSecurityPolicy::NOT_SET),
25     m_tLSSecurityPolicyHasBeenSet(false),
26     m_customEndpointEnabled(false),
27     m_customEndpointEnabledHasBeenSet(false),
28     m_customEndpointHasBeenSet(false),
29     m_customEndpointCertificateArnHasBeenSet(false)
30 {
31 }
32 
DomainEndpointOptions(JsonView jsonValue)33 DomainEndpointOptions::DomainEndpointOptions(JsonView jsonValue) :
34     m_enforceHTTPS(false),
35     m_enforceHTTPSHasBeenSet(false),
36     m_tLSSecurityPolicy(TLSSecurityPolicy::NOT_SET),
37     m_tLSSecurityPolicyHasBeenSet(false),
38     m_customEndpointEnabled(false),
39     m_customEndpointEnabledHasBeenSet(false),
40     m_customEndpointHasBeenSet(false),
41     m_customEndpointCertificateArnHasBeenSet(false)
42 {
43   *this = jsonValue;
44 }
45 
operator =(JsonView jsonValue)46 DomainEndpointOptions& DomainEndpointOptions::operator =(JsonView jsonValue)
47 {
48   if(jsonValue.ValueExists("EnforceHTTPS"))
49   {
50     m_enforceHTTPS = jsonValue.GetBool("EnforceHTTPS");
51 
52     m_enforceHTTPSHasBeenSet = true;
53   }
54 
55   if(jsonValue.ValueExists("TLSSecurityPolicy"))
56   {
57     m_tLSSecurityPolicy = TLSSecurityPolicyMapper::GetTLSSecurityPolicyForName(jsonValue.GetString("TLSSecurityPolicy"));
58 
59     m_tLSSecurityPolicyHasBeenSet = true;
60   }
61 
62   if(jsonValue.ValueExists("CustomEndpointEnabled"))
63   {
64     m_customEndpointEnabled = jsonValue.GetBool("CustomEndpointEnabled");
65 
66     m_customEndpointEnabledHasBeenSet = true;
67   }
68 
69   if(jsonValue.ValueExists("CustomEndpoint"))
70   {
71     m_customEndpoint = jsonValue.GetString("CustomEndpoint");
72 
73     m_customEndpointHasBeenSet = true;
74   }
75 
76   if(jsonValue.ValueExists("CustomEndpointCertificateArn"))
77   {
78     m_customEndpointCertificateArn = jsonValue.GetString("CustomEndpointCertificateArn");
79 
80     m_customEndpointCertificateArnHasBeenSet = true;
81   }
82 
83   return *this;
84 }
85 
Jsonize() const86 JsonValue DomainEndpointOptions::Jsonize() const
87 {
88   JsonValue payload;
89 
90   if(m_enforceHTTPSHasBeenSet)
91   {
92    payload.WithBool("EnforceHTTPS", m_enforceHTTPS);
93 
94   }
95 
96   if(m_tLSSecurityPolicyHasBeenSet)
97   {
98    payload.WithString("TLSSecurityPolicy", TLSSecurityPolicyMapper::GetNameForTLSSecurityPolicy(m_tLSSecurityPolicy));
99   }
100 
101   if(m_customEndpointEnabledHasBeenSet)
102   {
103    payload.WithBool("CustomEndpointEnabled", m_customEndpointEnabled);
104 
105   }
106 
107   if(m_customEndpointHasBeenSet)
108   {
109    payload.WithString("CustomEndpoint", m_customEndpoint);
110 
111   }
112 
113   if(m_customEndpointCertificateArnHasBeenSet)
114   {
115    payload.WithString("CustomEndpointCertificateArn", m_customEndpointCertificateArn);
116 
117   }
118 
119   return payload;
120 }
121 
122 } // namespace Model
123 } // namespace ElasticsearchService
124 } // namespace Aws
125