{-# 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.Route53RecoveryControlConfig.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.Route53RecoveryControlConfig.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.Route53RecoveryControlConfig.Types.Status

-- | A routing control has one of two states: ON and OFF. You can map the
-- routing control state to the state of an Amazon Route 53 health check,
-- which can be used to control traffic routing.
--
-- /See:/ 'newRoutingControl' smart constructor.
data RoutingControl = RoutingControl'
  { -- | The Amazon Resource Name (ARN) of the control panel that includes the
    -- routing control.
    RoutingControl -> Maybe Text
controlPanelArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the routing control.
    RoutingControl -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the routing control.
    RoutingControl -> Maybe Text
routingControlArn :: Prelude.Maybe Prelude.Text,
    -- | The deployment status of a routing control. Status can be one of the
    -- following: PENDING, DEPLOYED, PENDING_DELETION.
    RoutingControl -> Maybe Status
status :: Prelude.Maybe Status
  }
  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 that includes the
-- routing control.
--
-- 'name', 'routingControl_name' - The name of the routing control.
--
-- 'routingControlArn', 'routingControl_routingControlArn' - The Amazon Resource Name (ARN) of the routing control.
--
-- 'status', 'routingControl_status' - The deployment status of a routing control. Status can be one of the
-- following: PENDING, DEPLOYED, PENDING_DELETION.
newRoutingControl ::
  RoutingControl
newRoutingControl :: RoutingControl
newRoutingControl =
  RoutingControl'
    { $sel:controlPanelArn:RoutingControl' :: Maybe Text
controlPanelArn = forall a. Maybe a
Prelude.Nothing,
      $sel:name:RoutingControl' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:routingControlArn:RoutingControl' :: Maybe Text
routingControlArn = forall a. Maybe a
Prelude.Nothing,
      $sel:status:RoutingControl' :: Maybe Status
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the control panel that includes the
-- routing control.
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 routing control.
routingControl_name :: Lens.Lens' RoutingControl (Prelude.Maybe Prelude.Text)
routingControl_name :: Lens' RoutingControl (Maybe Text)
routingControl_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoutingControl' {Maybe Text
name :: Maybe Text
$sel:name:RoutingControl' :: RoutingControl -> Maybe Text
name} -> Maybe Text
name) (\s :: RoutingControl
s@RoutingControl' {} Maybe Text
a -> RoutingControl
s {$sel:name:RoutingControl' :: Maybe Text
name = 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 deployment status of a routing control. Status can be one of the
-- following: PENDING, DEPLOYED, PENDING_DELETION.
routingControl_status :: Lens.Lens' RoutingControl (Prelude.Maybe Status)
routingControl_status :: Lens' RoutingControl (Maybe Status)
routingControl_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoutingControl' {Maybe Status
status :: Maybe Status
$sel:status:RoutingControl' :: RoutingControl -> Maybe Status
status} -> Maybe Status
status) (\s :: RoutingControl
s@RoutingControl' {} Maybe Status
a -> RoutingControl
s {$sel:status:RoutingControl' :: Maybe Status
status = Maybe Status
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 Status -> 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
"Name")
            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
"Status")
      )

instance Prelude.Hashable RoutingControl where
  hashWithSalt :: Int -> RoutingControl -> Int
hashWithSalt Int
_salt RoutingControl' {Maybe Text
Maybe Status
status :: Maybe Status
routingControlArn :: Maybe Text
name :: Maybe Text
controlPanelArn :: Maybe Text
$sel:status:RoutingControl' :: RoutingControl -> Maybe Status
$sel:routingControlArn:RoutingControl' :: RoutingControl -> Maybe Text
$sel:name: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
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
routingControlArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Status
status

instance Prelude.NFData RoutingControl where
  rnf :: RoutingControl -> ()
rnf RoutingControl' {Maybe Text
Maybe Status
status :: Maybe Status
routingControlArn :: Maybe Text
name :: Maybe Text
controlPanelArn :: Maybe Text
$sel:status:RoutingControl' :: RoutingControl -> Maybe Status
$sel:routingControlArn:RoutingControl' :: RoutingControl -> Maybe Text
$sel:name: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
name
      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 Status
status