{-# 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.MemoryDb.Types.UnprocessedCluster
-- 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.MemoryDb.Types.UnprocessedCluster where

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

-- | A cluster whose updates have failed
--
-- /See:/ 'newUnprocessedCluster' smart constructor.
data UnprocessedCluster = UnprocessedCluster'
  { -- | The name of the cluster
    UnprocessedCluster -> Maybe Text
clusterName :: Prelude.Maybe Prelude.Text,
    -- | The error type associated with the update failure
    UnprocessedCluster -> Maybe Text
errorType :: Prelude.Maybe Prelude.Text,
    -- | The error message associated with the update failure
    UnprocessedCluster -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (UnprocessedCluster -> UnprocessedCluster -> Bool
(UnprocessedCluster -> UnprocessedCluster -> Bool)
-> (UnprocessedCluster -> UnprocessedCluster -> Bool)
-> Eq UnprocessedCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnprocessedCluster -> UnprocessedCluster -> Bool
$c/= :: UnprocessedCluster -> UnprocessedCluster -> Bool
== :: UnprocessedCluster -> UnprocessedCluster -> Bool
$c== :: UnprocessedCluster -> UnprocessedCluster -> Bool
Prelude.Eq, ReadPrec [UnprocessedCluster]
ReadPrec UnprocessedCluster
Int -> ReadS UnprocessedCluster
ReadS [UnprocessedCluster]
(Int -> ReadS UnprocessedCluster)
-> ReadS [UnprocessedCluster]
-> ReadPrec UnprocessedCluster
-> ReadPrec [UnprocessedCluster]
-> Read UnprocessedCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnprocessedCluster]
$creadListPrec :: ReadPrec [UnprocessedCluster]
readPrec :: ReadPrec UnprocessedCluster
$creadPrec :: ReadPrec UnprocessedCluster
readList :: ReadS [UnprocessedCluster]
$creadList :: ReadS [UnprocessedCluster]
readsPrec :: Int -> ReadS UnprocessedCluster
$creadsPrec :: Int -> ReadS UnprocessedCluster
Prelude.Read, Int -> UnprocessedCluster -> ShowS
[UnprocessedCluster] -> ShowS
UnprocessedCluster -> String
(Int -> UnprocessedCluster -> ShowS)
-> (UnprocessedCluster -> String)
-> ([UnprocessedCluster] -> ShowS)
-> Show UnprocessedCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnprocessedCluster] -> ShowS
$cshowList :: [UnprocessedCluster] -> ShowS
show :: UnprocessedCluster -> String
$cshow :: UnprocessedCluster -> String
showsPrec :: Int -> UnprocessedCluster -> ShowS
$cshowsPrec :: Int -> UnprocessedCluster -> ShowS
Prelude.Show, (forall x. UnprocessedCluster -> Rep UnprocessedCluster x)
-> (forall x. Rep UnprocessedCluster x -> UnprocessedCluster)
-> Generic UnprocessedCluster
forall x. Rep UnprocessedCluster x -> UnprocessedCluster
forall x. UnprocessedCluster -> Rep UnprocessedCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UnprocessedCluster x -> UnprocessedCluster
$cfrom :: forall x. UnprocessedCluster -> Rep UnprocessedCluster x
Prelude.Generic)

-- |
-- Create a value of 'UnprocessedCluster' 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:
--
-- 'clusterName', 'unprocessedCluster_clusterName' - The name of the cluster
--
-- 'errorType', 'unprocessedCluster_errorType' - The error type associated with the update failure
--
-- 'errorMessage', 'unprocessedCluster_errorMessage' - The error message associated with the update failure
newUnprocessedCluster ::
  UnprocessedCluster
newUnprocessedCluster :: UnprocessedCluster
newUnprocessedCluster =
  UnprocessedCluster' :: Maybe Text -> Maybe Text -> Maybe Text -> UnprocessedCluster
