text: ﻿/**
   * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * SPDX-License-Identifier: Apache-2.0.
   */
  
  #include <aws/elasticmapreduce/model/ScalingRule.h>
  #include <aws/core/utils/json/JsonSerializer.h>
  
  #include <utility>
  
  using namespace Aws::Utils::Json;
  using namespace Aws::Utils;
  
  namespace Aws
  {
  namespace EMR
  {
  namespace Model
  {
  
  ScalingRule::ScalingRule() : 
      m_nameHasBeenSet(false),
      m_descriptionHasBeenSet(false),
      m_actionHasBeenSet(false),
      m_triggerHasBeenSet(false)
  {
  }
  
  ScalingRule::ScalingRule(JsonView jsonValue) : 
      m_nameHasBeenSet(false),
      m_descriptionHasBeenSet(false),
      m_actionHasBeenSet(false),
      m_triggerHasBeenSet(false)
  {
    *this = jsonValue;
  }
  
  ScalingRule& ScalingRule::operator =(JsonView jsonValue)
  {
    if(jsonValue.ValueExists("Name"))
    {
      m_name = jsonValue.GetString("Name");
  
      m_nameHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("Description"))
    {
      m_description = jsonValue.GetString("Description");
  
      m_descriptionHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("Action"))
    {
      m_action = jsonValue.GetObject("Action");
  
      m_actionHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("Trigger"))
    {
      m_trigger = jsonValue.GetObject("Trigger");
  
      m_triggerHasBeenSet = true;
    }
  
    return *this;
  }
  
  JsonValue ScalingRule::Jsonize() const
  {
    JsonValue payload;
  
    if(m_nameHasBeenSet)
    {
     payload.WithString("Name", m_name);
  
    }
  
    if(m_descriptionHasBeenSet)
    {
     payload.WithString("Description", m_description);
  
    }
  
    if(m_actionHasBeenSet)
    {
     payload.WithObject("Action", m_action.Jsonize());
  
    }
  
    if(m_triggerHasBeenSet)
    {
     payload.WithObject("Trigger", m_trigger.Jsonize());
  
    }
  
    return payload;
  }
  
  } // namespace Model
  } // namespace EMR
  } // namespace Aws
  