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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53RecoveryControlConfig.Types.Status

-- | A control panel represents a group of routing controls that can be
-- changed together in a single transaction.
--
-- /See:/ 'newControlPanel' smart constructor.
data ControlPanel = ControlPanel'
  { -- | The deployment status of control panel. Status can be one of the
    -- following: PENDING, DEPLOYED, PENDING_DELETION.
    ControlPanel -> Maybe Status
status :: Prelude.Maybe Status,
    -- | The Amazon Resource Name (ARN) of the control panel.
    ControlPanel -> Maybe Text
controlPanelArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the cluster that includes the control
    -- panel.
    ControlPanel -> Maybe Text
clusterArn :: Prelude.Maybe Prelude.Text,
    -- | The number of routing controls in the control panel.
    ControlPanel -> Maybe Int
routingControlCount :: Prelude.Maybe Prelude.Int,
    -- | The name of the control panel. You can use any non-white space character
    -- in the name.
    ControlPanel -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A flag that Amazon Route 53 Application Recovery Controller sets to true
    -- to designate the default control panel for a cluster. When you create a
    -- cluster, Amazon Route 53 Application Recovery Controller creates a
    -- control panel, and sets this flag for that control panel. If you create
    -- a control panel yourself, this flag is set to false.
    ControlPanel -> Maybe Bool
defaultControlPanel :: Prelude.Maybe Prelude.Bool
  }
  deriving (ControlPanel -> ControlPanel -> Bool
(ControlPanel -> ControlPanel -> Bool)
-> (ControlPanel -> ControlPanel -> Bool) -> Eq ControlPanel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ControlPanel -> ControlPanel -> Bool
$c/= :: ControlPanel -> ControlPanel -> Bool
== :: ControlPanel -> ControlPanel -> Bool
$c== :: ControlPanel -> ControlPanel -> Bool
Prelude.Eq, ReadPrec [ControlPanel]
ReadPrec ControlPanel
Int -> ReadS ControlPanel
ReadS [ControlPanel]
(Int -> ReadS ControlPanel)
-> ReadS [ControlPanel]
-> ReadPrec ControlPanel
-> ReadPrec [ControlPanel]
-> Read ControlPanel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ControlPanel]
$creadListPrec :: ReadPrec [ControlPanel]
readPrec :: ReadPrec ControlPanel
$creadPrec :: ReadPrec ControlPanel
readList :: ReadS [ControlPanel]
$creadList :: ReadS [ControlPanel]
readsPrec :: Int -> ReadS ControlPanel
$creadsPrec :: Int -> ReadS ControlPanel
Prelude.Read, Int -> ControlPanel -> ShowS
[ControlPanel] -> ShowS
ControlPanel -> String
(Int -> ControlPanel -> ShowS)
-> (ControlPanel -> String)
-> ([ControlPanel] -> ShowS)
-> Show ControlPanel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ControlPanel] -> ShowS
$cshowList :: [ControlPanel] -> ShowS
show :: ControlPanel -> String
$cshow :: ControlPanel -> String
showsPrec :: Int -> ControlPanel -> ShowS
$cshowsPrec :: Int -> ControlPanel -> ShowS
Prelude.Show, (forall x. ControlPanel -> Rep ControlPanel x)
-> (forall x. Rep ControlPanel x -> ControlPanel)
-> Generic ControlPanel
forall x. Rep ControlPanel x -> ControlPanel
forall x. ControlPanel -> Rep ControlPanel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ControlPanel x -> ControlPanel
$cfrom :: forall x. ControlPanel -> Rep ControlPanel x
Prelude.Generic)

-- |
-- Create a value of 'ControlPanel' 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:
--
-- 'status', 'controlPanel_status' - The deployment status of control panel. Status can be one of the
-- following: PENDING, DEPLOYED, PENDING_DELETION.
--
-- 'controlPanelArn', 'controlPanel_controlPanelArn' - The Amazon Resource Name (ARN) of the control panel.
--
-- 'clusterArn', 'controlPanel_clusterArn' - The Amazon Resource Name (ARN) of the cluster that includes the control
-- panel.
--
-- 'routingControlCount', 'controlPanel_routingControlCount' - The number of routing controls in the control panel.
--
-- 'name', 'controlPanel_name' - The name of the control panel. You can use any non-white space character
-- in the name.
--
-- 'defaultControlPanel', 'controlPanel_defaultControlPanel' - A flag that Amazon Route 53 Application Recovery Controller sets to true
-- to designate the default control panel for a cluster. When you create a
-- cluster, Amazon Route 53 Application Recovery Controller creates a
-- control panel, and sets this flag for that control panel. If you create
-- a control panel yourself, this flag is set to false.
newControlPanel ::
  ControlPanel
