{-# 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.SecurityHub.Types.AwsRdsDbStatusInfo
-- 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.SecurityHub.Types.AwsRdsDbStatusInfo where

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

-- | Information about the status of a read replica.
--
-- /See:/ 'newAwsRdsDbStatusInfo' smart constructor.
data AwsRdsDbStatusInfo = AwsRdsDbStatusInfo'
  { -- | The status of the read replica instance.
    AwsRdsDbStatusInfo -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | Whether the read replica instance is operating normally.
    AwsRdsDbStatusInfo -> Maybe Bool
normal :: Prelude.Maybe Prelude.Bool,
    -- | The type of status. For a read replica, the status type is read
    -- replication.
    AwsRdsDbStatusInfo -> Maybe Text
statusType :: Prelude.Maybe Prelude.Text,
    -- | If the read replica is currently in an error state, provides the error
    -- details.
    AwsRdsDbStatusInfo -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsRdsDbStatusInfo -> AwsRdsDbStatusInfo -> Bool
(AwsRdsDbStatusInfo -> AwsRdsDbStatusInfo -> Bool)
-> (AwsRdsDbStatusInfo -> AwsRdsDbStatusInfo -> Bool)
-> Eq AwsRdsDbStatusInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsRdsDbStatusInfo -> AwsRdsDbStatusInfo -> Bool
$c/= :: AwsRdsDbStatusInfo -> AwsRdsDbStatusInfo -> Bool
== :: AwsRdsDbStatusInfo -> AwsRdsDbStatusInfo -> Bool
$c== :: AwsRdsDbStatusInfo -> AwsRdsDbStatusInfo -> Bool
Prelude.Eq, ReadPrec [AwsRdsDbStatusInfo]
ReadPrec AwsRdsDbStatusInfo
Int -> ReadS AwsRdsDbStatusInfo
ReadS [AwsRdsDbStatusInfo]
(Int -> ReadS AwsRdsDbStatusInfo)
-> ReadS [AwsRdsDbStatusInfo]
-> ReadPrec AwsRdsDbStatusInfo
-> ReadPrec [AwsRdsDbStatusInfo]
-> Read AwsRdsDbStatusInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsRdsDbStatusInfo]
$creadListPrec :: ReadPrec [AwsRdsDbStatusInfo]
readPrec :: ReadPrec AwsRdsDbStatusInfo
$creadPrec :: ReadPrec AwsRdsDbStatusInfo
readList :: ReadS [AwsRdsDbStatusInfo]
$creadList :: ReadS [AwsRdsDbStatusInfo]
readsPrec :: Int -> ReadS AwsRdsDbStatusInfo
$creadsPrec :: Int -> ReadS AwsRdsDbStatusInfo
Prelude.Read, Int -> AwsRdsDbStatusInfo -> ShowS
[AwsRdsDbStatusInfo] -> ShowS
AwsRdsDbStatusInfo -> String
(Int -> AwsRdsDbStatusInfo -> ShowS)
-> (AwsRdsDbStatusInfo -> String)
-> ([AwsRdsDbStatusInfo] -> ShowS)
-> Show AwsRdsDbStatusInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsRdsDbStatusInfo] -> ShowS
$cshowList :: [AwsRdsDbStatusInfo] -> ShowS
show :: AwsRdsDbStatusInfo -> String
$cshow :: AwsRdsDbStatusInfo -> String
showsPrec :: Int -> AwsRdsDbStatusInfo -> ShowS
$cshowsPrec :: Int -> AwsRdsDbStatusInfo -> ShowS
Prelude.Show, (forall x. AwsRdsDbStatusInfo -> Rep AwsRdsDbStatusInfo x)
-> (forall x. Rep AwsRdsDbStatusInfo x -> AwsRdsDbStatusInfo)
-> Generic AwsRdsDbStatusInfo
forall x. Rep AwsRdsDbStatusInfo x -> AwsRdsDbStatusInfo
forall x. AwsRdsDbStatusInfo -> Rep AwsRdsDbStatusInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsRdsDbStatusInfo x -> AwsRdsDbStatusInfo
$cfrom :: forall x. AwsRdsDbStatusInfo -> Rep AwsRdsDbStatusInfo x
Prelude.Generic)

