{-# 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.Neptune.Types.DBInstanceStatusInfo
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Neptune.Types.DBInstanceStatusInfo where

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

-- | Provides a list of status information for a DB instance.
--
-- /See:/ 'newDBInstanceStatusInfo' smart constructor.
data DBInstanceStatusInfo = DBInstanceStatusInfo'
  { -- | Details of the error if there is an error for the instance. If the
    -- instance is not in an error state, this value is blank.
    DBInstanceStatusInfo -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | Boolean value that is true if the instance is operating normally, or
    -- false if the instance is in an error state.
    DBInstanceStatusInfo -> Maybe Bool
normal :: Prelude.Maybe Prelude.Bool,
    -- | Status of the DB instance. For a StatusType of read replica, the values
    -- can be replicating, error, stopped, or terminated.
    DBInstanceStatusInfo -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | This value is currently \"read replication.\"
    DBInstanceStatusInfo -> Maybe Text
statusType :: Prelude.Maybe Prelude.Text
  }
  deriving (DBInstanceStatusInfo -> DBInstanceStatusInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DBInstanceStatusInfo -> DBInstanceStatusInfo -> Bool
$c/= :: DBInstanceStatusInfo -> DBInstanceStatusInfo -> Bool
== :: DBInstanceStatusInfo -> DBInstanceStatusInfo -> Bool
$c== :: DBInstanceStatusInfo -> DBInstanceStatusInfo -> Bool
Prelude.Eq, ReadPrec [DBInstanceStatusInfo]
ReadPrec DBInstanceStatusInfo
Int -> ReadS DBInstanceStatusInfo
ReadS [DBInstanceStatusInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DBInstanceStatusInfo]
$creadListPrec :: ReadPrec [DBInstanceStatusInfo]
readPrec :: ReadPrec DBInstanceStatusInfo
$creadPrec :: ReadPrec DBInstanceStatusInfo
readList :: ReadS [DBInstanceStatusInfo]
$creadList :: ReadS [DBInstanceStatusInfo]
readsPrec :: Int -> ReadS DBInstanceStatusInfo
$creadsPrec :: Int -> ReadS DBInstanceStatusInfo
Prelude.Read, Int -> DBInstanceStatusInfo -> ShowS
[DBInstanceStatusInfo] -> ShowS
DBInstanceStatusInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DBInstanceStatusInfo] -> ShowS
$cshowList :: [DBInstanceStatusInfo] -> ShowS
show :: DBInstanceStatusInfo -> String
$cshow :: DBInstanceStatusInfo -> String
showsPrec :: Int -> DBInstanceStatusInfo -> ShowS
$cshowsPrec :: Int -> DBInstanceStatusInfo -> ShowS
Prelude.Show, forall x. Rep DBInstanceStatusInfo x -> DBInstanceStatusInfo
forall x. DBInstanceStatusInfo -> Rep DBInstanceStatusInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DBInstanceStatusInfo x -> DBInstanceStatusInfo
$cfrom :: forall x. DBInstanceStatusInfo -> Rep DBInstanceStatusInfo x
Prelude.Generic)

-- |
-- Create a value of 'DBInstanceStatusInfo' 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:
--
-- 'message', 'dbInstanceStatusInfo_message' - Details of the error if there is an error for the instance. If the
-- instance is not in an error state, this value is blank.
--
-- 'normal', 'dbInstanceStatusInfo_normal' - Boolean value that is true if the instance is operating normally, or
-- false if the instance is in an error state.
--
-- 'status', 'dbInstanceStatusInfo_status' - Status of the DB instance. For a StatusType of read replica, the values
-- can be replicating, error, stopped, or terminated.
--
-- 'statusType', 'dbInstanceStatusInfo_statusType' - This value is currently \"read replication.\"
newDBInstanceStatusInfo ::
  DBInstanceStatusInfo
newDBInstanceStatusInfo :: DBInstanceStatusInfo
newDBInstanceStatusInfo =
  DBInstanceStatusInfo'
    { $sel:message:DBInstanceStatusInfo' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:normal:DBInstanceStatusInfo' :: Maybe Bool
normal = forall a. Maybe a
Prelude.Nothing,
      $sel:status:DBInstanceStatusInfo' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing,
      $sel:statusType:DBInstanceStatusInfo' :: Maybe Text
statusType = forall a. Maybe a
Prelude.Nothing
    }

-- | Details of the error if there is an error for the instance. If the
-- instance is not in an error state, this value is blank.
dbInstanceStatusInfo_message :: Lens.Lens' DBInstanceStatusInfo (Prelude.Maybe Prelude.Text)
dbInstanceStatusInfo_message :: Lens' DBInstanceStatusInfo (Maybe Text)
dbInstanceStatusInfo_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBInstanceStatusInfo' {Maybe Text
message :: Maybe Text
$sel:message:DBInstanceStatusInfo' :: DBInstanceStatusInfo -> Maybe Text
message} -> Maybe Text
message) (\s :: DBInstanceStatusInfo
s@DBInstanceStatusInfo' {} Maybe Text
a -> DBInstanceStatusInfo
s {$sel:message:DBInstanceStatusInfo' :: Maybe Text
message = Maybe Text
a} :: DBInstanceStatusInfo)

