{-# 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.UpdateRoutingControlStateEntry
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53RecoveryCluster.Types.UpdateRoutingControlStateEntry where

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

-- | A routing control state.
--
-- /See:/ 'newUpdateRoutingControlStateEntry' smart constructor.
data UpdateRoutingControlStateEntry = UpdateRoutingControlStateEntry'
  { -- | The Amazon Resource Number (ARN) for the routing control state entry.
    UpdateRoutingControlStateEntry -> Text
routingControlArn :: Prelude.Text,
    -- | The routing control state in a set of routing control state entries.
    UpdateRoutingControlStateEntry -> RoutingControlState
routingControlState :: RoutingControlState
  }
  deriving (UpdateRoutingControlStateEntry
-> UpdateRoutingControlStateEntry -> Bool
(UpdateRoutingControlStateEntry
 -> UpdateRoutingControlStateEntry -> Bool)
-> (UpdateRoutingControlStateEntry
    -> UpdateRoutingControlStateEntry -> Bool)
-> Eq UpdateRoutingControlStateEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRoutingControlStateEntry
-> UpdateRoutingControlStateEntry -> Bool
$c/= :: UpdateRoutingControlStateEntry
-> UpdateRoutingControlStateEntry -> Bool
== :: UpdateRoutingControlStateEntry
-> UpdateRoutingControlStateEntry -> Bool
$c== :: UpdateRoutingControlStateEntry
-> UpdateRoutingControlStateEntry -> Bool
Prelude.Eq, ReadPrec [UpdateRoutingControlStateEntry]
ReadPrec UpdateRoutingControlStateEntry
Int -> ReadS UpdateRoutingControlStateEntry
ReadS [UpdateRoutingControlStateEntry]
(Int -> ReadS UpdateRoutingControlStateEntry)
-> ReadS [UpdateRoutingControlStateEntry]
-> ReadPrec UpdateRoutingControlStateEntry
-> ReadPrec [UpdateRoutingControlStateEntry]
-> Read UpdateRoutingControlStateEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRoutingControlStateEntry]
$creadListPrec :: ReadPrec [UpdateRoutingControlStateEntry]
readPrec :: ReadPrec UpdateRoutingControlStateEntry
$creadPrec :: ReadPrec UpdateRoutingControlStateEntry
readList :: ReadS [UpdateRoutingControlStateEntry]
$creadList :: ReadS [UpdateRoutingControlStateEntry]
readsPrec :: Int -> ReadS UpdateRoutingControlStateEntry
$creadsPrec :: Int -> ReadS UpdateRoutingControlStateEntry
Prelude.Read, Int -> UpdateRoutingControlStateEntry -> ShowS
[UpdateRoutingControlStateEntry] -> ShowS
UpdateRoutingControlStateEntry -> String
(Int -> UpdateRoutingControlStateEntry -> ShowS)
-> (UpdateRoutingControlStateEntry -> String)
-> ([UpdateRoutingControlStateEntry] -> ShowS)
-> Show UpdateRoutingControlStateEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRoutingControlStateEntry] -> ShowS
$cshowList :: [UpdateRoutingControlStateEntry] -> ShowS
show :: UpdateRoutingControlStateEntry -> String
$cshow :: UpdateRoutingControlStateEntry -> String
showsPrec :: Int -> UpdateRoutingControlStateEntry -> ShowS
$cshowsPrec :: Int -> UpdateRoutingControlStateEntry -> ShowS
Prelude.Show, (forall x.
 UpdateRoutingControlStateEntry
 -> Rep UpdateRoutingControlStateEntry x)
-> (forall x.
    Rep UpdateRoutingControlStateEntry x
    -> UpdateRoutingControlStateEntry)
-> Generic UpdateRoutingControlStateEntry
forall x.
Rep UpdateRoutingControlStateEntry x
-> UpdateRoutingControlStateEntry
forall x.
UpdateRoutingControlStateEntry
-> Rep UpdateRoutingControlStateEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateRoutingControlStateEntry x
-> UpdateRoutingControlStateEntry
$cfrom :: forall x.
UpdateRoutingControlStateEntry
-> Rep UpdateRoutingControlStateEntry x
Prelude.Generic)

-- |
-- Create a value of 'UpdateRoutingControlStateEntry' 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:
--
-- 'routingControlArn', 'updateRoutingControlStateEntry_routingControlArn' - The Amazon Resource Number (ARN) for the routing control state entry.
--
-- 'routingControlState', 'updateRoutingControlStateEntry_routingControlState' - The routing control state in a set of routing control state entries.
newUpdateRoutingControlStateEntry ::
  -- | 'routingControlArn'
  Prelude.Text ->
  -- | 'routingControlState'
  RoutingControlState ->
  UpdateRoutingControlStateEntry
