/** * 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 EventBridge { namespace Model { Rule::Rule() : m_nameHasBeenSet(false), m_arnHasBeenSet(false), m_eventPatternHasBeenSet(false), m_state(RuleState::NOT_SET), m_stateHasBeenSet(false), m_descriptionHasBeenSet(false), m_scheduleExpressionHasBeenSet(false), m_roleArnHasBeenSet(false), m_managedByHasBeenSet(false), m_eventBusNameHasBeenSet(false) { } Rule::Rule(JsonView jsonValue) : m_nameHasBeenSet(false), m_arnHasBeenSet(false), m_eventPatternHasBeenSet(false), m_state(RuleState::NOT_SET), m_stateHasBeenSet(false), m_descriptionHasBeenSet(false), m_scheduleExpressionHasBeenSet(false), m_roleArnHasBeenSet(false), m_managedByHasBeenSet(false), m_eventBusNameHasBeenSet(false) { *this = jsonValue; } Rule& Rule::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("Name")) { m_name = jsonValue.GetString("Name"); m_nameHasBeenSet = true; } if(jsonValue.ValueExists("Arn")) { m_arn = jsonValue.GetString("Arn"); m_arnHasBeenSet = true; } if(jsonValue.ValueExists("EventPattern")) { m_eventPattern = jsonValue.GetString("EventPattern"); m_eventPatternHasBeenSet = true; } if(jsonValue.ValueExists("State")) { m_state = RuleStateMapper::GetRuleStateForName(jsonValue.GetString("State")); m_stateHasBeenSet = true; } if(jsonValue.ValueExists("Description")) { m_description = jsonValue.GetString("Description"); m_descriptionHasBeenSet = true; } if(jsonValue.ValueExists("ScheduleExpression")) { m_scheduleExpression = jsonValue.GetString("ScheduleExpression"); m_scheduleExpressionHasBeenSet = true; } if(jsonValue.ValueExists("RoleArn")) { m_roleArn = jsonValue.GetString("RoleArn"); m_roleArnHasBeenSet = true; } if(jsonValue.ValueExists("ManagedBy")) { m_managedBy = jsonValue.GetString("ManagedBy"); m_managedByHasBeenSet = true; } if(jsonValue.ValueExists("EventBusName")) { m_eventBusName = jsonValue.GetString("EventBusName"); m_eventBusNameHasBeenSet = true; } return *this; } JsonValue Rule::Jsonize() const { JsonValue payload; if(m_nameHasBeenSet) { payload.WithString("Name", m_name); } if(m_arnHasBeenSet) { payload.WithString("Arn", m_arn); } if(m_eventPatternHasBeenSet) { payload.WithString("EventPattern", m_eventPattern); } if(m_stateHasBeenSet) { payload.WithString("State", RuleStateMapper::GetNameForRuleState(m_state)); } if(m_descriptionHasBeenSet) { payload.WithString("Description", m_description); } if(m_scheduleExpressionHasBeenSet) { payload.WithString("ScheduleExpression", m_scheduleExpression); } if(m_roleArnHasBeenSet) { payload.WithString("RoleArn", m_roleArn); } if(m_managedByHasBeenSet) { payload.WithString("ManagedBy", m_managedBy); } if(m_eventBusNameHasBeenSet) { payload.WithString("EventBusName", m_eventBusName); } return payload; } } // namespace Model } // namespace EventBridge } // namespace Aws