newControlPanel :: ControlPanel
newControlPanel =
  ControlPanel' :: Maybe Status
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Bool
-> ControlPanel
ControlPanel'
    { $sel:status:ControlPanel' :: Maybe Status
status = Maybe Status
forall a. Maybe a
Prelude.Nothing,
      $sel:controlPanelArn:ControlPanel' :: Maybe Text
controlPanelArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterArn:ControlPanel' :: Maybe Text
clusterArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:routingControlCount:ControlPanel' :: Maybe Int
routingControlCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ControlPanel' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultControlPanel:ControlPanel' :: Maybe Bool
defaultControlPanel = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The deployment status of control panel. Status can be one of the
-- following: PENDING, DEPLOYED, PENDING_DELETION.
controlPanel_status :: Lens.Lens' ControlPanel (Prelude.Maybe Status)
controlPanel_status :: (Maybe Status -> f (Maybe Status))
-> ControlPanel -> f ControlPanel
controlPanel_status = (ControlPanel -> Maybe Status)
-> (ControlPanel -> Maybe Status -> ControlPanel)
-> Lens ControlPanel ControlPanel (Maybe Status) (Maybe Status)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlPanel' {Maybe Status
status :: Maybe Status
$sel:status:ControlPanel' :: ControlPanel -> Maybe Status
status} -> Maybe Status
status) (\s :: ControlPanel
s@ControlPanel' {} Maybe Status
a -> ControlPanel
s {$sel:status:ControlPanel' :: Maybe Status
status = Maybe Status
a} :: ControlPanel)

-- | The Amazon Resource Name (ARN) of the control panel.
controlPanel_controlPanelArn :: Lens.Lens' ControlPanel (Prelude.Maybe Prelude.Text)
controlPanel_controlPanelArn :: (Maybe Text -> f (Maybe Text)) -> ControlPanel -> f ControlPanel
controlPanel_controlPanelArn = (ControlPanel -> Maybe Text)
-> (ControlPanel -> Maybe Text -> ControlPanel)
-> Lens ControlPanel ControlPanel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlPanel' {Maybe Text
controlPanelArn :: Maybe Text
$sel:controlPanelArn:ControlPanel' :: ControlPanel -> Maybe Text
controlPanelArn} -> Maybe Text
controlPanelArn) (\s :: ControlPanel
s@ControlPanel' {} Maybe Text
a -> ControlPanel
s {$sel:controlPanelArn:ControlPanel' :: Maybe Text
controlPanelArn = Maybe Text
a} :: ControlPanel)

-- | The Amazon Resource Name (ARN) of the cluster that includes the control
-- panel.
controlPanel_clusterArn :: Lens.Lens' ControlPanel (Prelude.Maybe Prelude.Text)
controlPanel_clusterArn :: (Maybe Text -> f (Maybe Text)) -> ControlPanel -> f ControlPanel
controlPanel_clusterArn = (ControlPanel -> Maybe Text)
-> (ControlPanel -> Maybe Text -> ControlPanel)
-> Lens ControlPanel ControlPanel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlPanel' {Maybe Text
clusterArn :: Maybe Text
$sel:clusterArn:ControlPanel' :: ControlPanel -> Maybe Text
clusterArn} -> Maybe Text
clusterArn) (\s :: ControlPanel
s@ControlPanel' {} Maybe Text
a -> ControlPanel
s {$sel:clusterArn:ControlPanel' :: Maybe Text
clusterArn = Maybe Text
a} :: ControlPanel)