-- | Boolean value that is true if the instance is operating normally, or
-- false if the instance is in an error state.
dbInstanceStatusInfo_normal :: Lens.Lens' DBInstanceStatusInfo (Prelude.Maybe Prelude.Bool)
dbInstanceStatusInfo_normal :: Lens' DBInstanceStatusInfo (Maybe Bool)
dbInstanceStatusInfo_normal = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBInstanceStatusInfo' {Maybe Bool
normal :: Maybe Bool
$sel:normal:DBInstanceStatusInfo' :: DBInstanceStatusInfo -> Maybe Bool
normal} -> Maybe Bool
normal) (\s :: DBInstanceStatusInfo
s@DBInstanceStatusInfo' {} Maybe Bool
a -> DBInstanceStatusInfo
s {$sel:normal:DBInstanceStatusInfo' :: Maybe Bool
normal = Maybe Bool
a} :: DBInstanceStatusInfo)

-- | Status of the DB instance. For a StatusType of read replica, the values
-- can be replicating, error, stopped, or terminated.
dbInstanceStatusInfo_status :: Lens.Lens' DBInstanceStatusInfo (Prelude.Maybe Prelude.Text)
dbInstanceStatusInfo_status :: Lens' DBInstanceStatusInfo (Maybe Text)
dbInstanceStatusInfo_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBInstanceStatusInfo' {Maybe Text
status :: Maybe Text
$sel:status:DBInstanceStatusInfo' :: DBInstanceStatusInfo -> Maybe Text
status} -> Maybe Text
status) (\s :: DBInstanceStatusInfo
s@DBInstanceStatusInfo' {} Maybe Text
a -> DBInstanceStatusInfo
s {$sel:status:DBInstanceStatusInfo' :: Maybe Text
status = Maybe Text
a} :: DBInstanceStatusInfo)

-- | This value is currently \"read replication.\"
dbInstanceStatusInfo_statusType :: Lens.Lens' DBInstanceStatusInfo (Prelude.Maybe Prelude.Text)
dbInstanceStatusInfo_statusType :: Lens' DBInstanceStatusInfo (Maybe Text)
dbInstanceStatusInfo_statusType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBInstanceStatusInfo' {Maybe Text
statusType :: Maybe Text
$sel:statusType:DBInstanceStatusInfo' :: DBInstanceStatusInfo -> Maybe Text
statusType} -> Maybe Text
statusType) (\s :: DBInstanceStatusInfo
s@DBInstanceStatusInfo' {} Maybe Text
a -> DBInstanceStatusInfo
s {$sel:statusType:DBInstanceStatusInfo' :: Maybe Text
statusType = Maybe Text
a} :: DBInstanceStatusInfo)

instance Data.FromXML DBInstanceStatusInfo where
  parseXML :: [Node] -> Either String DBInstanceStatusInfo
parseXML [Node]
x =
    Maybe Text
-> Maybe Bool -> Maybe Text -> Maybe Text -> DBInstanceStatusInfo
DBInstanceStatusInfo'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Message")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Normal")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Status")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"StatusType")

instance Prelude.Hashable DBInstanceStatusInfo where
  hashWithSalt :: Int -> DBInstanceStatusInfo -> Int
hashWithSalt Int
_salt DBInstanceStatusInfo' {Maybe Bool
Maybe Text
statusType :: Maybe Text
status :: Maybe Text
normal :: Maybe Bool
message :: Maybe Text
$sel:statusType:DBInstanceStatusInfo' :: DBInstanceStatusInfo -> Maybe Text
$sel:status:DBInstanceStatusInfo' :: DBInstanceStatusInfo -> Maybe Text
$sel:normal:DBInstanceStatusInfo' :: DBInstanceStatusInfo -> Maybe Bool
$sel:message:DBInstanceStatusInfo' :: DBInstanceStatusInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
normal
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusType

instance Prelude.NFData DBInstanceStatusInfo where
  rnf :: DBInstanceStatusInfo -> ()
rnf DBInstanceStatusInfo' {Maybe Bool
Maybe Text
statusType :: Maybe Text
status :: Maybe Text
normal :: Maybe Bool
message :: Maybe Text
$sel:statusType:DBInstanceStatusInfo' :: DBInstanceStatusInfo -> Maybe Text
$sel:status:DBInstanceStatusInfo' :: DBInstanceStatusInfo -> Maybe Text
$sel:normal:DBInstanceStatusInfo' :: DBInstanceStatusInfo -> Maybe Bool
$sel:message:DBInstanceStatusInfo' :: DBInstanceStatusInfo -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
normal
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusType