{-# 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.Route53RecoveryReadiness.Types.CellOutput
-- 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.Route53RecoveryReadiness.Types.CellOutput where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A Cell and its properties
--
-- /See:/ 'newCellOutput' smart constructor.
data CellOutput = CellOutput'
  { CellOutput -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A list of Cell ARNs and\/or RecoveryGroup ARNs
    CellOutput -> [Text]
parentReadinessScopes :: [Prelude.Text],
    -- | The arn for the Cell
    CellOutput -> Text
cellArn :: Prelude.Text,
    -- | The name of the Cell
    CellOutput -> Text
cellName :: Prelude.Text,
    -- | A list of Cell arns
    CellOutput -> [Text]
cells :: [Prelude.Text]
  }
  deriving (CellOutput -> CellOutput -> Bool
(CellOutput -> CellOutput -> Bool)
-> (CellOutput -> CellOutput -> Bool) -> Eq CellOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CellOutput -> CellOutput -> Bool
$c/= :: CellOutput -> CellOutput -> Bool
== :: CellOutput -> CellOutput -> Bool
$c== :: CellOutput -> CellOutput -> Bool
Prelude.Eq, ReadPrec [CellOutput]
ReadPrec CellOutput
Int -> ReadS CellOutput
ReadS [CellOutput]
(Int -> ReadS CellOutput)
-> ReadS [CellOutput]
-> ReadPrec CellOutput
-> ReadPrec [CellOutput]
-> Read CellOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CellOutput]
$creadListPrec :: ReadPrec [CellOutput]
readPrec :: ReadPrec CellOutput
$creadPrec :: ReadPrec CellOutput
readList :: ReadS [CellOutput]
$creadList :: ReadS [CellOutput]
readsPrec :: Int -> ReadS CellOutput
$creadsPrec :: Int -> ReadS CellOutput
Prelude.Read, Int -> CellOutput -> ShowS
[CellOutput] -> ShowS
CellOutput -> String
(Int -> CellOutput -> ShowS)
-> (CellOutput -> String)
-> ([CellOutput] -> ShowS)
-> Show CellOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CellOutput] -> ShowS
$cshowList :: [CellOutput] -> ShowS
show :: CellOutput -> String
$cshow :: CellOutput -> String
showsPrec :: Int -> CellOutput -> ShowS
$cshowsPrec :: Int -> CellOutput -> ShowS
Prelude.Show, (forall x. CellOutput -> Rep CellOutput x)
-> (forall x. Rep CellOutput x -> CellOutput) -> Generic CellOutput
forall x. Rep CellOutput x -> CellOutput
forall x. CellOutput -> Rep CellOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CellOutput x -> CellOutput
$cfrom :: forall x. CellOutput -> Rep CellOutput x
Prelude.Generic)

-- |
-- Create a value of 'CellOutput' 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:
--
-- 'tags', 'cellOutput_tags' - Undocumented member.
--
-- 'parentReadinessScopes', 'cellOutput_parentReadinessScopes' - A list of Cell ARNs and\/or RecoveryGroup ARNs
--
-- 'cellArn', 'cellOutput_cellArn' - The arn for the Cell
--
-- 'cellName', 'cellOutput_cellName' - The name of the Cell
--
-- 'cells', 'cellOutput_cells' - A list of Cell arns
newCellOutput ::
  -- | 'cellArn'
  Prelude.Text ->
  -- | 'cellName'
  Prelude.Text ->
  CellOutput
newCellOutput :: Text -> Text -> CellOutput
newCellOutput Text
pCellArn_ Text
pCellName_ =
  CellOutput' :: Maybe (HashMap Text Text)