-- | The number of routing controls in the control panel.
controlPanel_routingControlCount :: Lens.Lens' ControlPanel (Prelude.Maybe Prelude.Int)
controlPanel_routingControlCount :: (Maybe Int -> f (Maybe Int)) -> ControlPanel -> f ControlPanel
controlPanel_routingControlCount = (ControlPanel -> Maybe Int)
-> (ControlPanel -> Maybe Int -> ControlPanel)
-> Lens ControlPanel ControlPanel (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlPanel' {Maybe Int
routingControlCount :: Maybe Int
$sel:routingControlCount:ControlPanel' :: ControlPanel -> Maybe Int
routingControlCount} -> Maybe Int
routingControlCount) (\s :: ControlPanel
s@ControlPanel' {} Maybe Int
a -> ControlPanel
s {$sel:routingControlCount:ControlPanel' :: Maybe Int
routingControlCount = Maybe Int
a} :: ControlPanel)

-- | The name of the control panel. You can use any non-white space character
-- in the name.
controlPanel_name :: Lens.Lens' ControlPanel (Prelude.Maybe Prelude.Text)
controlPanel_name :: (Maybe Text -> f (Maybe Text)) -> ControlPanel -> f ControlPanel
controlPanel_name = (ControlPanel -> Maybe Text)
-> (ControlPanel -> Maybe Text -> ControlPanel)
-> Lens ControlPanel ControlPanel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlPanel' {Maybe Text
name :: Maybe Text
$sel:name:ControlPanel' :: ControlPanel -> Maybe Text
name} -> Maybe Text
name) (\s :: ControlPanel
s@ControlPanel' {} Maybe Text
a -> ControlPanel
s {$sel:name:ControlPanel' :: Maybe Text
name = Maybe Text
a} :: ControlPanel)

-- | A flag that Amazon Route 53 Application Recovery Controller sets to true
-- to designate the default control panel for a cluster. When you create a
-- cluster, Amazon Route 53 Application Recovery Controller creates a
-- control panel, and sets this flag for that control panel. If you create
-- a control panel yourself, this flag is set to false.
controlPanel_defaultControlPanel :: Lens.Lens' ControlPanel (Prelude.Maybe Prelude.Bool)
controlPanel_defaultControlPanel :: (Maybe Bool -> f (Maybe Bool)) -> ControlPanel -> f ControlPanel
controlPanel_defaultControlPanel = (ControlPanel -> Maybe Bool)
-> (ControlPanel -> Maybe Bool -> ControlPanel)
-> Lens ControlPanel ControlPanel (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlPanel' {Maybe Bool
defaultControlPanel :: Maybe Bool
$sel:defaultControlPanel:ControlPanel' :: ControlPanel -> Maybe Bool
defaultControlPanel} -> Maybe Bool
defaultControlPanel) (\s :: ControlPanel
s@ControlPanel' {} Maybe Bool
a -> ControlPanel
s {$sel:defaultControlPanel:ControlPanel' :: Maybe Bool
defaultControlPanel = Maybe Bool
a} :: ControlPanel)

instance Core.FromJSON ControlPanel where
  parseJSON :: Value -> Parser ControlPanel
parseJSON =
    String
-> (Object -> Parser ControlPanel) -> Value -> Parser ControlPanel
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ControlPanel"
      ( \Object
x ->
          Maybe Status
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Bool
-> ControlPanel
ControlPanel'
            (Maybe Status
 -> Maybe Text
 -> Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Maybe Bool
 -> ControlPanel)
-> Parser (Maybe Status)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe Bool
      -> ControlPanel)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Status)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe Bool
   -> ControlPanel)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Int -> Maybe Text -> Maybe Bool -> ControlPanel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ControlPanelArn")
            Parser
  (Maybe Text
   -> Maybe Int -> Maybe Text -> Maybe Bool -> ControlPanel)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe Text -> Maybe Bool -> ControlPanel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ClusterArn")
            Parser (Maybe Int -> Maybe Text -> Maybe Bool -> ControlPanel)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe Bool -> ControlPanel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RoutingControlCount")
            Parser (Maybe Text -> Maybe Bool -> ControlPanel)
-> Parser (Maybe Text) -> Parser (Maybe Bool -> ControlPanel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser (Maybe Bool -> ControlPanel)
-> Parser (Maybe Bool) -> Parser ControlPanel
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DefaultControlPanel")
      )

instance Prelude.Hashable ControlPanel

instance Prelude.NFData ControlPanel