newUpdateRoutingControlStateEntry :: Text -> RoutingControlState -> UpdateRoutingControlStateEntry
newUpdateRoutingControlStateEntry
  Text
pRoutingControlArn_
  RoutingControlState
pRoutingControlState_ =
    UpdateRoutingControlStateEntry' :: Text -> RoutingControlState -> UpdateRoutingControlStateEntry
UpdateRoutingControlStateEntry'
      { $sel:routingControlArn:UpdateRoutingControlStateEntry' :: Text
routingControlArn =
          Text
pRoutingControlArn_,
        $sel:routingControlState:UpdateRoutingControlStateEntry' :: RoutingControlState
routingControlState = RoutingControlState
pRoutingControlState_
      }

-- | The Amazon Resource Number (ARN) for the routing control state entry.
updateRoutingControlStateEntry_routingControlArn :: Lens.Lens' UpdateRoutingControlStateEntry Prelude.Text
updateRoutingControlStateEntry_routingControlArn :: (Text -> f Text)
-> UpdateRoutingControlStateEntry
-> f UpdateRoutingControlStateEntry
updateRoutingControlStateEntry_routingControlArn = (UpdateRoutingControlStateEntry -> Text)
-> (UpdateRoutingControlStateEntry
    -> Text -> UpdateRoutingControlStateEntry)
-> Lens
     UpdateRoutingControlStateEntry
     UpdateRoutingControlStateEntry
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoutingControlStateEntry' {Text
routingControlArn :: Text
$sel:routingControlArn:UpdateRoutingControlStateEntry' :: UpdateRoutingControlStateEntry -> Text
routingControlArn} -> Text
routingControlArn) (\s :: UpdateRoutingControlStateEntry
s@UpdateRoutingControlStateEntry' {} Text
a -> UpdateRoutingControlStateEntry
s {$sel:routingControlArn:UpdateRoutingControlStateEntry' :: Text
routingControlArn = Text
a} :: UpdateRoutingControlStateEntry)

-- | The routing control state in a set of routing control state entries.
updateRoutingControlStateEntry_routingControlState :: Lens.Lens' UpdateRoutingControlStateEntry RoutingControlState
updateRoutingControlStateEntry_routingControlState :: (RoutingControlState -> f RoutingControlState)
-> UpdateRoutingControlStateEntry
-> f UpdateRoutingControlStateEntry
updateRoutingControlStateEntry_routingControlState = (UpdateRoutingControlStateEntry -> RoutingControlState)
-> (UpdateRoutingControlStateEntry
    -> RoutingControlState -> UpdateRoutingControlStateEntry)
-> Lens
     UpdateRoutingControlStateEntry
     UpdateRoutingControlStateEntry
     RoutingControlState
     RoutingControlState
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoutingControlStateEntry' {RoutingControlState
routingControlState :: RoutingControlState
$sel:routingControlState:UpdateRoutingControlStateEntry' :: UpdateRoutingControlStateEntry -> RoutingControlState
routingControlState} -> RoutingControlState
routingControlState) (\s :: UpdateRoutingControlStateEntry
s@UpdateRoutingControlStateEntry' {} RoutingControlState
a -> UpdateRoutingControlStateEntry
s {$sel:routingControlState:UpdateRoutingControlStateEntry' :: RoutingControlState
routingControlState = RoutingControlState
a} :: UpdateRoutingControlStateEntry)

instance
  Prelude.Hashable
    UpdateRoutingControlStateEntry

instance
  Prelude.NFData
    UpdateRoutingControlStateEntry

instance Core.ToJSON UpdateRoutingControlStateEntry where
  toJSON :: UpdateRoutingControlStateEntry -> Value
toJSON UpdateRoutingControlStateEntry' {Text
RoutingControlState
routingControlState :: RoutingControlState
routingControlArn :: Text
$sel:routingControlState:UpdateRoutingControlStateEntry' :: UpdateRoutingControlStateEntry -> RoutingControlState
$sel:routingControlArn:UpdateRoutingControlStateEntry' :: UpdateRoutingControlStateEntry -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"RoutingControlArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
routingControlArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"RoutingControlState" Text -> RoutingControlState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RoutingControlState
routingControlState)
          ]
      )