/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/frauddetector/model/RuleDetail.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace FraudDetector { namespace Model { RuleDetail::RuleDetail() : m_ruleIdHasBeenSet(false), m_descriptionHasBeenSet(false), m_detectorIdHasBeenSet(false), m_ruleVersionHasBeenSet(false), m_expressionHasBeenSet(false), m_language(Language::NOT_SET), m_languageHasBeenSet(false), m_outcomesHasBeenSet(false), m_lastUpdatedTimeHasBeenSet(false), m_createdTimeHasBeenSet(false), m_arnHasBeenSet(false) { } RuleDetail::RuleDetail(JsonView jsonValue) : m_ruleIdHasBeenSet(false), m_descriptionHasBeenSet(false), m_detectorIdHasBeenSet(false), m_ruleVersionHasBeenSet(false), m_expressionHasBeenSet(false), m_language(Language::NOT_SET), m_languageHasBeenSet(false), m_outcomesHasBeenSet(false), m_lastUpdatedTimeHasBeenSet(false), m_createdTimeHasBeenSet(false), m_arnHasBeenSet(false) { *this = jsonValue; } RuleDetail& RuleDetail::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("ruleId")) { m_ruleId = jsonValue.GetString("ruleId"); m_ruleIdHasBeenSet = true; } if(jsonValue.ValueExists("description")) { m_description = jsonValue.GetString("description"); m_descriptionHasBeenSet = true; } if(jsonValue.ValueExists("detectorId")) { m_detectorId = jsonValue.GetString("detectorId"); m_detectorIdHasBeenSet = true; } if(jsonValue.ValueExists("ruleVersion")) { m_ruleVersion = jsonValue.GetString("ruleVersion"); m_ruleVersionHasBeenSet = true; } if(jsonValue.ValueExists("expression")) { m_expression = jsonValue.GetString("expression"); m_expressionHasBeenSet = true; } if(jsonValue.ValueExists("language")) { m_language = LanguageMapper::GetLanguageForName(jsonValue.GetString("language")); m_languageHasBeenSet = true; } if(jsonValue.ValueExists("outcomes")) { Aws::Utils::Array<JsonView> outcomesJsonList = jsonValue.GetArray("outcomes"); for(unsigned outcomesIndex = 0; outcomesIndex < outcomesJsonList.GetLength(); ++outcomesIndex) { m_outcomes.push_back(outcomesJsonList[outcomesIndex].AsString()); } m_outcomesHasBeenSet = true; } if(jsonValue.ValueExists("lastUpdatedTime")) { m_lastUpdatedTime = jsonValue.GetString("lastUpdatedTime"); m_lastUpdatedTimeHasBeenSet = true; } if(jsonValue.ValueExists("createdTime")) { m_createdTime = jsonValue.GetString("createdTime"); m_createdTimeHasBeenSet = true; } if(jsonValue.ValueExists("arn")) { m_arn = jsonValue.GetString("arn"); m_arnHasBeenSet = true; } return *this; } JsonValue RuleDetail::Jsonize() const { JsonValue payload; if(m_ruleIdHasBeenSet) { payload.WithString("ruleId", m_ruleId); } if(m_descriptionHasBeenSet) { payload.WithString("description", m_description); } if(m_detectorIdHasBeenSet) { payload.WithString("detectorId", m_detectorId); } if(m_ruleVersionHasBeenSet) { payload.WithString("ruleVersion", m_ruleVersion); } if(m_expressionHasBeenSet) { payload.WithString("expression", m_expression); } if(m_languageHasBeenSet) { payload.WithString("language", LanguageMapper::GetNameForLanguage(m_language)); } if(m_outcomesHasBeenSet) { Aws::Utils::Array<JsonValue> outcomesJsonList(m_outcomes.size()); for(unsigned outcomesIndex = 0; outcomesIndex < outcomesJsonList.GetLength(); ++outcomesIndex) { outcomesJsonList[outcomesIndex].AsString(m_outcomes[outcomesIndex]); } payload.WithArray("outcomes", std::move(outcomesJsonList)); } if(m_lastUpdatedTimeHasBeenSet) { payload.WithString("lastUpdatedTime", m_lastUpdatedTime); } if(m_createdTimeHasBeenSet) { payload.WithString("createdTime", m_createdTime); } if(m_arnHasBeenSet) { payload.WithString("arn", m_arn); } return payload; } } // namespace Model } // namespace FraudDetector } // namespace Aws