-> [Text] -> Text -> Text -> [Text] -> CellOutput
CellOutput'
    { $sel:tags:CellOutput' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:parentReadinessScopes:CellOutput' :: [Text]
parentReadinessScopes = [Text]
forall a. Monoid a => a
Prelude.mempty,
      $sel:cellArn:CellOutput' :: Text
cellArn = Text
pCellArn_,
      $sel:cellName:CellOutput' :: Text
cellName = Text
pCellName_,
      $sel:cells:CellOutput' :: [Text]
cells = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | Undocumented member.
cellOutput_tags :: Lens.Lens' CellOutput (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
cellOutput_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CellOutput -> f CellOutput
cellOutput_tags = (CellOutput -> Maybe (HashMap Text Text))
-> (CellOutput -> Maybe (HashMap Text Text) -> CellOutput)
-> Lens
     CellOutput
     CellOutput
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CellOutput' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CellOutput' :: CellOutput -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CellOutput
s@CellOutput' {} Maybe (HashMap Text Text)
a -> CellOutput
s {$sel:tags:CellOutput' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CellOutput) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CellOutput -> f CellOutput)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CellOutput
-> f CellOutput
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of Cell ARNs and\/or RecoveryGroup ARNs
cellOutput_parentReadinessScopes :: Lens.Lens' CellOutput [Prelude.Text]
cellOutput_parentReadinessScopes :: ([Text] -> f [Text]) -> CellOutput -> f CellOutput
cellOutput_parentReadinessScopes = (CellOutput -> [Text])
-> (CellOutput -> [Text] -> CellOutput)
-> Lens CellOutput CellOutput [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CellOutput' {[Text]
parentReadinessScopes :: [Text]
$sel:parentReadinessScopes:CellOutput' :: CellOutput -> [Text]
parentReadinessScopes} -> [Text]
parentReadinessScopes) (\s :: CellOutput
s@CellOutput' {} [Text]
a -> CellOutput
s {$sel:parentReadinessScopes:CellOutput' :: [Text]
parentReadinessScopes = [Text]
a} :: CellOutput) (([Text] -> f [Text]) -> CellOutput -> f CellOutput)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CellOutput
-> f CellOutput
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The arn for the Cell
cellOutput_cellArn :: Lens.Lens' CellOutput Prelude.Text
cellOutput_cellArn :: (Text -> f Text) -> CellOutput -> f CellOutput
cellOutput_cellArn = (CellOutput -> Text)
-> (CellOutput -> Text -> CellOutput)
-> Lens CellOutput CellOutput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CellOutput' {Text
cellArn :: Text
$sel:cellArn:CellOutput' :: CellOutput -> Text
cellArn} -> Text
cellArn) (\s :: CellOutput
s@CellOutput' {} Text
a -> CellOutput
s {$sel:cellArn:CellOutput' :: Text
cellArn = Text
a} :: CellOutput)

-- | The name of the Cell
cellOutput_cellName :: Lens.Lens' CellOutput Prelude.Text
cellOutput_cellName :: (Text -> f Text) -> CellOutput -> f CellOutput
cellOutput_cellName = (CellOutput -> Text)
-> (CellOutput -> Text -> CellOutput)
-> Lens CellOutput CellOutput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CellOutput' {Text
cellName :: Text
$sel:cellName:CellOutput' :: CellOutput -> Text
cellName} -> Text
cellName) (\s :: CellOutput
s@CellOutput' {} Text
a -> CellOutput
s {$sel:cellName:CellOutput' :: Text
cellName = Text
a} :: CellOutput)

-- | A list of Cell arns
cellOutput_cells :: Lens.Lens' CellOutput [Prelude.Text]
cellOutput_cells :: ([Text] -> f [Text]) -> CellOutput -> f CellOutput
cellOutput_cells = (CellOutput -> [Text])
-> (CellOutput -> [Text] -> CellOutput)
-> Lens CellOutput CellOutput [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CellOutput' {[Text]
cells :: [Text]
$sel:cells:CellOutput' :: CellOutput -> [Text]
cells} -> [Text]
cells) (\s :: CellOutput
s@CellOutput' {} [Text]
a -> CellOutput
s {$sel:cells:CellOutput' :: [Text]
cells = [Text]
a} :: CellOutput) (([Text] -> f [Text]) -> CellOutput -> f CellOutput)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CellOutput
-> f CellOutput
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON CellOutput where
  parseJSON :: Value -> Parser CellOutput
parseJSON =
    String
-> (Object -> Parser CellOutput) -> Value -> Parser CellOutput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CellOutput"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> [Text] -> Text -> Text -> [Text] -> CellOutput
CellOutput'
            (Maybe (HashMap Text Text)
 -> [Text] -> Text -> Text -> [Text] -> CellOutput)
-> Parser (Maybe (HashMap Text Text))
-> Parser ([Text] -> Text -> Text -> [Text] -> CellOutput)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser ([Text] -> Text -> Text -> [Text] -> CellOutput)
-> Parser [Text] -> Parser (Text -> Text -> [Text] -> CellOutput)
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
"parentReadinessScopes"
                            Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Text -> Text -> [Text] -> CellOutput)
-> Parser Text -> Parser (Text -> [Text] -> CellOutput)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"cellArn")
            Parser (Text -> [Text] -> CellOutput)
-> Parser Text -> Parser ([Text] -> CellOutput)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"cellName")
            Parser ([Text] -> CellOutput) -> Parser [Text] -> Parser CellOutput
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
"cells" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable CellOutput

instance Prelude.NFData CellOutput