-- |
-- Create a value of 'AwsRdsDbStatusInfo' 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', 'awsRdsDbStatusInfo_status' - The status of the read replica instance.
--
-- 'normal', 'awsRdsDbStatusInfo_normal' - Whether the read replica instance is operating normally.
--
-- 'statusType', 'awsRdsDbStatusInfo_statusType' - The type of status. For a read replica, the status type is read
-- replication.
--
-- 'message', 'awsRdsDbStatusInfo_message' - If the read replica is currently in an error state, provides the error
-- details.
newAwsRdsDbStatusInfo ::
  AwsRdsDbStatusInfo
newAwsRdsDbStatusInfo :: AwsRdsDbStatusInfo
newAwsRdsDbStatusInfo =
  AwsRdsDbStatusInfo' :: Maybe Text
-> Maybe Bool -> Maybe Text -> Maybe Text -> AwsRdsDbStatusInfo
AwsRdsDbStatusInfo'
    { $sel:status:AwsRdsDbStatusInfo' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:normal:AwsRdsDbStatusInfo' :: Maybe Bool
normal = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:statusType:AwsRdsDbStatusInfo' :: Maybe Text
statusType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:message:AwsRdsDbStatusInfo' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the read replica instance.
awsRdsDbStatusInfo_status :: Lens.Lens' AwsRdsDbStatusInfo (Prelude.Maybe Prelude.Text)
awsRdsDbStatusInfo_status :: (Maybe Text -> f (Maybe Text))
-> AwsRdsDbStatusInfo -> f AwsRdsDbStatusInfo
awsRdsDbStatusInfo_status = (AwsRdsDbStatusInfo -> Maybe Text)
-> (AwsRdsDbStatusInfo -> Maybe Text -> AwsRdsDbStatusInfo)
-> Lens
     AwsRdsDbStatusInfo AwsRdsDbStatusInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRdsDbStatusInfo' {Maybe Text
status :: Maybe Text
$sel:status:AwsRdsDbStatusInfo' :: AwsRdsDbStatusInfo -> Maybe Text
status} -> Maybe Text
status) (\s :: AwsRdsDbStatusInfo
s@AwsRdsDbStatusInfo' {} Maybe Text
a -> AwsRdsDbStatusInfo
s {$sel:status:AwsRdsDbStatusInfo' :: Maybe Text
status = Maybe Text
a} :: AwsRdsDbStatusInfo)

-- | Whether the read replica instance is operating normally.
awsRdsDbStatusInfo_normal :: Lens.Lens' AwsRdsDbStatusInfo (Prelude.Maybe Prelude.Bool)
awsRdsDbStatusInfo_normal :: (Maybe Bool -> f (Maybe Bool))
-> AwsRdsDbStatusInfo -> f AwsRdsDbStatusInfo
awsRdsDbStatusInfo_normal = (AwsRdsDbStatusInfo -> Maybe Bool)
-> (AwsRdsDbStatusInfo -> Maybe Bool -> AwsRdsDbStatusInfo)
-> Lens
     AwsRdsDbStatusInfo AwsRdsDbStatusInfo (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRdsDbStatusInfo' {Maybe Bool
normal :: Maybe Bool
$sel:normal:AwsRdsDbStatusInfo' :: AwsRdsDbStatusInfo -> Maybe Bool
normal} -> Maybe Bool
normal) (\s :: AwsRdsDbStatusInfo
s@AwsRdsDbStatusInfo' {} Maybe Bool
a -> AwsRdsDbStatusInfo
s {$sel:normal:AwsRdsDbStatusInfo' :: Maybe Bool
normal = Maybe Bool
a} :: AwsRdsDbStatusInfo)

-- | The type of status. For a read replica, the status type is read
-- replication.
awsRdsDbStatusInfo_statusType :: Lens.Lens' AwsRdsDbStatusInfo (Prelude.Maybe Prelude.Text)
awsRdsDbStatusInfo_statusType :: (Maybe Text -> f (Maybe Text))
-> AwsRdsDbStatusInfo -> f AwsRdsDbStatusInfo
awsRdsDbStatusInfo_statusType = (AwsRdsDbStatusInfo -> Maybe Text)
-> (AwsRdsDbStatusInfo -> Maybe Text -> AwsRdsDbStatusInfo)
-> Lens
     AwsRdsDbStatusInfo AwsRdsDbStatusInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRdsDbStatusInfo' {Maybe Text
statusType :: Maybe Text
$sel:statusType:AwsRdsDbStatusInfo' :: AwsRdsDbStatusInfo -> Maybe Text
statusType} -> Maybe Text
statusType) (\s :: AwsRdsDbStatusInfo
s@AwsRdsDbStatusInfo' {} Maybe Text
a -> AwsRdsDbStatusInfo
s {$sel:statusType:AwsRdsDbStatusInfo' :: Maybe Text
statusType = Maybe Text
a} :: AwsRdsDbStatusInfo)

-- | If the read replica is currently in an error state, provides the error
-- details.
awsRdsDbStatusInfo_message :: Lens.Lens' AwsRdsDbStatusInfo (Prelude.Maybe Prelude.Text)
awsRdsDbStatusInfo_message :: (Maybe Text -> f (Maybe Text))
-> AwsRdsDbStatusInfo -> f AwsRdsDbStatusInfo
awsRdsDbStatusInfo_message = (AwsRdsDbStatusInfo -> Maybe Text)
-> (AwsRdsDbStatusInfo -> Maybe Text -> AwsRdsDbStatusInfo)
-> Lens
     AwsRdsDbStatusInfo AwsRdsDbStatusInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRdsDbStatusInfo' {Maybe Text
message :: Maybe Text
$sel:message:AwsRdsDbStatusInfo' :: AwsRdsDbStatusInfo -> Maybe Text
message} -> Maybe Text
message) (\s :: AwsRdsDbStatusInfo
s@AwsRdsDbStatusInfo' {} Maybe Text
a -> AwsRdsDbStatusInfo
s {$sel:message:AwsRdsDbStatusInfo' :: Maybe Text
message = Maybe Text
a} :: AwsRdsDbStatusInfo)

instance Core.FromJSON AwsRdsDbStatusInfo where
  parseJSON :: Value -> Parser AwsRdsDbStatusInfo
parseJSON =
    String
-> (Object -> Parser AwsRdsDbStatusInfo)
-> Value
-> Parser AwsRdsDbStatusInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsRdsDbStatusInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool -> Maybe Text -> Maybe Text -> AwsRdsDbStatusInfo
AwsRdsDbStatusInfo'
            (Maybe Text
 -> Maybe Bool -> Maybe Text -> Maybe Text -> AwsRdsDbStatusInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool -> Maybe Text -> Maybe Text -> AwsRdsDbStatusInfo)
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
"Status")
            Parser
  (Maybe Bool -> Maybe Text -> Maybe Text -> AwsRdsDbStatusInfo)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe Text -> AwsRdsDbStatusInfo)
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
"Normal")
            Parser (Maybe Text -> Maybe Text -> AwsRdsDbStatusInfo)
-> Parser (Maybe Text) -> Parser (Maybe Text -> AwsRdsDbStatusInfo)
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
"StatusType")
            Parser (Maybe Text -> AwsRdsDbStatusInfo)
-> Parser (Maybe Text) -> Parser AwsRdsDbStatusInfo
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
"Message")
      )

instance Prelude.Hashable AwsRdsDbStatusInfo

instance Prelude.NFData AwsRdsDbStatusInfo

instance Core.ToJSON AwsRdsDbStatusInfo where
  toJSON :: AwsRdsDbStatusInfo -> Value
toJSON AwsRdsDbStatusInfo' {Maybe Bool
Maybe Text
message :: Maybe Text
statusType :: Maybe Text
normal :: Maybe Bool
status :: Maybe Text
$sel:message:AwsRdsDbStatusInfo' :: AwsRdsDbStatusInfo -> Maybe Text
$sel:statusType:AwsRdsDbStatusInfo' :: AwsRdsDbStatusInfo -> Maybe Text
$sel:normal:AwsRdsDbStatusInfo' :: AwsRdsDbStatusInfo -> Maybe Bool
$sel:status:AwsRdsDbStatusInfo' :: AwsRdsDbStatusInfo -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Status" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
status,
            (Text
"Normal" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
normal,
            (Text
"StatusType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
statusType,
            (Text
"Message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
message
          ]
      )