UnprocessedCluster'
    { $sel:clusterName:UnprocessedCluster' :: Maybe Text
clusterName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorType:UnprocessedCluster' :: Maybe Text
errorType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:UnprocessedCluster' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the cluster
unprocessedCluster_clusterName :: Lens.Lens' UnprocessedCluster (Prelude.Maybe Prelude.Text)
unprocessedCluster_clusterName :: (Maybe Text -> f (Maybe Text))
-> UnprocessedCluster -> f UnprocessedCluster
unprocessedCluster_clusterName = (UnprocessedCluster -> Maybe Text)
-> (UnprocessedCluster -> Maybe Text -> UnprocessedCluster)
-> Lens
     UnprocessedCluster UnprocessedCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedCluster' {Maybe Text
clusterName :: Maybe Text
$sel:clusterName:UnprocessedCluster' :: UnprocessedCluster -> Maybe Text
clusterName} -> Maybe Text
clusterName) (\s :: UnprocessedCluster
s@UnprocessedCluster' {} Maybe Text
a -> UnprocessedCluster
s {$sel:clusterName:UnprocessedCluster' :: Maybe Text
clusterName = Maybe Text
a} :: UnprocessedCluster)

-- | The error type associated with the update failure
unprocessedCluster_errorType :: Lens.Lens' UnprocessedCluster (Prelude.Maybe Prelude.Text)
unprocessedCluster_errorType :: (Maybe Text -> f (Maybe Text))
-> UnprocessedCluster -> f UnprocessedCluster
unprocessedCluster_errorType = (UnprocessedCluster -> Maybe Text)
-> (UnprocessedCluster -> Maybe Text -> UnprocessedCluster)
-> Lens
     UnprocessedCluster UnprocessedCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedCluster' {Maybe Text
errorType :: Maybe Text
$sel:errorType:UnprocessedCluster' :: UnprocessedCluster -> Maybe Text
errorType} -> Maybe Text
errorType) (\s :: UnprocessedCluster
s@UnprocessedCluster' {} Maybe Text
a -> UnprocessedCluster
s {$sel:errorType:UnprocessedCluster' :: Maybe Text
errorType = Maybe Text
a} :: UnprocessedCluster)

-- | The error message associated with the update failure
unprocessedCluster_errorMessage :: Lens.Lens' UnprocessedCluster (Prelude.Maybe Prelude.Text)
unprocessedCluster_errorMessage :: (Maybe Text -> f (Maybe Text))
-> UnprocessedCluster -> f UnprocessedCluster
unprocessedCluster_errorMessage = (UnprocessedCluster -> Maybe Text)
-> (UnprocessedCluster -> Maybe Text -> UnprocessedCluster)
-> Lens
     UnprocessedCluster UnprocessedCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedCluster' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:UnprocessedCluster' :: UnprocessedCluster -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: UnprocessedCluster
s@UnprocessedCluster' {} Maybe Text
a -> UnprocessedCluster
s {$sel:errorMessage:UnprocessedCluster' :: Maybe Text
errorMessage = Maybe Text
a} :: UnprocessedCluster)

instance Core.FromJSON UnprocessedCluster where
  parseJSON :: Value -> Parser UnprocessedCluster
parseJSON =
    String
-> (Object -> Parser UnprocessedCluster)
-> Value
-> Parser UnprocessedCluster
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UnprocessedCluster"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> UnprocessedCluster
UnprocessedCluster'
            (Maybe Text -> Maybe Text -> Maybe Text -> UnprocessedCluster)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> UnprocessedCluster)
forall (f :: * -> *) a b. Functor 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
"ClusterName")
            Parser (Maybe Text -> Maybe Text -> UnprocessedCluster)
-> Parser (Maybe Text) -> Parser (Maybe Text -> UnprocessedCluster)
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
"ErrorType")
            Parser (Maybe Text -> UnprocessedCluster)
-> Parser (Maybe Text) -> Parser UnprocessedCluster
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
"ErrorMessage")
      )

instance Prelude.Hashable UnprocessedCluster

instance Prelude.NFData UnprocessedCluster