1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/pinpoint-email/model/RawMessage.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8 #include <aws/core/utils/HashingUtils.h>
9 
10 #include <utility>
11 
12 using namespace Aws::Utils::Json;
13 using namespace Aws::Utils;
14 
15 namespace Aws
16 {
17 namespace PinpointEmail
18 {
19 namespace Model
20 {
21 
RawMessage()22 RawMessage::RawMessage() :
23     m_dataHasBeenSet(false)
24 {
25 }
26 
RawMessage(JsonView jsonValue)27 RawMessage::RawMessage(JsonView jsonValue) :
28     m_dataHasBeenSet(false)
29 {
30   *this = jsonValue;
31 }
32 
operator =(JsonView jsonValue)33 RawMessage& RawMessage::operator =(JsonView jsonValue)
34 {
35   if(jsonValue.ValueExists("Data"))
36   {
37     m_data = HashingUtils::Base64Decode(jsonValue.GetString("Data"));
38     m_dataHasBeenSet = true;
39   }
40 
41   return *this;
42 }
43 
Jsonize() const44 JsonValue RawMessage::Jsonize() const
45 {
46   JsonValue payload;
47 
48   if(m_dataHasBeenSet)
49   {
50    payload.WithString("Data", HashingUtils::Base64Encode(m_data));
51   }
52 
53   return payload;
54 }
55 
56 } // namespace Model
57 } // namespace PinpointEmail
58 } // namespace Aws
59