1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/eventbridge/model/ConnectionHttpParameters.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 EventBridge 17 { 18 namespace Model 19 { 20 ConnectionHttpParameters()21ConnectionHttpParameters::ConnectionHttpParameters() : 22 m_headerParametersHasBeenSet(false), 23 m_queryStringParametersHasBeenSet(false), 24 m_bodyParametersHasBeenSet(false) 25 { 26 } 27 ConnectionHttpParameters(JsonView jsonValue)28ConnectionHttpParameters::ConnectionHttpParameters(JsonView jsonValue) : 29 m_headerParametersHasBeenSet(false), 30 m_queryStringParametersHasBeenSet(false), 31 m_bodyParametersHasBeenSet(false) 32 { 33 *this = jsonValue; 34 } 35 operator =(JsonView jsonValue)36ConnectionHttpParameters& ConnectionHttpParameters::operator =(JsonView jsonValue) 37 { 38 if(jsonValue.ValueExists("HeaderParameters")) 39 { 40 Array<JsonView> headerParametersJsonList = jsonValue.GetArray("HeaderParameters"); 41 for(unsigned headerParametersIndex = 0; headerParametersIndex < headerParametersJsonList.GetLength(); ++headerParametersIndex) 42 { 43 m_headerParameters.push_back(headerParametersJsonList[headerParametersIndex].AsObject()); 44 } 45 m_headerParametersHasBeenSet = true; 46 } 47 48 if(jsonValue.ValueExists("QueryStringParameters")) 49 { 50 Array<JsonView> queryStringParametersJsonList = jsonValue.GetArray("QueryStringParameters"); 51 for(unsigned queryStringParametersIndex = 0; queryStringParametersIndex < queryStringParametersJsonList.GetLength(); ++queryStringParametersIndex) 52 { 53 m_queryStringParameters.push_back(queryStringParametersJsonList[queryStringParametersIndex].AsObject()); 54 } 55 m_queryStringParametersHasBeenSet = true; 56 } 57 58 if(jsonValue.ValueExists("BodyParameters")) 59 { 60 Array<JsonView> bodyParametersJsonList = jsonValue.GetArray("BodyParameters"); 61 for(unsigned bodyParametersIndex = 0; bodyParametersIndex < bodyParametersJsonList.GetLength(); ++bodyParametersIndex) 62 { 63 m_bodyParameters.push_back(bodyParametersJsonList[bodyParametersIndex].AsObject()); 64 } 65 m_bodyParametersHasBeenSet = true; 66 } 67 68 return *this; 69 } 70 Jsonize() const71JsonValue ConnectionHttpParameters::Jsonize() const 72 { 73 JsonValue payload; 74 75 if(m_headerParametersHasBeenSet) 76 { 77 Array<JsonValue> headerParametersJsonList(m_headerParameters.size()); 78 for(unsigned headerParametersIndex = 0; headerParametersIndex < headerParametersJsonList.GetLength(); ++headerParametersIndex) 79 { 80 headerParametersJsonList[headerParametersIndex].AsObject(m_headerParameters[headerParametersIndex].Jsonize()); 81 } 82 payload.WithArray("HeaderParameters", std::move(headerParametersJsonList)); 83 84 } 85 86 if(m_queryStringParametersHasBeenSet) 87 { 88 Array<JsonValue> queryStringParametersJsonList(m_queryStringParameters.size()); 89 for(unsigned queryStringParametersIndex = 0; queryStringParametersIndex < queryStringParametersJsonList.GetLength(); ++queryStringParametersIndex) 90 { 91 queryStringParametersJsonList[queryStringParametersIndex].AsObject(m_queryStringParameters[queryStringParametersIndex].Jsonize()); 92 } 93 payload.WithArray("QueryStringParameters", std::move(queryStringParametersJsonList)); 94 95 } 96 97 if(m_bodyParametersHasBeenSet) 98 { 99 Array<JsonValue> bodyParametersJsonList(m_bodyParameters.size()); 100 for(unsigned bodyParametersIndex = 0; bodyParametersIndex < bodyParametersJsonList.GetLength(); ++bodyParametersIndex) 101 { 102 bodyParametersJsonList[bodyParametersIndex].AsObject(m_bodyParameters[bodyParametersIndex].Jsonize()); 103 } 104 payload.WithArray("BodyParameters", std::move(bodyParametersJsonList)); 105 106 } 107 108 return payload; 109 } 110 111 } // namespace Model 112 } // namespace EventBridge 113 } // namespace Aws 114