/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace WAFV2 { namespace Model { RuleGroup::RuleGroup() : m_nameHasBeenSet(false), m_idHasBeenSet(false), m_capacity(0), m_capacityHasBeenSet(false), m_aRNHasBeenSet(false), m_descriptionHasBeenSet(false), m_rulesHasBeenSet(false), m_visibilityConfigHasBeenSet(false) { } RuleGroup::RuleGroup(JsonView jsonValue) : m_nameHasBeenSet(false), m_idHasBeenSet(false), m_capacity(0), m_capacityHasBeenSet(false), m_aRNHasBeenSet(false), m_descriptionHasBeenSet(false), m_rulesHasBeenSet(false), m_visibilityConfigHasBeenSet(false) { *this = jsonValue; } RuleGroup& RuleGroup::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("Name")) { m_name = jsonValue.GetString("Name"); m_nameHasBeenSet = true; } if(jsonValue.ValueExists("Id")) { m_id = jsonValue.GetString("Id"); m_idHasBeenSet = true; } if(jsonValue.ValueExists("Capacity")) { m_capacity = jsonValue.GetInt64("Capacity"); m_capacityHasBeenSet = true; } if(jsonValue.ValueExists("ARN")) { m_aRN = jsonValue.GetString("ARN"); m_aRNHasBeenSet = true; } if(jsonValue.ValueExists("Description")) { m_description = jsonValue.GetString("Description"); m_descriptionHasBeenSet = true; } if(jsonValue.ValueExists("Rules")) { Array rulesJsonList = jsonValue.GetArray("Rules"); for(unsigned rulesIndex = 0; rulesIndex < rulesJsonList.GetLength(); ++rulesIndex) { m_rules.push_back(rulesJsonList[rulesIndex].AsObject()); } m_rulesHasBeenSet = true; } if(jsonValue.ValueExists("VisibilityConfig")) { m_visibilityConfig = jsonValue.GetObject("VisibilityConfig"); m_visibilityConfigHasBeenSet = true; } return *this; } JsonValue RuleGroup::Jsonize() const { JsonValue payload; if(m_nameHasBeenSet) { payload.WithString("Name", m_name); } if(m_idHasBeenSet) { payload.WithString("Id", m_id); } if(m_capacityHasBeenSet) { payload.WithInt64("Capacity", m_capacity); } if(m_aRNHasBeenSet) { payload.WithString("ARN", m_aRN); } if(m_descriptionHasBeenSet) { payload.WithString("Description", m_description); } if(m_rulesHasBeenSet) { Array rulesJsonList(m_rules.size()); for(unsigned rulesIndex = 0; rulesIndex < rulesJsonList.GetLength(); ++rulesIndex) { rulesJsonList[rulesIndex].AsObject(m_rules[rulesIndex].Jsonize()); } payload.WithArray("Rules", std::move(rulesJsonList)); } if(m_visibilityConfigHasBeenSet) { payload.WithObject("VisibilityConfig", m_visibilityConfig.Jsonize()); } return payload; } } // namespace Model } // namespace WAFV2 } // namespace Aws