{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Route53RecoveryCluster.Types.RoutingControl
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53RecoveryCluster.Types.RoutingControl where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53RecoveryCluster.Types.RoutingControlState

-- | A routing control, which is a simple on\/off switch that you can use to
-- route traffic to cells. When a routing control state is On, traffic
-- flows to a cell. When the state is Off, traffic does not flow.
--
-- /See:/ 'newRoutingControl' smart constructor.
data RoutingControl = RoutingControl'
  { -- | The Amazon Resource Name (ARN) of the control panel where the routing
    -- control is located.
    RoutingControl -> Maybe Text
controlPanelArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the control panel where the routing control is located.
    RoutingControl -> Maybe Text
controlPanelName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the routing control.
    RoutingControl -> Maybe Text
routingControlArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the routing control.
    RoutingControl -> Maybe Text
routingControlName :: Prelude.Maybe Prelude.Text,
    -- | The current state of the routing control. When a routing control state
    -- is On, traffic flows to a cell. When the state is Off, traffic does not
    -- flow.
    RoutingControl -> Maybe RoutingControlState
routingControlState :: Prelude.Maybe RoutingControlState
  }
  deriving (RoutingControl -> RoutingControl -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RoutingControl -> RoutingControl -> Bool
$c/= :: RoutingControl -> RoutingControl -> Bool
== :: RoutingControl -> RoutingControl -> Bool
$c== :: RoutingControl -> RoutingControl -> Bool
Prelude.Eq, ReadPrec [RoutingControl]
ReadPrec RoutingControl
Int -> ReadS RoutingControl
ReadS [RoutingControl]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RoutingControl]
$creadListPrec :: ReadPrec [RoutingControl]
readPrec :: ReadPrec RoutingControl
$creadPrec :: ReadPrec RoutingControl
readList :: ReadS [RoutingControl]
$creadList :: ReadS [RoutingControl]
readsPrec :: Int -> ReadS RoutingControl
$creadsPrec :: Int -> ReadS RoutingControl
Prelude.Read, Int -> RoutingControl -> ShowS
[RoutingControl] -> ShowS
RoutingControl -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RoutingControl] -> ShowS
$cshowList :: [RoutingControl] -> ShowS
show :: RoutingControl -> String
$cshow :: RoutingControl -> String
showsPrec :: Int -> RoutingControl -> ShowS
$cshowsPrec :: Int -> RoutingControl -> ShowS
Prelude.Show, forall x. Rep RoutingControl x -> RoutingControl
forall x. RoutingControl -> Rep RoutingControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RoutingControl x -> RoutingControl
$cfrom :: forall x. RoutingControl -> Rep RoutingControl x
Prelude.Generic)

-- |
-- Create a value of 'RoutingControl' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'controlPanelArn', 'routingControl_controlPanelArn' - The Amazon Resource Name (ARN) of the control panel where the routing
-- control is located.
--
-- 'controlPanelName', 'routingControl_controlPanelName' - The name of the control panel where the routing control is located.
--
-- 'routingControlArn', 'routingControl_routingControlArn' - The Amazon Resource Name (ARN) of the routing control.
--
-- 'routingControlName', 'routingControl_routingControlName' - The name of the routing control.
--
-- 'routingControlState', 'routingControl_routingControlState' - The current state of the routing control. When a routing control state
-- is On, traffic flows to a cell. When the state is Off, traffic does not
-- flow.
newRoutingControl ::
  RoutingControl
newRoutingControl :: RoutingControl
newRoutingControl =
  RoutingControl'
    { $sel:controlPanelArn:RoutingControl' :: Maybe Text
controlPanelArn = forall a. Maybe a
Prelude.Nothing,
      $sel:controlPanelName:RoutingControl' :: Maybe Text
controlPanelName = forall a. Maybe a
Prelude.Nothing,
      $sel:routingControlArn:RoutingControl' :: Maybe Text
routingControlArn = forall a. Maybe a
Prelude.Nothing,
      $sel:routingControlName:RoutingControl' :: Maybe Text
routingControlName = forall a. Maybe a
Prelude.Nothing,
      $sel:routingControlState:RoutingControl' :: Maybe RoutingControlState
routingControlState = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the control panel where the routing
-- control is located.
routingControl_controlPanelArn :: Lens.Lens' RoutingControl (Prelude.Maybe Prelude.Text)
routingControl_controlPanelArn :: Lens' RoutingControl (Maybe Text)
routingControl_controlPanelArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoutingControl' {Maybe Text
controlPanelArn :: Maybe Text
$sel:controlPanelArn:RoutingControl' :: RoutingControl -> Maybe Text
controlPanelArn} -> Maybe Text
controlPanelArn) (\s :: RoutingControl
s@RoutingControl' {} Maybe Text
a -> RoutingControl
s {$sel:controlPanelArn:RoutingControl' :: Maybe Text
controlPanelArn = Maybe Text
a} :: RoutingControl)

-- | The name of the control panel where the routing control is located.
routingControl_controlPanelName :: Lens.Lens' RoutingControl (Prelude.Maybe Prelude.Text)
routingControl_controlPanelName :: Lens' RoutingControl (Maybe Text)
routingControl_controlPanelName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoutingControl' {Maybe Text
controlPanelName :: Maybe Text
$sel:controlPanelName:RoutingControl' :: RoutingControl -> Maybe Text
controlPanelName} -> Maybe Text
controlPanelName) (\s :: RoutingControl
s@RoutingControl' {} Maybe Text
a -> RoutingControl
s {$sel:controlPanelName:RoutingControl' :: Maybe Text
controlPanelName = Maybe Text
a} :: RoutingControl)

-- | The Amazon Resource Name (ARN) of the routing control.
routingControl_routingControlArn :: Lens.Lens' RoutingControl (Prelude.Maybe Prelude.Text)
routingControl_routingControlArn :: Lens' RoutingControl (Maybe Text)
routingControl_routingControlArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoutingControl' {Maybe Text
routingControlArn :: Maybe Text
$sel:routingControlArn:RoutingControl' :: RoutingControl -> Maybe Text
routingControlArn} -> Maybe Text
routingControlArn) (\s :: RoutingControl
s@RoutingControl' {} Maybe Text
a -> RoutingControl
s {$sel:routingControlArn:RoutingControl' :: Maybe Text
routingControlArn = Maybe Text
a} :: RoutingControl)

-- | The name of the routing control.
routingControl_routingControlName :: Lens.Lens' RoutingControl (Prelude.Maybe Prelude.Text)
routingControl_routingControlName :: Lens' RoutingControl (Maybe Text)
routingControl_routingControlName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoutingControl' {Maybe Text
routingControlName :: Maybe Text
$sel:routingControlName:RoutingControl' :: RoutingControl -> Maybe Text
routingControlName} -> Maybe Text
routingControlName) (\s :: RoutingControl
s@RoutingControl' {} Maybe Text
a -> RoutingControl
s {$sel:routingControlName:RoutingControl' :: Maybe Text
routingControlName = Maybe Text
a} :: RoutingControl)

-- | The current state of the routing control. When a routing control state
-- is On, traffic flows to a cell. When the state is Off, traffic does not
-- flow.
routingControl_routingControlState :: Lens.Lens' RoutingControl (Prelude.Maybe RoutingControlState)
routingControl_routingControlState :: Lens' RoutingControl (Maybe RoutingControlState)
routingControl_routingControlState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoutingControl' {Maybe RoutingControlState
routingControlState :: Maybe RoutingControlState
$sel:routingControlState:RoutingControl' :: RoutingControl -> Maybe RoutingControlState
routingControlState} -> Maybe RoutingControlState
routingControlState) (\s :: RoutingControl
s@RoutingControl' {} Maybe RoutingControlState
a -> RoutingControl
s {$sel:routingControlState:RoutingControl' :: Maybe RoutingControlState
routingControlState = Maybe RoutingControlState
a} :: RoutingControl)

instance Data.FromJSON RoutingControl where
  parseJSON :: Value -> Parser RoutingControl
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RoutingControl"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe RoutingControlState
-> RoutingControl
RoutingControl'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ControlPanelArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ControlPanelName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RoutingControlArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RoutingControlName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RoutingControlState")
      )

instance Prelude.Hashable RoutingControl where
  hashWithSalt :: Int -> RoutingControl -> Int
hashWithSalt Int
_salt RoutingControl' {Maybe Text
Maybe RoutingControlState
routingControlState :: Maybe RoutingControlState
routingControlName :: Maybe Text
routingControlArn :: Maybe Text
controlPanelName :: Maybe Text
controlPanelArn :: Maybe Text
$sel:routingControlState:RoutingControl' :: RoutingControl -> Maybe RoutingControlState
$sel:routingControlName:RoutingControl' :: RoutingControl -> Maybe Text
$sel:routingControlArn:RoutingControl' :: RoutingControl -> Maybe Text
$sel:controlPanelName:RoutingControl' :: RoutingControl -> Maybe Text
$sel:controlPanelArn:RoutingControl' :: RoutingControl -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
controlPanelArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
controlPanelName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
routingControlArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
routingControlName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RoutingControlState
routingControlState

instance Prelude.NFData RoutingControl where
  rnf :: RoutingControl -> ()
rnf RoutingControl' {Maybe Text
Maybe RoutingControlState
routingControlState :: Maybe RoutingControlState
routingControlName :: Maybe Text
routingControlArn :: Maybe Text
controlPanelName :: Maybe Text
controlPanelArn :: Maybe Text
$sel:routingControlState:RoutingControl' :: RoutingControl -> Maybe RoutingControlState
$sel:routingControlName:RoutingControl' :: RoutingControl -> Maybe Text
$sel:routingControlArn:RoutingControl' :: RoutingControl -> Maybe Text
$sel:controlPanelName:RoutingControl' :: RoutingControl -> Maybe Text
$sel:controlPanelArn:RoutingControl' :: RoutingControl -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
controlPanelArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
controlPanelName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
routingControlArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
routingControlName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RoutingControlState
routingControlState